Class: MazeCrosser::RecursiveAlgorithmRunner

Inherits:
Object
  • Object
show all
Defined in:
lib/maze_crosser/algorithms/recursive_algorithm_runner.rb

Overview

Class responsible for applying resursive algorithm to a maze.

recursive_algorithm = RecursiveAlgorithmRunner.new(maze)

Run the algorithm recursive_algorithm.run

Instance Method Summary collapse

Constructor Details

#initialize(maze) ⇒ RecursiveAlgorithmRunner

Returns a new instance of RecursiveAlgorithmRunner.



9
10
11
12
# File 'lib/maze_crosser/algorithms/recursive_algorithm_runner.rb', line 9

def initialize(maze)
  @maze = maze
  @path = []
end

Instance Method Details

#runObject



14
15
16
17
# File 'lib/maze_crosser/algorithms/recursive_algorithm_runner.rb', line 14

def run
  find_path(@maze.start)
  @path
end