Skip to content

Commit 1477de9

Browse files
committed
The Mobile Friendly Update
This update makes the game fully playable without a keyboard! [ADDED] - Fully playable with only mouse or finger - Fully navigable with arrow keys [REMOVED] - Most keyboard shortcuts, as they were undiscoverable [CHANGED] - Swapped controls for quicksort to match bubble sort [FIXED] - Crash on cocktail shaker sort with reversed data
2 parents 79225b6 + 9438b37 commit 1477de9

30 files changed

+453
-210
lines changed

CREDITS.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,8 @@ The above copyright notice and this permission notice shall be included in all c
1010
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1111

1212
# [FreeType](https://www.freetype.org)
13-
Portions of this software are copyright © 2019 The FreeType
14-
Project (www.freetype.org). All rights reserved.
13+
Portions of this software are copyright © 2019 The FreeType Project (www.freetype.org). All rights reserved.
14+
15+
# [Hack](https://github.com/source-foundry/Hack)
16+
17+
The work in the Hack project is Copyright 2018 Source Foundry Authors and licensed under the MIT License

assets/icon-144.png

2.13 KB
Loading

assets/icon-144.png.import

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
[remap]
2+
3+
importer="texture"
4+
type="StreamTexture"
5+
path="res://.import/icon-144.png-9d3b792db2db097cbdfcc8658ca7c104.stex"
6+
metadata={
7+
"vram_texture": false
8+
}
9+
10+
[deps]
11+
12+
source_file="res://assets/icon-144.png"
13+
dest_files=[ "res://.import/icon-144.png-9d3b792db2db097cbdfcc8658ca7c104.stex" ]
14+
15+
[params]
16+
17+
compress/mode=0
18+
compress/lossy_quality=0.7
19+
compress/hdr_mode=0
20+
compress/bptc_ldr=0
21+
compress/normal_map=0
22+
flags/repeat=0
23+
flags/filter=true
24+
flags/mipmaps=false
25+
flags/anisotropic=false
26+
flags/srgb=2
27+
process/fix_alpha_border=true
28+
process/premult_alpha=false
29+
process/HDR_as_SRGB=false
30+
process/invert_color=false
31+
process/normal_map_invert_y=false
32+
stream=false
33+
size_limit=0
34+
detect_3d=true
35+
svg/scale=1.0

assets/icon-16.png

1.26 KB
Loading

assets/icon.png.import renamed to assets/icon-16.png.import

+4-3
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
importer="texture"
44
type="StreamTexture"
5-
path="res://.import/icon.png-b6a7fb2db36edd3d95dc42f1dc8c1c5d.stex"
5+
path="res://.import/icon-16.png-2e34b0184d10db36a6882c1079169a22.stex"
66
metadata={
77
"vram_texture": false
88
}
99

1010
[deps]
1111

12-
source_file="res://assets/icon.png"
13-
dest_files=[ "res://.import/icon.png-b6a7fb2db36edd3d95dc42f1dc8c1c5d.stex" ]
12+
source_file="res://assets/icon-16.png"
13+
dest_files=[ "res://.import/icon-16.png-2e34b0184d10db36a6882c1079169a22.stex" ]
1414

1515
[params]
1616

@@ -28,6 +28,7 @@ process/fix_alpha_border=true
2828
process/premult_alpha=false
2929
process/HDR_as_SRGB=false
3030
process/invert_color=false
31+
process/normal_map_invert_y=false
3132
stream=false
3233
size_limit=0
3334
detect_3d=true

assets/icon-180.png

2.45 KB
Loading

assets/icon-180.png.import

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
[remap]
2+
3+
importer="texture"
4+
type="StreamTexture"
5+
path="res://.import/icon-180.png-e024a7fa55520566a42315fde1072434.stex"
6+
metadata={
7+
"vram_texture": false
8+
}
9+
10+
[deps]
11+
12+
source_file="res://assets/icon-180.png"
13+
dest_files=[ "res://.import/icon-180.png-e024a7fa55520566a42315fde1072434.stex" ]
14+
15+
[params]
16+
17+
compress/mode=0
18+
compress/lossy_quality=0.7
19+
compress/hdr_mode=0
20+
compress/bptc_ldr=0
21+
compress/normal_map=0
22+
flags/repeat=0
23+
flags/filter=true
24+
flags/mipmaps=false
25+
flags/anisotropic=false
26+
flags/srgb=2
27+
process/fix_alpha_border=true
28+
process/premult_alpha=false
29+
process/HDR_as_SRGB=false
30+
process/invert_color=false
31+
process/normal_map_invert_y=false
32+
stream=false
33+
size_limit=0
34+
detect_3d=true
35+
svg/scale=1.0

assets/icon-32.jpg

7.23 KB
Loading

