Class: Mineswiper::Player

Inherits:
Object
  • Object
show all
Defined in:
lib/mineswiper/player.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(board) ⇒ Player

Returns a new instance of Player.



7
8
9
# File 'lib/mineswiper/player.rb', line 7

def initialize(board)
  @display = Display.new(board)
end

Instance Attribute Details

#displayObject (readonly)

Returns the value of attribute display.



5
6
7
# File 'lib/mineswiper/player.rb', line 5

def display
  @display
end

Instance Method Details

#moveObject



11
12
13
14
15
16
17
18
# File 'lib/mineswiper/player.rb', line 11

def move
  result = nil
  until result
    @display.render
    result = @display.get_input
  end
  result
end