Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

score qmove #93

Merged
merged 1 commit into from
Jun 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions src/search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ int Search::qsearch(int depth, int alpha, int beta, int ply) {

// assign a value to each move
for (int i = 0; i < ml.size; i++) {
ml.list[i].value = mmlva(ml.list[i]);
ml.list[i].value = score_qmove(ml.list[i]);
}

// sort the moves
Expand Down Expand Up @@ -297,8 +297,6 @@ int Search::absearch(int depth, int alpha, int beta, int ply, Stack *ss) {

board.makeMove(move);



U64 nodeCount = nodes;
ss->currentmove = move.get();
bool givesCheck = board.isSquareAttacked(color, board.KingSQ(~color));
Expand Down Expand Up @@ -559,6 +557,18 @@ int Search::score_move(Move& move, int ply, bool ttMove) {
}
}

int Search::score_qmove(Move& move) {
if (move.promoted()) {
return 2147483647 - 20 + move.piece();
}
else if (board.pieceAtB(move.to()) != None) {
return see(move, -100) ? mmlva(move) * 10000 : mmlva(move);
}
else {
return 0;
}
}

std::string Search::get_pv() {
std::string line = "";
for (int i = 0; i < pv_length[0]; i++) {
Expand Down
1 change: 1 addition & 0 deletions src/search.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class Search {
bool see(Move& move, int threshold);
int mmlva(Move& move);
int score_move(Move& move, int ply, bool ttMove);
int score_qmove(Move& move);
std::string get_pv();
bool store_entry(U64 index, int depth, int bestvalue, int old_alpha, int beta, U64 key, uint8_t ply);
void uci_output(int score, int depth, int time);
Expand Down