cz.cvut.agents.rph.reversi.players
Class DummyPlayer

java.lang.Object
  extended by cz.cvut.agents.rph.reversi.ReversiPlayer
      extended by cz.cvut.agents.rph.reversi.players.DummyPlayer
All Implemented Interfaces:
ReversiPlayerInterface, java.rmi.Remote

public class DummyPlayer
extends ReversiPlayer

Dummy player is an example of implementation of the player. It plays random and after each move it checks if the move is valid ("real" player should always check validity of the turn by itself).


Field Summary
private  int RANDOM_MOVES_NUMBER
          Constant defining maximum number of tried moves.
 
Fields inherited from class cz.cvut.agents.rph.reversi.ReversiPlayer
height, myColor, opponentColor, width
 
Constructor Summary
DummyPlayer()
           
 
Method Summary
 java.lang.String getName()
          Returns name of the reversi player.
 boolean isCorrectMove(int[][] board, ReversiPlayer player, ReversiMove move)
           
private  boolean isCorrectMoveInDirection(int[][] board, int player, int dirX, int dirY, int x, int y)
           
 ReversiMove makeNextMove(int[][] board)
          This method is called by the reversi server when the player has to compute the next move.
 
Methods inherited from class cz.cvut.agents.rph.reversi.ReversiPlayer
endGame, getEmptySquareColor, getMyColor, getOpponentColor, init, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

RANDOM_MOVES_NUMBER

private final int RANDOM_MOVES_NUMBER
Constant defining maximum number of tried moves. If it is exceeded, player systematically tries all moves.

See Also:
Constant Field Values
Constructor Detail

DummyPlayer

public DummyPlayer()
Method Detail

getName

public java.lang.String getName()
Description copied from class: ReversiPlayer
Returns name of the reversi player. Return your username!

Specified by:
getName in interface ReversiPlayerInterface
Specified by:
getName in class ReversiPlayer
Returns:
name of the reversi player

makeNextMove

public ReversiMove makeNextMove(int[][] board)
Description copied from class: ReversiPlayer
This method is called by the reversi server when the player has to compute the next move. The method returns a ReversiMove class encapsulating the coordinates of the stone to be put on the board.

Specified by:
makeNextMove in interface ReversiPlayerInterface
Specified by:
makeNextMove in class ReversiPlayer
Parameters:
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.
Returns:
specific reversiMove

isCorrectMove

public boolean isCorrectMove(int[][] board,
                             ReversiPlayer player,
                             ReversiMove move)

isCorrectMoveInDirection

private boolean isCorrectMoveInDirection(int[][] board,
                                         int player,
                                         int dirX,
                                         int dirY,
                                         int x,
                                         int y)