Skip to content
Permalink
Browse files

Use same scoring. Bench: 3393182

  • Loading branch information...
vondele committed Mar 14, 2019
1 parent bad18bc commit ab470867e88b0c080d515cea2c823900fa17463d
Showing with 15 additions and 19 deletions.
  1. +15 −19 src/movepick.cpp
@@ -105,28 +105,24 @@ void MovePicker::score() {

static_assert(Type == CAPTURES || Type == QUIETS || Type == EVASIONS, "Wrong type");

auto captScore = [&](ExtMove m){return PieceValue[MG][pos.piece_on(to_sq(m))]
+ (*captureHistory)[pos.moved_piece(m)][to_sq(m)][type_of(pos.piece_on(to_sq(m)))] / 8;};

auto quietScore = [&](ExtMove m){return (*mainHistory)[pos.side_to_move()][from_to(m)]
+ (*continuationHistory[0])[pos.moved_piece(m)][to_sq(m)]
+ (*continuationHistory[1])[pos.moved_piece(m)][to_sq(m)]
+ (*continuationHistory[3])[pos.moved_piece(m)][to_sq(m)]
+ (*continuationHistory[5])[pos.moved_piece(m)][to_sq(m)] / 2;};

for (auto& m : *this)
if (Type == CAPTURES)
m.value = PieceValue[MG][pos.piece_on(to_sq(m))]
+ (*captureHistory)[pos.moved_piece(m)][to_sq(m)][type_of(pos.piece_on(to_sq(m)))] / 8;

m.value = captScore(m);
else if (Type == QUIETS)
m.value = (*mainHistory)[pos.side_to_move()][from_to(m)]
+ (*continuationHistory[0])[pos.moved_piece(m)][to_sq(m)]
+ (*continuationHistory[1])[pos.moved_piece(m)][to_sq(m)]
+ (*continuationHistory[3])[pos.moved_piece(m)][to_sq(m)]
+ (*continuationHistory[5])[pos.moved_piece(m)][to_sq(m)] / 2;

else // Type == EVASIONS
{
if (pos.capture(m))
m.value = PieceValue[MG][pos.piece_on(to_sq(m))]
- Value(type_of(pos.moved_piece(m)));
else
m.value = (*mainHistory)[pos.side_to_move()][from_to(m)]
+ (*continuationHistory[0])[pos.moved_piece(m)][to_sq(m)]
- (1 << 28);
}
m.value = quietScore(m);
else if (pos.capture(m)) // Type == EVASIONS
m.value = captScore(m);
else
m.value = quietScore(m) - (1 << 28);
}

/// MovePicker::select() returns the next move satisfying a predicate function.

1 comment on commit ab47086

@joergoster

This comment has been minimized.

Copy link

joergoster commented on ab47086 Mar 16, 2019

Congrats!

Please sign in to comment.
You can’t perform that action at this time.