Class: NeuroGammon::RandomPlayer
- Inherits:
-
BasePlayer
- Object
- BasePlayer
- NeuroGammon::RandomPlayer
- Defined in:
- lib/neuro_gammon/random_player.rb
Instance Attribute Summary
Attributes inherited from BasePlayer
Instance Method Summary collapse
-
#initialize ⇒ RandomPlayer
constructor
A new instance of RandomPlayer.
- #suggest_move(board, dice, colour) ⇒ Object
Constructor Details
#initialize ⇒ RandomPlayer
Returns a new instance of RandomPlayer.
23 24 25 26 |
# File 'lib/neuro_gammon/random_player.rb', line 23 def initialize super end |
Instance Method Details
#suggest_move(board, dice, colour) ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/neuro_gammon/random_player.rb', line 28 def suggest_move board,dice,colour valid=board.valid_moves(colour, dice) if (valid.size>0) move=valid[rand(valid.size)] return move else return nil end end |