Skip to content

Commit 2c3e97c

Browse files
committed
more consistent highlights
1 parent 9a0d391 commit 2c3e97c

File tree

2 files changed

+33
-30
lines changed

2 files changed

+33
-30
lines changed

SortingVisualizer.opal

+5-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ new float UNIT_SAMPLE_DURATION = 1.0 / 30.0,
1616
N_OVER_R = NATIVE_FRAMERATE / RENDER_FRAMERATE,
1717
R_OVER_N = RENDER_FRAMERATE / NATIVE_FRAMERATE;
1818

19-
new str VERSION = "2024.5.5";
19+
new str VERSION = "2024.5.7";
2020

2121
import math, random, time, os, numpy, sys,
2222
pygame_gui, json, subprocess, shutil,
@@ -1192,7 +1192,10 @@ new class SortingVisualizer {
11921192

11931193
while running {
11941194
time.sleep(0.005); # this fixes some freezing issues (???)
1195-
this.multiHighlightAdvanced([]);
1195+
1196+
with this.highlightsLock {
1197+
this.multiHighlightAdvanced([]);
1198+
}
11961199
}
11971200

11981201
t.join();

threads/runAllSorts.opal

+28-28
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,13 @@ runAllSort(1024, "Weak Heap Sort", 5);
9999

100100

101101
ct = "Concurrent Sorts";
102-
runAllSort(1024, "Bose Nelson", 7);
103-
runAllSort(2048, "Bose Nelson (Parallel)", 0.05);
104-
runAllSort(1024, "Fold Sort", 7);
105-
runAllSort(1024, "Bitonic Sort", 5);
106-
runAllSort(2048, "Bitonic Sort (Parallel)", 0.05);
107-
runAllSort(1024, "Pairwise", 5);
108-
runAllSort(1024, "Odd Even Merge", 5);
102+
runAllSort(1024, "Bose Nelson", 7);
103+
runAllSort(2048, "Bose Nelson (Parallel)", 1);
104+
runAllSort(1024, "Fold Sort", 7);
105+
runAllSort(1024, "Bitonic Sort", 5);
106+
runAllSort(2048, "Bitonic Sort (Parallel)", 1);
107+
runAllSort(1024, "Pairwise", 5);
108+
runAllSort(1024, "Odd Even Merge", 5);
109109

110110

111111
ct = "Quick Sorts";
@@ -136,31 +136,31 @@ new dict firstKillers = {
136136
"Perlin Noise": ["Sorted"]
137137
};
138138

139-
runAllSort(1024, "LL Quick Sort", 4, pivotSelections.index("First"), firstKillers);
140-
runAllSort(1024, "LL Quick Sort (Parallel)", 0.5, pivotSelections.index("First"), firstKillers);
141-
runAllSort(1024, "LR Quick Sort", 4, pivotSelections.index("Middle"), centerKillers);
142-
runAllSort(1024, "LR Quick Sort (Parallel)", 0.5, pivotSelections.index("Middle"), centerKillers);
139+
runAllSort(1024, "LL Quick Sort", 4, pivotSelections.index("First"), firstKillers);
140+
runAllSort(1024, "LL Quick Sort (Parallel)", 4, pivotSelections.index("First"), firstKillers);
141+
runAllSort(1024, "LR Quick Sort", 4, pivotSelections.index("Middle"), centerKillers);
142+
runAllSort(1024, "LR Quick Sort (Parallel)", 4, pivotSelections.index("Middle"), centerKillers);
143143
centerKillers["Linear"].remove("Reversed Sawtooth");
144-
runAllSort(1024, "Stackless Quick", 4, pivotSelections.index("Median of three (unstable)"), centerKillers);
145-
runAllSort(1024, "Dual Pivot Quick", 4, killers = centerKillers);
146-
runAllSort(2048, "Median-Of-16 A. Quick", 10);
147-
runAllSort(2048, "PDQ Sort", 10);
148-
runAllSort(1024, "Aeos Quick", 3);
149-
runAllSort(1024, "Log Sort", 3, 0);
144+
runAllSort(1024, "Stackless Quick", 4, pivotSelections.index("Median of three (unstable)"), centerKillers);
145+
runAllSort(1024, "Dual Pivot Quick", 4, killers = centerKillers);
146+
runAllSort(2048, "Median-Of-16 A. Quick", 10);
147+
runAllSort(2048, "PDQ Sort", 10);
148+
runAllSort(1024, "Aeos Quick", 3);
149+
runAllSort(1024, "Log Sort", 3, 0);
150150

151151

152152
ct = "Merge Sorts";
153-
runAllSort(1024, "Merge Sort", 8);
154-
runAllSort(2048, "Merge Sort (Parallel)", 1);
155-
runAllSort(1024, "Bottom Up Merge", 4);
156-
runAllSort(256, "Lazy Stable", 4, rotations.index("Gries-Mills"));
157-
runAllSort(1024, "Rotate Merge", 3, rotations.index("Gries-Mills"));
158-
runAllSort(2048, "Rotate Merge (Parallel)", 0.25, rotations.index("Gries-Mills"));
159-
runAllSort(1024, "Adaptive Rotate Merge", 5, 128);
160-
runAllSort(1024, "Uranium Sort", 2);
161-
runAllSort(1024, "Tim Sort", 5);
162-
runAllSort(2048, "Andrey's Merge", 8);
163-
runAllSort(2048, "Buf Merge 2", 3, rotations.index("Helium"));
153+
runAllSort(1024, "Merge Sort", 8);
154+
runAllSort(2048, "Merge Sort (Parallel)", 2);
155+
runAllSort(1024, "Bottom Up Merge", 4);
156+
runAllSort(256, "Lazy Stable", 4, rotations.index("Gries-Mills"));
157+
runAllSort(1024, "Rotate Merge", 3, rotations.index("Gries-Mills"));
158+
runAllSort(2048, "Rotate Merge (Parallel)", 1, rotations.index("Gries-Mills"));
159+
runAllSort(1024, "Adaptive Rotate Merge", 5, 128);
160+
runAllSort(1024, "Uranium Sort", 2);
161+
runAllSort(1024, "Tim Sort", 5);
162+
runAllSort(2048, "Andrey's Merge", 8);
163+
runAllSort(2048, "Buf Merge 2", 3, rotations.index("Helium"));
164164

165165

166166
ct = "Block Merge Sorts";

0 commit comments

Comments
 (0)