summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoah Loomans <noahloomans@gmail.com>2018-04-21 22:03:57 +0200
committerNoah Loomans <noahloomans@gmail.com>2018-04-21 22:03:57 +0200
commit836e752fee59bed9add42ebf3040e298baf2ca2e (patch)
tree75c9fd92fba2b7ebdb185b6319e807d0e79541f4
parent69ae6ada12cd1b2e6b6e4dbf3db55ae22932d17d (diff)
Use ENV vaibales for debugging
-rw-r--r--main.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/main.rb b/main.rb
index 4a3d52b..d275eac 100644
--- a/main.rb
+++ b/main.rb
@@ -14,6 +14,7 @@ class MazeGenerator
@stack = [Pos.new(rand(@maze.width), rand(@maze.height))]
while !@stack.empty?
+ puts @maze if ENV["DEBUG"] == "visual"
step()
end
end
@@ -28,7 +29,7 @@ class MazeGenerator
@stack.pop()
else
randomNeighbor = neighbors.sample
- print "Removing wall between ", @stack.last, " and ", randomNeighbor, "\n"
+ print "Removing wall between ", @stack.last, " and ", randomNeighbor, "\n" if ENV["DEBUG"] == "log"
@maze.set(@stack.last, randomNeighbor.dir_from(@stack.last), false)
@stack.push(randomNeighbor)