Class: Maze::Formatter::Ascii::Orthogonal

Inherits:
Object
  • Object
show all
Includes:
Maze::Formatter::Ascii
Defined in:
lib/maze/formatters/ascii/orthogonal.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Maze::Formatter::Ascii

#canvas_draw, #canvas_update, #to_s

Constructor Details

#initialize(maze) ⇒ Orthogonal

Returns a new instance of Orthogonal.



12
13
14
15
16
17
18
19
# File 'lib/maze/formatters/ascii/orthogonal.rb', line 12

def initialize(maze)
  @maze   = maze
  @canvas = Array.new(maze.height + 1) do
    Array.new(maze.width * 2, ' ')
  end

  canvas_draw
end

Instance Attribute Details

#canvasObject (readonly)

Returns the value of attribute canvas.



8
9
10
# File 'lib/maze/formatters/ascii/orthogonal.rb', line 8

def canvas
  @canvas
end

#mazeObject (readonly)

Returns the value of attribute maze.



8
9
10
# File 'lib/maze/formatters/ascii/orthogonal.rb', line 8

def maze
  @maze
end