summaryrefslogtreecommitdiff
path: root/maze_generator.rb
diff options
context:
space:
mode:
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