Module: UpdateMap
- Included in:
- Maze
- Defined in:
- lib/helper_tools/update_map.rb
Instance Method Summary collapse
- #place_character(alt_map = nil) ⇒ Object
- #print_map(map_array = nil) ⇒ Object
- #reset_map ⇒ Object
- #reset_screen ⇒ Object
- #update_and_print ⇒ Object
Instance Method Details
#place_character(alt_map = nil) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/helper_tools/update_map.rb', line 11 def place_character(alt_map=nil) if alt_map alt_map[current_square[0]][current_square[1]] = character else presenting_map[current_square[0]][current_square[1]] = character end end |
#print_map(map_array = nil) ⇒ Object
19 20 21 |
# File 'lib/helper_tools/update_map.rb', line 19 def print_map(map_array=nil) (map_array || presenting_map).each { |row| puts row.join("") } end |
#reset_map ⇒ Object
6 7 8 |
# File 'lib/helper_tools/update_map.rb', line 6 def reset_map self.presenting_map = dup_map end |
#reset_screen ⇒ Object
2 3 4 |
# File 'lib/helper_tools/update_map.rb', line 2 def reset_screen print "\e[2J\e[H" end |
#update_and_print ⇒ Object
23 24 25 26 27 28 |
# File 'lib/helper_tools/update_map.rb', line 23 def update_and_print reset_screen reset_map place_character print_map end |