From 98e756bd04989629052ca817f639995f7c7ddd65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eduardo=20C=C3=A1ceres?= Date: Thu, 21 Dec 2023 01:40:00 +0100 Subject: [PATCH] Fix tests --- src/Lynx/MoveGenerator.cs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/Lynx/MoveGenerator.cs b/src/Lynx/MoveGenerator.cs index 034d68324..b5956edf0 100644 --- a/src/Lynx/MoveGenerator.cs +++ b/src/Lynx/MoveGenerator.cs @@ -1,5 +1,4 @@ -using Lynx.Internal; -using Lynx.Model; +using Lynx.Model; using NLog; using System.Diagnostics; using System.Runtime.CompilerServices; @@ -184,7 +183,7 @@ internal static void GenerateCastlingMoves(ref int localIndex, Move[] movePool, { movePool[localIndex++] = WhiteShortCastle; - Debug.Assert(movePool[localIndex] == MoveExtensions.Encode(Constants.WhiteKingSourceSquare, Constants.WhiteShortCastleKingSquare, (int)Piece.K + Utils.PieceOffset(position.Side), isShortCastle: TRUE), + Debug.Assert(movePool[localIndex - 1] == MoveExtensions.Encode(Constants.WhiteKingSourceSquare, Constants.WhiteShortCastleKingSquare, (int)Piece.K + Utils.PieceOffset(position.Side), isShortCastle: TRUE), "Wrong hardcoded white short castle move"); } @@ -198,7 +197,7 @@ internal static void GenerateCastlingMoves(ref int localIndex, Move[] movePool, { movePool[localIndex++] = WhiteLongCastle; - Debug.Assert(movePool[localIndex] == MoveExtensions.Encode(Constants.WhiteKingSourceSquare, Constants.WhiteLongCastleKingSquare, (int)Piece.K + Utils.PieceOffset(position.Side), isLongCastle: TRUE), + Debug.Assert(movePool[localIndex - 1] == MoveExtensions.Encode(Constants.WhiteKingSourceSquare, Constants.WhiteLongCastleKingSquare, (int)Piece.K + Utils.PieceOffset(position.Side), isLongCastle: TRUE), "Wrong hardcoded white long castle move"); } } @@ -215,7 +214,7 @@ internal static void GenerateCastlingMoves(ref int localIndex, Move[] movePool, { movePool[localIndex++] = BlackShortCastle; - Debug.Assert(movePool[localIndex] == MoveExtensions.Encode(Constants.BlackKingSourceSquare, Constants.BlackShortCastleKingSquare, (int)Piece.K + Utils.PieceOffset(position.Side), isShortCastle: TRUE), + Debug.Assert(movePool[localIndex - 1] == MoveExtensions.Encode(Constants.BlackKingSourceSquare, Constants.BlackShortCastleKingSquare, (int)Piece.K + Utils.PieceOffset(position.Side), isShortCastle: TRUE), "Wrong hardcoded black short castle move"); } @@ -229,7 +228,7 @@ internal static void GenerateCastlingMoves(ref int localIndex, Move[] movePool, { movePool[localIndex++] = BlackLongCastle; - Debug.Assert(movePool[localIndex] == MoveExtensions.Encode(Constants.BlackKingSourceSquare, Constants.BlackLongCastleKingSquare, (int)Piece.K + Utils.PieceOffset(position.Side), isLongCastle: TRUE), + Debug.Assert(movePool[localIndex - 1] == MoveExtensions.Encode(Constants.BlackKingSourceSquare, Constants.BlackLongCastleKingSquare, (int)Piece.K + Utils.PieceOffset(position.Side), isLongCastle: TRUE), "Wrong hardcoded black long castle move"); } }