assets/icon-32.jpg.import

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
[remap]
2+
3+
importer="texture"
4+
type="StreamTexture"
5+
path="res://.import/icon-32.jpg-b649e61d7245e645722b7f8e730da2cd.stex"
6+
metadata={
7+
"vram_texture": false
8+
}
9+
10+
[deps]
11+
12+
source_file="res://assets/icon-32.jpg"
13+
dest_files=[ "res://.import/icon-32.jpg-b649e61d7245e645722b7f8e730da2cd.stex" ]
14+
15+
[params]
16+
17+
compress/mode=0
18+
compress/lossy_quality=0.7
19+
compress/hdr_mode=0
20+
compress/bptc_ldr=0
21+
compress/normal_map=0
22+
flags/repeat=0
23+
flags/filter=true
24+
flags/mipmaps=false
25+
flags/anisotropic=false
26+
flags/srgb=2
27+
process/fix_alpha_border=true
28+
process/premult_alpha=false
29+
process/HDR_as_SRGB=false
30+
process/invert_color=false
31+
process/normal_map_invert_y=false
32+
stream=false
33+
size_limit=0
34+
detect_3d=true
35+
svg/scale=1.0

assets/icon-512.png

7.53 KB
Loading

assets/icon-512.png.import

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
[remap]
2+
3+
importer="texture"
4+
type="StreamTexture"
5+
path="res://.import/icon-512.png-9ffeb4f9432dc60ba1060cabdc803e21.stex"
6+
metadata={
7+
"vram_texture": false
8+
}
9+
10+
[deps]
11+
12+
source_file="res://assets/icon-512.png"
13+
dest_files=[ "res://.import/icon-512.png-9ffeb4f9432dc60ba1060cabdc803e21.stex" ]
14+
15+
[params]
16+
17+
compress/mode=0
18+
compress/lossy_quality=0.7
19+
compress/hdr_mode=0
20+
compress/bptc_ldr=0
21+
compress/normal_map=0
22+
flags/repeat=0
23+
flags/filter=true
24+
flags/mipmaps=false
25+
flags/anisotropic=false
26+
flags/srgb=2
27+
process/fix_alpha_border=true
28+
process/premult_alpha=false
29+
process/HDR_as_SRGB=false
30+
process/invert_color=false
31+
process/normal_map_invert_y=false
32+
stream=false
33+
size_limit=0
34+
detect_3d=true
35+
svg/scale=1.0

assets/icon-64.png

1.43 KB
Loading

assets/icon-64.png.import

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
[remap]
2+
3+
importer="texture"
4+
type="StreamTexture"
5+
path="res://.import/icon-64.png-3e6bad0b08e2539a5ec251f744092e7d.stex"
6+
metadata={
7+
"vram_texture": false
8+
}
9+
10+
[deps]
11+
12+
source_file="res://assets/icon-64.png"
13+
dest_files=[ "res://.import/icon-64.png-3e6bad0b08e2539a5ec251f744092e7d.stex" ]
14+
15+
[params]
16+
17+
compress/mode=0
18+
compress/lossy_quality=0.7
19+
compress/hdr_mode=0
20+
compress/bptc_ldr=0
21+
compress/normal_map=0
22+
flags/repeat=0
23+
flags/filter=true
24+
flags/mipmaps=false
25+
flags/anisotropic=false
26+
flags/srgb=2
27+
process/fix_alpha_border=true
28+
process/premult_alpha=false
29+
process/HDR_as_SRGB=false
30+
process/invert_color=false
31+
process/normal_map_invert_y=false
32+
stream=false
33+
size_limit=0
34+
detect_3d=true
35+
svg/scale=1.0

assets/icon.png

-1.44 KB
Binary file not shown.

assets/theme.theme

16 Bytes
Binary file not shown.

levels/cocktail_shaker_sort.gd

+3-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const ACTIONS = {
3636
"CONTINUE": "Right",
3737
}
3838
var _index = 0 # First of two elements being compared
39-
var _sorted = 0 # Size of the sorted subarray at the end of the array
39+
var _sorted = 0 # Size of the sorted subarrays at the two ends of the array
4040
var _forwards = true
4141
var _swapped = false
4242

@@ -61,6 +61,8 @@ func next(action):
6161
_forwards = false
6262
_index -= 2
6363
_sorted += 1
64+
if _sorted == array.size / 2:
65+
emit_signal("done")
6466
else:
6567
_index -= 1
6668
if _index == _sorted - 2:

levels/comparison_sort.gd

+8-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const EFFECTS = {
1010
"DIMMED": GlobalTheme.DARK_GREEN,
1111
}
1212

13-
const DISABLE_TIME = 1.0
13+
const DISABLE_TIME = .5
1414

1515
var array: ArrayModel
1616

@@ -30,8 +30,14 @@ func _ready():
3030

