Class: Gomoku::Human
Overview
Instance Method Summary
collapse
Methods inherited from Player
#draw, #initialize
Constructor Details
This class inherits a constructor from Gomoku::Player
Instance Method Details
#click(click_r, click_c) ⇒ Object
8
9
10
11
|
# File 'lib/gomoku/human.rb', line 8
def click(click_r, click_c)
@click_r = click_r
@click_c = click_c
end
|
#human? ⇒ Boolean
4
5
6
|
# File 'lib/gomoku/human.rb', line 4
def human?
true
end
|
#pick_move ⇒ Object
19
20
21
22
23
24
25
26
|
# File 'lib/gomoku/human.rb', line 19
def pick_move
return unless @click_r && @click_c
return unless @board.empty?(@click_r, @click_c)
move_r = @click_r
move_c = @click_c
@click_r, @click_c = nil
[move_r, move_c]
end
|
#update ⇒ Object
13
14
15
16
17
|
# File 'lib/gomoku/human.rb', line 13
def update
@hover_r = Utility.y_to_r(@window.mouse_y)
@hover_c = Utility.x_to_c(@window.mouse_x)
end
|