summaryrefslogtreecommitdiff
path: root/maze_generator.rb
diff options
context:
space:
mode:
authorNoah Loomans <noahloomans@gmail.com>2018-04-22 14:59:57 +0200
committerNoah Loomans <noahloomans@gmail.com>2018-04-22 14:59:57 +0200
commitf5bcd76d2c0420e61425f3cfd000f6a86445cb62 (patch)
treeb11c83081fd94a3d813cb07bf5aa1fe09483c271 /maze_generator.rb
parentba3c0382264fd6844fee3b1ea26c47c9d5332b82 (diff)
Add default stack_treshold
Diffstat (limited to 'maze_generator.rb')
-rw-r--r--maze_generator.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/maze_generator.rb b/maze_generator.rb
index 9afb459..5261f87 100644
--- a/maze_generator.rb
+++ b/maze_generator.rb
@@ -4,9 +4,15 @@ require_relative 'maze'
class MazeGenerator
attr_reader :maze
- def initialize(width, height, stack_threshold)
+ def initialize(width, height, stack_threshold = nil)
@maze = Maze.new(width, height)
- @stack_threshold = stack_threshold
+
+ @stack_threshold = if stack_threshold
+ stack_threshold
+ else
+ width * height
+ end
+
@visitedTiles = Array.new(width) { Array.new(height) { false } }
end