From 41b75d415d294905d5ce5bf5b6a111205ad82767 Mon Sep 17 00:00:00 2001 From: kske Date: Tue, 22 Oct 2019 21:25:06 +0200 Subject: [PATCH] Renamed FEN string fullmove counter to fullmove number --- src/dev/kske/chess/board/Board.java | 2 +- src/dev/kske/chess/board/Log.java | 20 ++++++++++---------- test/dev/kske/chess/board/LogTest.java | 6 +++--- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/dev/kske/chess/board/Board.java b/src/dev/kske/chess/board/Board.java index 435b371..e353a35 100644 --- a/src/dev/kske/chess/board/Board.java +++ b/src/dev/kske/chess/board/Board.java @@ -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])); } /** diff --git a/src/dev/kske/chess/board/Log.java b/src/dev/kske/chess/board/Log.java index afa5f00..d5c1794 100644 --- a/src/dev/kske/chess/board/Log.java +++ b/src/dev/kske/chess/board/Log.java @@ -16,7 +16,7 @@ public class Log implements Iterable { private Position enPassant; private Color activeColor; - private int fullmoveCounter, halfmoveClock; + private int fullmoveNumber, halfmoveClock; public Log() { reset(); @@ -34,14 +34,14 @@ public class Log implements Iterable { 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 if (!other.isEmpty()) { - root = new MoveNode(other.current, copyVariations); + root = new MoveNode(other.current, copyVariations); root.setParent(null); - current = root; + current = root; } } @@ -76,11 +76,11 @@ public class Log implements Iterable { */ 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 { current = null; enPassant = null; activeColor = Color.WHITE; - fullmoveCounter = 1; + fullmoveNumber = 1; halfmoveClock = 0; } @@ -156,7 +156,7 @@ public class Log implements Iterable { 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 { 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; } diff --git a/test/dev/kske/chess/board/LogTest.java b/test/dev/kske/chess/board/LogTest.java index 4e682d4..204b6be 100644 --- a/test/dev/kske/chess/board/LogTest.java +++ b/test/dev/kske/chess/board/LogTest.java @@ -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() {