Class: Gomoku::Player
- Inherits:
-
Object
- Object
- Gomoku::Player
- Defined in:
- lib/gomoku/player.rb
Overview
Defines common functionality for all players
Instance Method Summary collapse
- #click(_click_r, _click_c) ⇒ Object
- #draw ⇒ Object
-
#initialize(window, board, color) ⇒ Player
constructor
A new instance of Player.
- #pick_move ⇒ Object
- #update ⇒ Object
Constructor Details
#initialize(window, board, color) ⇒ Player
Returns a new instance of Player.
4 5 6 7 8 |
# File 'lib/gomoku/player.rb', line 4 def initialize(window, board, color) @window = window @board = board @color = color end |
Instance Method Details
#click(_click_r, _click_c) ⇒ Object
10 11 |
# File 'lib/gomoku/player.rb', line 10 def click(_click_r, _click_c) end |
#draw ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/gomoku/player.rb', line 19 def draw return unless @hover_r && @hover_c return unless Utility.in_range?(@hover_r, @hover_c) && @board.empty?(@hover_r, @hover_c) # Draw the hover for next piece @board.draw_hover(@color, @hover_r, @hover_c) end |
#pick_move ⇒ Object
16 17 |
# File 'lib/gomoku/player.rb', line 16 def pick_move end |
#update ⇒ Object
13 14 |
# File 'lib/gomoku/player.rb', line 13 def update end |