Renamed FEN string fullmove counter to fullmove number

This commit is contained in:
Kai S. K. Engelbart 2019-10-22 21:25:06 +02:00
parent 2f1ae6e9c8
commit db8fe1c4c0
3 changed files with 14 additions and 14 deletions

View File

@ -561,7 +561,7 @@ public class Board {
log.setHalfmoveClock(Integer.parseInt(parts[4]));
// Fullmove counter
log.setFullmoveCounter(Integer.parseInt(parts[5]));
log.setFullmoveNumber(Integer.parseInt(parts[5]));
}
/**

View File

@ -16,7 +16,7 @@ public class Log implements Iterable<MoveNode> {
private Position enPassant;
private Color activeColor;
private int fullmoveCounter, halfmoveClock;
private int fullmoveNumber, halfmoveClock;
public Log() {
reset();
@ -34,7 +34,7 @@ public class Log implements Iterable<MoveNode> {
public Log(Log other, boolean copyVariations) {
enPassant = other.enPassant;
activeColor = other.activeColor;
fullmoveCounter = other.fullmoveCounter;
fullmoveNumber = other.fullmoveNumber;
halfmoveClock = other.halfmoveClock;
// The new root is the current node of the copied instance
@ -76,11 +76,11 @@ public class Log implements Iterable<MoveNode> {
*/
public void add(Move move, Piece capturedPiece, boolean pawnMove) {
enPassant = pawnMove && move.yDist == 2 ? new Position(move.pos.x, move.pos.y + move.ySign) : null;
if (activeColor == Color.BLACK) ++fullmoveCounter;
if (activeColor == Color.BLACK) ++fullmoveNumber;
if (pawnMove || capturedPiece != null) halfmoveClock = 0;
else++halfmoveClock;
activeColor = activeColor.opposite();
final MoveNode leaf = new MoveNode(move, capturedPiece, enPassant, activeColor, fullmoveCounter, halfmoveClock);
final MoveNode leaf = new MoveNode(move, capturedPiece, enPassant, activeColor, fullmoveNumber, halfmoveClock);
if (isEmpty()) {
root = leaf;
@ -118,7 +118,7 @@ public class Log implements Iterable<MoveNode> {
current = null;
enPassant = null;
activeColor = Color.WHITE;
fullmoveCounter = 1;
fullmoveNumber = 1;
halfmoveClock = 0;
}
@ -156,7 +156,7 @@ public class Log implements Iterable<MoveNode> {
private void update() {
activeColor = current.activeColor;
enPassant = current.enPassant;
fullmoveCounter = current.fullmoveCounter;
fullmoveNumber = current.fullmoveCounter;
halfmoveClock = current.halfmoveClock;
}
@ -178,9 +178,9 @@ public class Log implements Iterable<MoveNode> {
public void setActiveColor(Color activeColor) { this.activeColor = activeColor; }
public int getFullmoveCounter() { return fullmoveCounter; }
public int getFullmoveNumber() { return fullmoveNumber; }
public void setFullmoveCounter(int fullmoveCounter) { this.fullmoveCounter = fullmoveCounter; }
public void setFullmoveNumber(int fullmoveCounter) { this.fullmoveNumber = fullmoveCounter; }
public int getHalfmoveClock() { return halfmoveClock; }

View File

@ -30,7 +30,7 @@ class LogTest {
assertNull(log.getRoot());
assertEquals(log.getActiveColor(), Color.WHITE);
assertNull(log.getEnPassant());
assertEquals(log.getFullmoveCounter(), 1);
assertEquals(log.getFullmoveNumber(), 1);
assertEquals(log.getHalfmoveClock(), 0);
}
@ -132,7 +132,7 @@ class LogTest {
}
/**
* Test method for {@link dev.kske.chess.board.Log#getFullmoveCounter()}.
* Test method for {@link dev.kske.chess.board.Log#getFullmoveNumber()}.
*/
@Test
void testGetFullmoveCounter() {
@ -140,7 +140,7 @@ class LogTest {
}
/**
* Test method for {@link dev.kske.chess.board.Log#setFullmoveCounter(int)}.
* Test method for {@link dev.kske.chess.board.Log#setFullmoveNumber(int)}.
*/
@Test
void testSetFullmoveCounter() {