Skip to content

Commit

Permalink
Merge branch 'airbag'
Browse files Browse the repository at this point in the history
# Conflicts:
#	cli/profiles/SimpleWhitePlayerProfile.h
  • Loading branch information
federico-terzi committed May 9, 2019
2 parents 7d4cc16 + ad01087 commit a1c6233
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/movegenerator/HeisenbergMoveGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,13 @@ std::vector<Move> HeisenbergMoveGenerator::generate(const Board &b) const {
if (!b.is_white) { // SORT BY KING DISTANCE
//BLACK
std::sort(current_moves.begin(), current_moves.end(), [&b](const auto &item1, const auto &item2) {
return abs(b.king_pos.col - item1.to.col + b.king_pos.row - item1.to.row) < abs(b.king_pos.col - item2.to.col + b.king_pos.row - item2.to.row);
return abs(b.king_pos.col - item1.to.col) + abs(b.king_pos.row - item1.to.row) <
abs(b.king_pos.col - item2.to.col) + abs(b.king_pos.row - item2.to.row);
});
} else { // WHITE
std::sort(current_moves.begin(), current_moves.end(), [&b](const auto &item1, const auto &item2)-> bool {
return abs(b.king_pos.col - item1.from.col + b.king_pos.row - item1.from.row) < abs(b.king_pos.col - item2.from.col + b.king_pos.row - item2.from.row);
return abs(b.king_pos.col - item1.from.col) + abs(b.king_pos.row - item1.from.row) <
abs(b.king_pos.col - item2.from.col) + abs(b.king_pos.row - item2.from.row);
});
}
return current_moves;
Expand Down

0 comments on commit a1c6233

Please sign in to comment.