@@ -11,6 +11,8 @@ class MinChessWorkspace {
1111 boolean castlingBlackQueenAllowed ;
1212 boolean castlingWhiteKingAllowed ;
1313 boolean castlingWhiteQueenAllowed ;
14+ int halfMoveClock ;
15+ int fullMoveClock ;
1416
1517 long enPassantSquare = 0 ;
1618 long whitePositions = 0 ;
@@ -29,6 +31,8 @@ class MinChessWorkspace {
2931 boolean castlingWhiteKingAllowed ,
3032 boolean castlingWhiteQueenAllowed ,
3133 long enPassantSquare ,
34+ int halfMoveClock ,
35+ int fullMoveClock ,
3236 long whitePositions ,
3337 long blackPositions ,
3438 long kingPositions ,
@@ -44,6 +48,9 @@ class MinChessWorkspace {
4448 this .castlingWhiteKingAllowed = castlingWhiteKingAllowed ;
4549 this .castlingWhiteQueenAllowed = castlingWhiteQueenAllowed ;
4650 this .enPassantSquare = enPassantSquare ;
51+ this .halfMoveClock = halfMoveClock ;
52+ this .fullMoveClock = fullMoveClock ;
53+
4754 this .whitePositions = whitePositions ;
4855 this .blackPositions = blackPositions ;
4956
@@ -79,6 +86,7 @@ void copyFrom(MinChessWorkspace other) {
7986 }
8087
8188 void doMoveImp (long from , long to ) {
89+ halfMoveClock ++;
8290 // Capture, clean to square
8391 if ((to & whitePositions ) != 0 || (to & blackPositions ) != 0 ) {
8492 if ((to & queenPositions ) != 0 ) {
@@ -110,6 +118,7 @@ void doMoveImp(long from, long to) {
110118 } else {
111119 whitePositions &= ~to ;
112120 }
121+ halfMoveClock = 0 ;
113122 }
114123
115124 if ((from & kingPositions ) != 0 ) {
@@ -151,6 +160,7 @@ void doMoveImp(long from, long to) {
151160 if ((from & pawnPositions ) != 0 ) {
152161 pawnPositions &= ~from ;
153162 pawnPositions |= to ;
163+ halfMoveClock = 0 ;
154164 }
155165
156166 enPassantSquare = 0 ;
@@ -161,7 +171,9 @@ void doMoveImp(long from, long to) {
161171 } else {
162172 blackPositions &= ~from ;
163173 blackPositions |= to ;
174+ fullMoveClock ++;
164175 }
176+
165177 whiteTurn = !whiteTurn ;
166178 }
167179
0 commit comments