diff options
| author | Adam <adammegarules1@gmail.com> | 2026-08-12 09:06:44 +0200 |
|---|---|---|
| committer | Adam <adammegarules1@gmail.com> | 2026-08-12 09:06:44 +0200 |
| commit | 8cdb6b99332b57bbc67758095cd740836060a015 (patch) | |
| tree | 6d069fee70a56081b29b737863330d2ad067939d | |
| parent | 54d024aae8ca232e8da4cf4620ca9c5b3b599f23 (diff) | |
fixing
| -rw-r--r-- | src/bot.cpp | 12 | ||||
| -rw-r--r-- | src/moves.cpp | 9 |
2 files changed, 10 insertions, 11 deletions
diff --git a/src/bot.cpp b/src/bot.cpp index 14f7cef..5db3939 100644 --- a/src/bot.cpp +++ b/src/bot.cpp @@ -68,6 +68,10 @@ static int ScoreMove(const Game *board, const Move &move, score += 8000; } + if (move.To.rank == (board->turn ? 6 : 1) && moving.type == PAWN) { + score += 8000; + } + return score; } @@ -80,14 +84,9 @@ static std::vector<Move> GetSortedLegalMoves(Game *g, bool generateQuietMoves, return moves; } -// Quiescence search: only captures, so the eval isn't blind to hanging pieces. -// `standPat` lets the side to move decline every capture. Terminal positions -// are scored with the same `MATE - ply` convention as the main search so that -// mate distances stay consistent (a mate found inside quiescence must not look -// faster than a real mate-in-1). White perspective throughout. static int quiescenceSearch(Game *b, int qdepth, int alpha, int beta, int ply) { Nodes++; - // Runs GetNewGameState internally, so b->state is up to date afterwards. + const int standPat = EvaluateBoard(b); switch (b->state) { @@ -208,7 +207,6 @@ static int search(int depth, Game *b, int alpha, int beta, int ply) { } } if (!searchStopped) { - Flag flag = EXACT; if (bestScore >= beta) { flag = LOWERBOUND; diff --git a/src/moves.cpp b/src/moves.cpp index b7b1688..812e734 100644 --- a/src/moves.cpp +++ b/src/moves.cpp @@ -114,7 +114,7 @@ void GeneratePawnMoves(Game *b, int from, std::vector<Move> &moves, int twoSteps = from + (step * 2); if (position.rank == startingRank && b->pieces[twoSteps].type == NONEPIECE) { - moves.push_back({position, IndexToPosition(twoSteps)}); + moves.push_back({.From = position, .To = IndexToPosition(twoSteps)}); } }; @@ -155,7 +155,6 @@ void GeneratePawnMoves(Game *b, int from, std::vector<Move> &moves, }); } else { moves.push_back({.From = position, .To = IndexToPosition(target)}); - moves.push_back({.From = position, .To = IndexToPosition(target)}); } } } @@ -188,7 +187,8 @@ void GenerateKingMoves(Game *g, int from, std::vector<Move> &moves, continue; } - moves.push_back({IndexToPosition(from), IndexToPosition(next)}); + moves.push_back( + {.From = IndexToPosition(from), .To = IndexToPosition(next)}); } }; @@ -251,8 +251,9 @@ bool IsSquareAttacked(Game *g, Position square, bool byColor) { continue; Piece p = g->pieces[pawnRank * 8 + file]; - if (p.type == PAWN && p.color == byColor) + if (p.type == PAWN && p.color == byColor) { return true; + } } } |
