Class: Game
- Inherits:
-
Object
- Object
- Game
- Defined in:
- lib/minesweeper.rb
Instance Attribute Summary collapse
-
#board ⇒ Object
readonly
Returns the value of attribute board.
-
#player ⇒ Object
readonly
Returns the value of attribute player.
Instance Method Summary collapse
-
#initialize ⇒ Game
constructor
A new instance of Game.
- #play ⇒ Object
Constructor Details
#initialize ⇒ Game
Returns a new instance of Game.
248 249 250 251 |
# File 'lib/minesweeper.rb', line 248 def initialize @board = Board.new @player = Player.new(@board) end |
Instance Attribute Details
#board ⇒ Object (readonly)
Returns the value of attribute board.
246 247 248 |
# File 'lib/minesweeper.rb', line 246 def board @board end |
#player ⇒ Object (readonly)
Returns the value of attribute player.
246 247 248 |
# File 'lib/minesweeper.rb', line 246 def player @player end |
Instance Method Details
#play ⇒ Object
253 254 255 256 257 258 259 260 261 262 |
# File 'lib/minesweeper.rb', line 253 def play loop do board.render player.take_turn break if game_over? end endgame end |