|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcz.cvut.agents.rph.reversi.ReversiPlayer
public abstract class ReversiPlayer
General template for a reversi player. Extend this class and place your player
in the cz.cvut.agents.rph.reversi.players
package.
Author: Ondrej Vanek
Date: 10/3/12
Time: 10:09 AM
Field Summary | |
---|---|
protected int |
height
Height of the board. |
protected int |
myColor
Color of my stones. |
protected int |
opponentColor
Color of opponent's stones. |
protected int |
width
Width of the board. |
Constructor Summary | |
---|---|
ReversiPlayer()
|
Method Summary | |
---|---|
void |
endGame()
This method is used only in the tournament. |
int |
getEmptySquareColor()
Gets the color of the empty square. |
int |
getMyColor()
Gets the color of the player. |
abstract 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. |
abstract ReversiMove |
makeNextMove(int[][] board)
This method is called by the reversi server when the player has to compute the next move. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected int width
protected int height
protected int myColor
protected int opponentColor
Constructor Detail |
---|
public ReversiPlayer()
Method Detail |
---|
public void init(int boardWidth, int boardHeight, int myColor, int opponentColor)
init
in interface ReversiPlayerInterface
boardWidth
- WIDTH of the boardboardHeight
- HEIGHT of the boardmyColor
- color of the playeropponentColor
- color of the opponentpublic final int getMyColor()
getMyColor
in interface ReversiPlayerInterface
public final int getOpponentColor()
getOpponentColor
in interface ReversiPlayerInterface
public final int getEmptySquareColor()
getEmptySquareColor
in interface ReversiPlayerInterface
public abstract java.lang.String getName()
getName
in interface ReversiPlayerInterface
public abstract ReversiMove makeNextMove(int[][] board)
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.
public java.lang.String toString()
toString
in class java.lang.Object
public final void endGame()
endGame
in interface ReversiPlayerInterface
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |