Created
April 27, 2025 09:59
-
-
Save Achie72/750ee386b9e67fe459d7d580b3e23ff7 to your computer and use it in GitHub Desktop.
insertion sort by impbox
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Insertion Sort by @impbox | |
-- this will sort our closed list by the A* F value. | |
function sort(array) | |
for i=1,#array do | |
local j = i | |
while j > 1 and array[j-1].f < array[j].f do | |
array[j],array[j-1] = array[j-1],array[j] | |
j = j - 1 | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment