edu.rice.comp440.player
Interface Player
- All Known Implementing Classes:
- RandomPlayer, SwingDriver.SwingHumanPlayer, TextDriver.TextHumanPlayer
- public interface Player
Class which represents a backgammon player. The Backgammon
object will repeatedly call move() on this player, asking
the player to pick a move. Once the game is over, the
backgammon object will either call won() or lost() with the
result of the game.
Method Summary |
void |
lost()
Upcall to indicate that this player has lost the current game |
Move |
move(Backgammon backgammon)
Requests that the player make a move using the given
backgammon setup. |
void |
won()
Upcall to indicate that this player has won the current game |
move
public Move move(Backgammon backgammon)
- Requests that the player make a move using the given
backgammon setup. The player should return a valid
and complete move. The list of valid moves can be
found by calling backgammon.getAllMoves().
- Parameters:
backgammon
- The current backgammon situation
won
public void won()
- Upcall to indicate that this player has won the current game
lost
public void lost()
- Upcall to indicate that this player has lost the current game