a-star 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/A_Star.rb +12 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ad3d1339c994132e1b167d581a31acb56233e9c3
|
4
|
+
data.tar.gz: d31e921b571d3d90bac5019423adcd92b5aa793e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7a3249ebf725239241cf614b4424d8f88c4db1ca839d9fea8fd8e23ae39fb5f1f7f8fbccb3abe0e64abc34bb1ad6974f9d0052423e1efe2dbc4bb3ab57cd919
|
7
|
+
data.tar.gz: a94ce957fcc1703d84c8721fced131a4bb568d9d95410fefbfe544917b1f3f44bf92bc68babe72ce1d5194ee095f43f7858a039bd280c88a0a1c1f2b269cd749
|
data/lib/A_Star.rb
CHANGED
@@ -80,9 +80,15 @@ class AStar
|
|
80
80
|
path.unshift here
|
81
81
|
end
|
82
82
|
puts "The entire path from #{@start} to #{@dest} is: \n#{path}"
|
83
|
-
|
84
|
-
|
83
|
+
|
84
|
+
hue = 0
|
85
|
+
hueCoeff = 360.0 / path.length
|
86
|
+
|
87
|
+
(1..path.length).each do |n|
|
88
|
+
@solvedMaze[ path[n - 1][0], path[n - 1][1] ] = ChunkyPNG::Color.from_hsl(hue, 1, 0.6)
|
89
|
+
hue = (hueCoeff * n).floor # Rainbow!
|
85
90
|
end
|
91
|
+
|
86
92
|
return path
|
87
93
|
end
|
88
94
|
|
@@ -204,10 +210,10 @@ class AStar
|
|
204
210
|
puts "No solution found, solve function returned empty array for path!\nPlease make sure your maze is solvable!"
|
205
211
|
end
|
206
212
|
|
207
|
-
startColour = "#ff3c5e"
|
208
|
-
destColour = "#68ff9f"
|
209
|
-
|
210
|
-
|
213
|
+
#startColour = "#ff3c5e"
|
214
|
+
#destColour = "#68ff9f"
|
215
|
+
#@solvedMaze[@start[0], @start[1]] = ChunkyPNG::Color.from_hex startColour
|
216
|
+
#@solvedMaze[@dest[0], @dest[1]] = ChunkyPNG::Color.from_hex destColour
|
211
217
|
|
212
218
|
@solvedMaze.save(@mazeLabel + "-solved" + @mazeFileType)
|
213
219
|
end
|