Class Position

java.lang.Object
  |
  +--Position

public class Position
extends java.lang.Object

A Position has several fields. piece is a char that indicates whether the player or opponent has a normal piece('p' or 'o') or a king ('P' or 'O') on the board at the position, or whether the position is empty ('e'). Integer name is the number of the square on the board where the position is located. neighbours is an ArrayList holding the names of all positions that can be moved into from the current position. jmp is an ArrayList holding the names of all positions that can be reached by jumping from the current position. Both neighbours and jmp are defined based on name.


Field Summary
 char piece
           
 
Constructor Summary
Position()
          The piece is set to empty ('e'), the name is -1 (not valid) and both neighbours and jmp are null.
Position(int i, char c)
          name is set to Integer(i) and piece is set to c.
 
Method Summary
 java.util.ArrayList GetJmps()
          Returns the ArrayList jmp
 java.util.ArrayList GetNeighbours()
          Returns the ArrayList neighours
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

piece

public char piece
Constructor Detail

Position

public Position()
The piece is set to empty ('e'), the name is -1 (not valid) and both neighbours and jmp are null.


Position

public Position(int i,
                char c)
name is set to Integer(i) and piece is set to c. neighbours and jmp are determined by the name.

Method Detail

GetNeighbours

public java.util.ArrayList GetNeighbours()
Returns the ArrayList neighours


GetJmps

public java.util.ArrayList GetJmps()
Returns the ArrayList jmp