Class: RubyTerminalGames::Snake::Board
- Defined in:
- lib/ruby_terminal_games/snake/board.rb
Instance Attribute Summary
Attributes inherited from Board
Instance Method Summary collapse
-
#initialize(width: nil, height: nil) ⇒ Board
constructor
A new instance of Board.
- #print_world!(game) ⇒ Object
Methods inherited from Board
#clear!, #draw_border!, #move_cursor, #write
Constructor Details
#initialize(width: nil, height: nil) ⇒ Board
Returns a new instance of Board.
4 5 6 7 8 |
# File 'lib/ruby_terminal_games/snake/board.rb', line 4 def initialize(width: nil, height: nil) super @width = cols @height = rows - 1 end |
Instance Method Details
#print_world!(game) ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/ruby_terminal_games/snake/board.rb', line 10 def print_world!(game) clear! draw_border! draw_exit_instructions! draw_apple!(game.apple) draw_stats!(game.counter, game.points) draw_snake!(game.snake.state, game.direction) end |