public class TournamentPlayerWrapper extends java.lang.Object implements ReversiPlayerInterface
Modifier and Type | Field and Description |
---|---|
static int |
MAX_WAIT_IN_MS |
private ReversiPlayerInterface |
player |
static int |
SLEEP_IN_MS |
Constructor and Description |
---|
TournamentPlayerWrapper(java.lang.String remotePlanerNaming) |
Modifier and Type | Method and Description |
---|---|
void |
endGame()
Signalizes end of the game.
|
int |
getEmptySquareColor()
Gets the color of the empty square.
|
int |
getMyColor()
Gets the color of the player.
|
java.lang.String |
getName()
Returns name of the reversi player.
|
int |
getOpponentColor()
Gets the color of the opponent player.
|
void |
init(int boardWidth,
int boardHeight,
int myColor,
int opponentColor)
Initializes the player with game parameters.
|
ReversiMove |
makeNextMove(int[][] board)
makeNextTurn is called by the reversi server when the player has to compute the next move.
|
private ReversiPlayerInterface player
public static final int MAX_WAIT_IN_MS
public static final int SLEEP_IN_MS
public TournamentPlayerWrapper(java.lang.String remotePlanerNaming) throws java.net.MalformedURLException, java.rmi.NotBoundException, java.rmi.RemoteException, java.lang.InterruptedException
java.net.MalformedURLException
java.rmi.NotBoundException
java.rmi.RemoteException
java.lang.InterruptedException
public void init(int boardWidth, int boardHeight, int myColor, int opponentColor) throws java.rmi.RemoteException
ReversiPlayerInterface
init
in interface ReversiPlayerInterface
boardWidth
- WIDTH of the boardboardHeight
- HEIGHT of the boardmyColor
- color of the playeropponentColor
- color of the opponentjava.rmi.RemoteException
public int getMyColor() throws java.rmi.RemoteException
ReversiPlayerInterface
getMyColor
in interface ReversiPlayerInterface
java.rmi.RemoteException
public int getOpponentColor() throws java.rmi.RemoteException
ReversiPlayerInterface
getOpponentColor
in interface ReversiPlayerInterface
java.rmi.RemoteException
public int getEmptySquareColor() throws java.rmi.RemoteException
ReversiPlayerInterface
getEmptySquareColor
in interface ReversiPlayerInterface
java.rmi.RemoteException
public java.lang.String getName() throws java.rmi.RemoteException
ReversiPlayerInterface
getName
in interface ReversiPlayerInterface
java.rmi.RemoteException
public ReversiMove makeNextMove(int[][] board) throws java.rmi.RemoteException
ReversiPlayerInterface
ReversiMove
class encapsulating the coordinates of the stone to be put on the board.makeNextMove
in interface ReversiPlayerInterface
board
- - contains actual map of the board represented by two-dimensional matrix.
Each sqaure contains number of -1 representing empty square and number 0 and 1 representing players' stones.java.rmi.RemoteException
public void endGame() throws java.rmi.RemoteException
ReversiPlayerInterface
endGame
in interface ReversiPlayerInterface
java.rmi.RemoteException