Class: MazeRule
Instance Method Summary collapse
- #calculate(x, y) ⇒ Object
-
#can_go?(x, y) ⇒ Boolean
can go?.
-
#initialize(maze) ⇒ MazeRule
constructor
A new instance of MazeRule.
- #success?(x, y) ⇒ Boolean
Methods inherited from Rule
Constructor Details
#initialize(maze) ⇒ MazeRule
Returns a new instance of MazeRule.
3 4 5 |
# File 'lib/my_own_maze/rule/maze_rule.rb', line 3 def initialize(maze) @maze = maze end |
Instance Method Details
#calculate(x, y) ⇒ Object
16 17 18 |
# File 'lib/my_own_maze/rule/maze_rule.rb', line 16 def calculate(x, y) MazeSolution.new(@maze).calculate(x, y) end |
#can_go?(x, y) ⇒ Boolean
can go?
12 13 14 |
# File 'lib/my_own_maze/rule/maze_rule.rb', line 12 def can_go?(x, y) @maze.has_point?(x, y) end |
#success?(x, y) ⇒ Boolean
7 8 9 |
# File 'lib/my_own_maze/rule/maze_rule.rb', line 7 def success?(x, y) @maze.is_end?(x, y) end |