Test which computes these four perfts take about 8 seconds. So maybe I get hardly 1M nodes per second.RoadWarrior wrote: ↑Thu Apr 22, 2021 7:32 pmPerft in my C# chess engine runs at about 80M nodes per second on a single core of a mid-range Intel i7-7700 CPU running at 3.6 GHz. So shurely shome mishtake?
But for each perft it first builds the hashtables per square needed for magic bitboard movegeneration. While they should be only computed once.
Code: Select all
TestPerft(6, "8/5bk1/8/2Pp4/8/1K6/8/8 w - d6 0 1", 824064);
TestPerft(6, "8/5k2/8/2Pp4/2B5/1K6/8/8 w - d6 0 1 ", 1440467);
TestPerft(3, "r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/2KR3R b kq - 1 1", 79803);
TestPerft(5, "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1", 4865609);
Code: Select all
private ulong[] MoveAux(IMoveBase move)
{
var pieceSort = move.PieceSort; // pieceType
var kind = GetKind(pieceSort);
var endBitCoord = move.End.BitBoard;
var moveBB = move.BitBoardValue;
ulong[] copyPieces = new ulong[NBITBOARDS];
if (Occupied(endBitCoord))
{
var endKind = PieceKind(endBitCoord);
var color = OccupierColor(endBitCoord);
Pieces.CopyTo(copyPieces, 0);
if (endKind == kind)
{
copyPieces[(int)kind] ^= move.Start.BitBoard;
}
else
{
copyPieces[(int)endKind] ^= endBitCoord;
copyPieces[(int)kind] ^= moveBB;
}
if (color == White)
{
copyPieces[WHITE_PIECES] ^= endBitCoord;
copyPieces[BLACK_PIECES] ^= moveBB;
}
else
{
copyPieces[BLACK_PIECES] ^= endBitCoord;
copyPieces[WHITE_PIECES] ^= moveBB;
}
}
else
{
Pieces.CopyTo(copyPieces, 0);
copyPieces[(int)kind] ^= moveBB;
if (GetColSign(pieceSort) == White)
{
copyPieces[WHITE_PIECES] ^= moveBB;
}
else
{
copyPieces[BLACK_PIECES] ^= moveBB;
}
}
return copyPieces;
}