Warning Rookie/newb mistakes contained within read at your own risk!
Ok trying to put together some code to read and print a text based maze file. This is what I have so far:
def read_maze( filename )
local_maze = []
mz_file = File.open(filename,"r")
while ! mz_file.eof? do
line = mz_file.gets.chomp
local_maze = line.scan(/./)
end
mz_file.close
return local_maze
end
puts "done"
maze = read_maze("maze1.mz")
def print_maze( maze )
maze.each {|row|
puts row.join("")
}
end
puts "made it too next step"
print_maze(maze)
here's my maze1.mz file representation called from another file
########
# F #
#### #
# S #
########
I'm getting method errors inside my custom defs here's what netbeans spits back
done quick note: I edited my C:\ errors to not list my directoy structure on hard drive
C:\test.rb:21:in print_maze': undefined method
join' for "#":String (NoMethodError)
made it too next step
C:\test.rb:20:in each'
C:\test.rb:20:in
print_maze'
C:\test.rb:25
I've been looking at this for about 2 hours and haven't been able to resolve the # issue irb is not helping either