com.editev.chess
Class Counts
java.lang.Object
|
+--com.editev.chess.Counts
- public class Counts
- extends java.lang.Object
This class associates a count with each square on a chess board.
If we are choosing a piece to move, the count represents how many
legal moves a Piece on that square would have. If we have chosen
a piece to move and are displaying the target squares, then
we are assigning indices to the possible target moves.
!- See Also:
the source here.
|
Field Summary |
short[][] |
counts
Contains one byte of count for each piece on a chess board. |
| Methods inherited from class java.lang.Object |
,
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
registerNatives,
wait,
wait,
wait |
counts
public final short[][] counts
- Contains one byte of count for each piece on a chess board.
Counts
public Counts()
getCount
public short getCount(Square sq)
- Returns:
- the count for a specific Square.
clearCount
public void clearCount(Square sq)
- Clears the count for a specific Square.
incCount
public void incCount(Square sq)
- Increments the count for a specific Square.
markStart
public void markStart(Square sq)
- Sets the count for a specific Square to indicate that it's the start piece for a move.
setMove
public void setMove(Square sq,
short move)
- Sets the count for a square to be a specific move number.
clearCounts
public void clearCounts()
- Clears all 64 counts.
computePieceMoves
public void computePieceMoves(GameMoves game)
- Computes the starting move index for each Piece that has legal moves.
computePieceTargets
public void computePieceTargets(GameMoves game,
short startMove)
- Count NO_PIECE on the square of the piece that's moving, and the move index on all valid target squares.
Used when we are displaying a board with possible targets for a Piece move.
toString
public java.lang.String toString()
- Overrides:
- toString in class java.lang.Object
- Returns:
- A String description of the Counts.