|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.rmi.server.RemoteObject java.rmi.server.RemoteServer java.rmi.server.UnicastRemoteObject referee.HumanPlayer
public class HumanPlayer
Title: Player
Description: Testing representation of a checkers player
Copyright: Copyright (c) 2004
Company:
Field Summary | |
---|---|
static int |
BLACK_KING
|
static int |
BLACK_PAWN
|
static int |
NO_PIECE
|
static int |
WHITE_KING
|
static int |
WHITE_PAWN
|
Constructor Summary | |
---|---|
HumanPlayer(java.lang.String name)
|
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 |
---|
getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
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
Constructor Detail |
---|
public HumanPlayer(java.lang.String name) throws java.rmi.RemoteException
java.rmi.RemoteException
Method Detail |
---|
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 called
java.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"
public java.lang.String getName() throws java.rmi.RemoteException
getName
in interface Player
java.rmi.RemoteException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |