Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
40 lines (33 sloc) 701 Bytes
require 'location'
class Printer
def initialize(maze, size)
@maze = maze
@size = size
end
def print
result = ""
(1..@size).each do |y|
(1..@size).each do |x|
location = Location.new(x, y)
if @maze.has_route?(location, location.up)
result << "* "
else
result << "**"
end
end
result << "*\n"
(1..@size).each do |x|
location = Location.new(x, y)
if @maze.has_route?(location, location.left)
result << " "
else
result << "*"
end
result << " "
end
result << "*\n"
end
result << "*"*(@size*2+1) + "\n"
result
end
end
Something went wrong with that request. Please try again.