public class HumanPlayer extends java.rmi.server.UnicastRemoteObject implements Player
Title: Player
Description: Testing representation of a checkers player
Copyright: Matthew Evett (c) 2014
Company: Eastern Michigan University
Modifier and Type | Field and Description |
---|---|
static int |
BLACK_KING |
static int |
BLACK_PAWN |
static int |
NO_PIECE |
static int |
WHITE_KING |
static int |
WHITE_PAWN |
Constructor and Description |
---|
HumanPlayer(java.lang.String name) |
Modifier and Type | Method and Description |
---|---|
int[] |
getMove(int[] board,
boolean isWhite,
int movesRemaining)
This method returns a move for the given board, board.
|
java.lang.String |
getName()
Here's your chance to be imaginative.
|
static void |
main(java.lang.String[] args)
Debugging: creates two players named Black and White and registers them with RMI.
|
clone, exportObject, exportObject, exportObject, unexportObject
public static final int NO_PIECE
public static final int WHITE_PAWN
public static final int WHITE_KING
public static final int BLACK_PAWN
public static final int BLACK_KING
public HumanPlayer(java.lang.String name) throws java.rmi.RemoteException
java.rmi.RemoteException
public int[] getMove(int[] board, boolean isWhite, int movesRemaining) throws java.rmi.RemoteException
getMove
in interface Player
board
- --- The board is encoded as a 33 integer array.
board[0] is unused. For i from 1 to 32, board[i] indicates what piece, if any
is position i on the board, using the official checkers numbering
scheme. board[i] = -2 for a black king, -1 for a black pawn, 1 for a white pawn,
2 for a white king, and is 0 if the position is unoccupiedisWhite
- is true if the player should make a move for White.movesRemaining
- is the number of moves remaining before a draw is calledjava.rmi.RemoteException
public static void main(java.lang.String[] args)
args
- Two command-line arguments: the first should be either '1' or '2', indicating
whether the created Player should be rmi-registered as 'first' or 'second'. The second argument
should be the name of the Player.
Example usage:
java -Djava.security.policy=permit.txt referee.HumanPlayer 1 "Fraser"