fixed GetPieceType function

This commit is contained in:
rektdie committed 2025-03-03 20:12:06 +01:00
1 parent 5952d8ade4
commit 8e26cc1013
3 files changed
+7 -1

No files matched your search

+1 -1
View File
@@ -266,7 +266,7 @@ int Board::GetPieceType(int square) {
if (pieces[piece].IsSet(square)) return piece;
}
return -1;
return nullPieceType;
}
int Board::GetPieceColor(int square) {
+2
View File
@@ -4,6 +4,8 @@
#include "types.h"
#include "move.h"
constexpr int nullPieceType = 100;
class Board {
public:
Board() {
+4
View File
@@ -20,11 +20,15 @@ static int ScoreMove(Board &board, Move &move) {
const int attackerType = board.GetPieceType(move.MoveFrom());
const int targetType = board.GetPieceType(move.MoveTo());
if (attackerType == nullPieceType || targetType == nullPieceType) return 0;
TTEntry *current = &TTable[board.hashKey % hashSize];
if (current->bestMove == move) {
return 50000;
}
if (attackerType == -1 || targetType == -1) std::cout << "asd\n";
if (move.IsCapture()) {
return moveScoreTable[attackerType][targetType] + 10000;
} else {