Class: MazeSolver::Maze

Inherits:
Object
  • Object
show all
Defined in:
lib/maze_solver/maze.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(maze) ⇒ Maze

Returns a new instance of Maze.



9
10
11
12
13
14
# File 'lib/maze_solver/maze.rb', line 9

def initialize(maze)
  @maze = maze
  @closed = [] # Already proccessed

  set_start_and_goal
end

Instance Attribute Details

#mazeObject (readonly)

Class which Represent the maze



7
8
9
# File 'lib/maze_solver/maze.rb', line 7

def maze
  @maze
end

Instance Method Details

#solveObject



16
17
18
19
20
21
22
# File 'lib/maze_solver/maze.rb', line 16

def solve
  ## Begin process !!
  tree = Tree.new # Instanciate a tree with start point as first pushing
  tree.push(@start, @start.f)

  reverse_path( algorithm(tree) ) # RUUUN
end