Class: Reversi::Player::RandomAI

Inherits:
BasePlayer show all
Defined in:
lib/reversi/player/random_ai.rb

Instance Attribute Summary

Attributes inherited from BasePlayer

#board, #my_color, #opponent_color

Instance Method Summary collapse

Methods inherited from BasePlayer

#count_disks, #initialize, #next_moves, #put_disk, #status

Constructor Details

This class inherits a constructor from Reversi::Player::BasePlayer

Instance Method Details

#move(board) ⇒ Object



4
5
6
7
# File 'lib/reversi/player/random_ai.rb', line 4

def move(board)
  moves = next_moves
  put_disk(*moves.sample) unless moves.empty?
end