3131
func _input(event):
3232
"""Pass input events for checking and take appropriate action."""
33-
if event.is_pressed():
33+
if event is InputEventKey and event.is_pressed():
3434
return next(event.as_text())
35+
if event is InputEventMouseButton and event.is_pressed():
36+
if event.position.y > 100:
37+
if event.position.x < ProjectSettings.get_setting("display/window/size/width") / 2:
38+
return next("Left")
39+
else:
40+
return next("Right")
3541

3642
func next(action):
3743
"""Check the action and advance state or emit signal as needed."""

levels/merge_sort.gd

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
class_name MergeSort
22
extends ComparisonSort
33

4+
# BUG: Crashes on array sizes that are not powers of two
5+
46
const NAME = "MERGE SORT"
57
const DESCRIPTION = """
68
Merge sort merges subarrays of increasing size by setting a pointer to

levels/quick_sort.gd

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ which it is faster than at the tradeoff of stability.
1515
"""
1616
const CONTROLS = """
1717
If the highlighted element is less than the pivot or the pivot has been
18-
reached, press LEFT ARROW. Otherwise, press RIGHT ARROW.
18+
reached, press RIGHT ARROW. Otherwise, press LEFT ARROW.
1919
"""
2020
const CODE = """
2121
def quicksort(a, low=0, high=len(a) - 1):
@@ -30,8 +30,8 @@ def quicksort(a, low=0, high=len(a) - 1):
3030
quicksort(a, pointer + 1, high)
3131
"""
3232
const ACTIONS = {
33-
"SWAP": "Left",
34-
"CONTINUE": "Right",
33+
"CONTINUE": "Left",
34+
"SWAP": "Right",
3535
}
3636
var _index = 0 # Index of element being compared with pivot
3737
var _pointer = 0 # Boundary between partitions

project.godot

+9-43
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ _global_script_class_icons={
113113
config/name="Algorithm Simulator"
114114
run/main_scene="res://scenes/menu.tscn"
115115
boot_splash/image="res://assets/splash.png"
116-
config/icon="res://assets/icon.png"
116+
config/icon="res://assets/icon-512.png"
117117

118118
[autoload]
119119

@@ -127,6 +127,7 @@ window/size/width=1280
127127
window/size/height=720
128128
window/size/always_on_top=true
129129
window/dpi/allow_hidpi=true
130+
window/energy_saving/keep_screen_on=false
130131
window/stretch/mode="2d"
131132
window/stretch/aspect="keep"
132133

@@ -142,71 +143,36 @@ theme/use_hidpi=true
142143

143144
ui_accept={
144145
"deadzone": 0.5,
145-
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777221,"unicode":0,"echo":false,"script":null)
146-
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777222,"unicode":0,"echo":false,"script":null)
147-
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":32,"unicode":0,"echo":false,"script":null)
146+
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777221,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
147+
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777222,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
148+
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":32,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
148149
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":0,"pressure":0.0,"pressed":false,"script":null)
149150
]
150151
}
151152
ui_left={
152153
"deadzone": 0.5,
153-
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777231,"unicode":0,"echo":false,"script":null)
154+
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777231,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
154155
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":14,"pressure":0.0,"pressed":false,"script":null)
155156
]
156157
}
157158
ui_right={
158159
"deadzone": 0.5,
159-
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777233,"unicode":0,"echo":false,"script":null)
160+
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777233,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
160161
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":15,"pressure":0.0,"pressed":false,"script":null)
161162
]
162163
}
163164
ui_up={
164165
"deadzone": 0.5,
165-
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777232,"unicode":0,"echo":false,"script":null)
166+
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777232,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
166167
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":12,"pressure":0.0,"pressed":false,"script":null)
167168
]
168169
}
169170
ui_down={
170171
"deadzone": 0.5,
171-
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777234,"unicode":0,"echo":false,"script":null)
172+
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777234,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
172173
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":13,"pressure":0.0,"pressed":false,"script":null)
173174
]
174175
}
175-
faster={
176-
"deadzone": 0.5,
177-
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":68,"unicode":0,"echo":false,"script":null)
178-
]
179-
}
180-
slower={
181-
"deadzone": 0.5,
182-
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":65,"unicode":0,"echo":false,"script":null)
183-
]
184-
}
185-
bigger={
186-
"deadzone": 0.5,
187-
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":87,"unicode":0,"echo":false,"script":null)
188-
]
189-
}
190-
smaller={
191-
"deadzone": 0.5,
192-
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":83,"unicode":0,"echo":false,"script":null)
193-
]
194-
}
195-
toggle_sound={
196-
"deadzone": 0.5,
197-
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":77,"unicode":0,"echo":false,"script":null)
198-
]
199-
}
200-
change_data={
201-
"deadzone": 0.5,
202-
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":67,"unicode":0,"echo":false,"script":null)
203-
]
204-
}
205-
big_preview={
206-
"deadzone": 0.5,
207-
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":66,"unicode":0,"echo":false,"script":null)
208-
]
209-
}
210176

211177
[rendering]
212178

0 commit comments

Comments
 (0)