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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/A_Star.rb +12 -6
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 052e0058b0d2cb1ef7c6f192e0b37be5a10ca622
4
- data.tar.gz: 1a1891b30fa7ae631a6cad1ad36016905c4b501d
3
+ metadata.gz: ad3d1339c994132e1b167d581a31acb56233e9c3
4
+ data.tar.gz: d31e921b571d3d90bac5019423adcd92b5aa793e
5
5
  SHA512:
6
- metadata.gz: ae479f3dfcbc3bee285023d1a208d4caebaeac17fe7101666eebf39102b9bb1df2f091cb8e1a101c7736b9ca12b452a72dda232edc74b969ccfa21e141022cb6
7
- data.tar.gz: 02673ffc1671125fd9fb7e59640487c6f4275eeda78a64b814f2da2e826c7fec0a025a83756e810d8b89cfd37e9dfa37f387da5f3870bf855e9caafd2df318d2
6
+ metadata.gz: a7a3249ebf725239241cf614b4424d8f88c4db1ca839d9fea8fd8e23ae39fb5f1f7f8fbccb3abe0e64abc34bb1ad6974f9d0052423e1efe2dbc4bb3ab57cd919
7
+ data.tar.gz: a94ce957fcc1703d84c8721fced131a4bb568d9d95410fefbfe544917b1f3f44bf92bc68babe72ce1d5194ee095f43f7858a039bd280c88a0a1c1f2b269cd749
@@ -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
- path.each do |arr|
84
- @solvedMaze[arr[0], arr[1]] = ChunkyPNG::Color.from_hex "#752bff"
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
- @solvedMaze[@start[0], @start[1]] = ChunkyPNG::Color.from_hex startColour
210
- @solvedMaze[@dest[0], @dest[1]] = ChunkyPNG::Color.from_hex destColour
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: a-star
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Demonstrandum