|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
The interface Player
for initializing a player's position
and getting a player's move.
Method Summary | |
Position |
getInitialPosition(int i)
The method getInitialPosition returns the initial position
of a given player. |
Position |
move()
The method move returns the new position
of a pawn that was moved. |
Method Detail |
public Position getInitialPosition(int i)
getInitialPosition
returns the initial position
of a given player.
i
- an int
value corresponding to the player's pawn's number.
Position
value corresponding to the new position
of the player.
IMPORTANT: The parameter i here denotes the player's pawn number and the method
should return a Position object.
Example of a piece of code of a class implementing this interface:
public Position getInitialPosition(int i){
return new Position(iRowPosition, iColPosition);
}public Position move()
move
returns the new position
of a pawn that was moved.
Object
value corresponding to the new position
of the pawn.
IMPORTANT: The method should return a Position object.
Example of a piece of code of a class implementing this interface:
public Position move(){
return new Position(iRowPosition, iColPosition);
}
Note: Remember a pawn can only move to an unoccupied cell and if a pawn
just cannot move, then return null
.
A pawn cannot move out of the board.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |