diff --git a/Assets/Scripts/ArrayController.cs b/Assets/Scripts/ArrayController.cs index f3c2eb1..a069e64 100644 --- a/Assets/Scripts/ArrayController.cs +++ b/Assets/Scripts/ArrayController.cs @@ -703,18 +703,20 @@ IEnumerator CountingSort(int[] Array, int place) { //count number of occurrences in freq array for (int i = 0; i < n; i++) { yield return new WaitForSeconds(time); - pillars[i].GetComponent().Color = tempColor; + if (pillars[i].GetComponent().Color != nextColor) + pillars[i].GetComponent().Color = swapColor; freq[(Array[i] / place) % 10]++; } for (int i = 0; i < Array.Length; i++) { - pillars[i].GetComponent().Color = whiteColor; + if (pillars[i].GetComponent().Color != nextColor) + pillars[i].GetComponent().Color = whiteColor; } //Change count[i] so that count[i] now contains actual //position of this digit in output[] for (int i = 1; i < 10; i++) { - yield return new WaitForSeconds(time); + //yield return new WaitForSeconds(time); freq[i] += freq[i - 1]; } @@ -723,11 +725,13 @@ IEnumerator CountingSort(int[] Array, int place) { yield return new WaitForSeconds(time); output[freq[(Array[i] / place) % 10] - 1] = Array[i]; freq[(Array[i] / place) % 10]--; - pillars[i].GetComponent().Color = tempColor; + if (pillars[i].GetComponent().Color != nextColor) + pillars[i].GetComponent().Color = tempColor; } for (int i = 0; i < Array.Length; i++) { - pillars[i].GetComponent().Color = whiteColor; + if (pillars[i].GetComponent().Color != nextColor) + pillars[i].GetComponent().Color = whiteColor; } //Copy the output array to the input Array, Now the Array will diff --git a/docs/Build/docs.data b/docs/Build/docs.data index cd00df6..6370a60 100644 Binary files a/docs/Build/docs.data and b/docs/Build/docs.data differ diff --git a/docs/Build/docs.wasm b/docs/Build/docs.wasm index f0db412..6446dba 100644 Binary files a/docs/Build/docs.wasm and b/docs/Build/docs.wasm differ