referee
Class HumanPlayer
java.lang.Object
|
+--java.rmi.server.RemoteObject
|
+--java.rmi.server.RemoteServer
|
+--java.rmi.server.UnicastRemoteObject
|
+--referee.HumanPlayer
- All Implemented Interfaces:
- Player, java.rmi.Remote, java.io.Serializable
- public class HumanPlayer
- extends java.rmi.server.UnicastRemoteObject
- implements Player
Title: Player
Description: Testing representation of a checkers player
Copyright: Copyright (c) 2004
Company:
- See Also:
- Serialized Form
Fields inherited from class java.rmi.server.RemoteObject |
ref |
Method Summary |
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. |
Methods inherited from class java.rmi.server.UnicastRemoteObject |
clone, exportObject, exportObject, exportObject, unexportObject |
Methods inherited from class java.rmi.server.RemoteServer |
getClientHost, getLog, setLog |
Methods inherited from class java.rmi.server.RemoteObject |
equals, getRef, hashCode, toString, toStub |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
NO_PIECE
public static final int NO_PIECE
- See Also:
- Constant Field Values
WHITE_PAWN
public static final int WHITE_PAWN
- See Also:
- Constant Field Values
WHITE_KING
public static final int WHITE_KING
- See Also:
- Constant Field Values
BLACK_PAWN
public static final int BLACK_PAWN
- See Also:
- Constant Field Values
BLACK_KING
public static final int BLACK_KING
- See Also:
- Constant Field Values
HumanPlayer
public HumanPlayer(java.lang.String name)
throws java.rmi.RemoteException
getMove
public int[] getMove(int[] board,
boolean isWhite,
int movesRemaining)
throws java.rmi.RemoteException
- This method returns a move for the given board, board.
- Specified by:
getMove
in interface Player
- Parameters:
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 called
- Returns:
- First element of the array is the position of the piece to be moved.
The remaining elements are subsequent positions to which that piece moves.
(There will usually be only one remaining element, unless result encodes a
multiple capture/jumping move.) Thus a move from position 17 to 10, jumping over
an opposition piece at position 14 would be encoded via the array: {17, 10}.
It is important that the length of the array be exactly 1+ the number of moves
made by the piece.
java.rmi.RemoteException
main
public static void main(java.lang.String[] args)
- Debugging: creates two players named Black and White and registers them with RMI.
getName
public java.lang.String getName()
throws java.rmi.RemoteException
- Here's your chance to be imaginative.
- Specified by:
getName
in interface Player
- Returns:
- the name of the agent (hopefully something memorable!)
java.rmi.RemoteException