mirror of
https://github.com/sockspls/badfish
synced 2025-05-01 09:13:08 +00:00
Rename stages
Hopefully more clear. No functional change.
This commit is contained in:
parent
5ebdf2f8c8
commit
c1d3bd2dba
1 changed files with 28 additions and 25 deletions
|
@ -26,12 +26,12 @@
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
enum Stages {
|
enum Stages {
|
||||||
MAIN_SEARCH, CAPTURES_S1, KILLERS_S1, QUIETS_1_S1, QUIETS_2_S1, BAD_CAPTURES_S1,
|
MAIN_SEARCH, GOOD_CAPTURES, KILLERS, GOOD_QUIETS, BAD_QUIETS, BAD_CAPTURES,
|
||||||
EVASION, EVASIONS_S2,
|
EVASION, ALL_EVASIONS,
|
||||||
QSEARCH_0, CAPTURES_S3, QUIET_CHECKS_S3,
|
QSEARCH_WITH_CHECKS, QCAPTURES_1, CHECKS,
|
||||||
QSEARCH_1, CAPTURES_S4,
|
QSEARCH_WITHOUT_CHECKS, QCAPTURES_2,
|
||||||
PROBCUT, CAPTURES_S5,
|
PROBCUT, PROBCUT_CAPTURES,
|
||||||
RECAPTURE, CAPTURES_S6,
|
RECAPTURE, RECAPTURES,
|
||||||
STOP
|
STOP
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -95,10 +95,10 @@ MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const HistoryStats&
|
||||||
stage = EVASION;
|
stage = EVASION;
|
||||||
|
|
||||||
else if (d > DEPTH_QS_NO_CHECKS)
|
else if (d > DEPTH_QS_NO_CHECKS)
|
||||||
stage = QSEARCH_0;
|
stage = QSEARCH_WITH_CHECKS;
|
||||||
|
|
||||||
else if (d > DEPTH_QS_RECAPTURES)
|
else if (d > DEPTH_QS_RECAPTURES)
|
||||||
stage = QSEARCH_1;
|
stage = QSEARCH_WITHOUT_CHECKS;
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -191,12 +191,13 @@ void MovePicker::generate_next_stage() {
|
||||||
|
|
||||||
switch (++stage) {
|
switch (++stage) {
|
||||||
|
|
||||||
case CAPTURES_S1: case CAPTURES_S3: case CAPTURES_S4: case CAPTURES_S5: case CAPTURES_S6:
|
case GOOD_CAPTURES: case QCAPTURES_1: case QCAPTURES_2:
|
||||||
|
case PROBCUT_CAPTURES: case RECAPTURES:
|
||||||
endMoves = generate<CAPTURES>(pos, moves);
|
endMoves = generate<CAPTURES>(pos, moves);
|
||||||
score<CAPTURES>();
|
score<CAPTURES>();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KILLERS_S1:
|
case KILLERS:
|
||||||
cur = killers;
|
cur = killers;
|
||||||
endMoves = cur + 2;
|
endMoves = cur + 2;
|
||||||
|
|
||||||
|
@ -210,37 +211,38 @@ void MovePicker::generate_next_stage() {
|
||||||
*endMoves++ = countermove;
|
*endMoves++ = countermove;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case QUIETS_1_S1:
|
case GOOD_QUIETS:
|
||||||
endQuiets = endMoves = generate<QUIETS>(pos, moves);
|
endQuiets = endMoves = generate<QUIETS>(pos, moves);
|
||||||
score<QUIETS>();
|
score<QUIETS>();
|
||||||
endMoves = std::partition(cur, endMoves, [](const ExtMove& m) { return m.value > VALUE_ZERO; });
|
endMoves = std::partition(cur, endMoves, [](const ExtMove& m) { return m.value > VALUE_ZERO; });
|
||||||
insertion_sort(cur, endMoves);
|
insertion_sort(cur, endMoves);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case QUIETS_2_S1:
|
case BAD_QUIETS:
|
||||||
cur = endMoves;
|
cur = endMoves;
|
||||||
endMoves = endQuiets;
|
endMoves = endQuiets;
|
||||||
if (depth >= 3 * ONE_PLY)
|
if (depth >= 3 * ONE_PLY)
|
||||||
insertion_sort(cur, endMoves);
|
insertion_sort(cur, endMoves);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BAD_CAPTURES_S1:
|
case BAD_CAPTURES:
|
||||||
// Just pick them in reverse order to get MVV/LVA ordering
|
// Just pick them in reverse order to get MVV/LVA ordering
|
||||||
cur = moves + MAX_MOVES - 1;
|
cur = moves + MAX_MOVES - 1;
|
||||||
endMoves = endBadCaptures;
|
endMoves = endBadCaptures;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EVASIONS_S2:
|
case ALL_EVASIONS:
|
||||||
endMoves = generate<EVASIONS>(pos, moves);
|
endMoves = generate<EVASIONS>(pos, moves);
|
||||||
if (endMoves - moves > 1)
|
if (endMoves - moves > 1)
|
||||||
score<EVASIONS>();
|
score<EVASIONS>();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case QUIET_CHECKS_S3:
|
case CHECKS:
|
||||||
endMoves = generate<QUIET_CHECKS>(pos, moves);
|
endMoves = generate<QUIET_CHECKS>(pos, moves);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EVASION: case QSEARCH_0: case QSEARCH_1: case PROBCUT: case RECAPTURE:
|
case EVASION: case QSEARCH_WITH_CHECKS: case QSEARCH_WITHOUT_CHECKS:
|
||||||
|
case PROBCUT: case RECAPTURE:
|
||||||
stage = STOP;
|
stage = STOP;
|
||||||
/* Fall through */
|
/* Fall through */
|
||||||
|
|
||||||
|
@ -270,11 +272,12 @@ Move MovePicker::next_move<false>() {
|
||||||
|
|
||||||
switch (stage) {
|
switch (stage) {
|
||||||
|
|
||||||
case MAIN_SEARCH: case EVASION: case QSEARCH_0: case QSEARCH_1: case PROBCUT:
|
case MAIN_SEARCH: case EVASION: case QSEARCH_WITH_CHECKS:
|
||||||
|
case QSEARCH_WITHOUT_CHECKS: case PROBCUT:
|
||||||
++cur;
|
++cur;
|
||||||
return ttMove;
|
return ttMove;
|
||||||
|
|
||||||
case CAPTURES_S1:
|
case GOOD_CAPTURES:
|
||||||
move = pick_best(cur++, endMoves);
|
move = pick_best(cur++, endMoves);
|
||||||
if (move != ttMove)
|
if (move != ttMove)
|
||||||
{
|
{
|
||||||
|
@ -286,7 +289,7 @@ Move MovePicker::next_move<false>() {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KILLERS_S1:
|
case KILLERS:
|
||||||
move = *cur++;
|
move = *cur++;
|
||||||
if ( move != MOVE_NONE
|
if ( move != MOVE_NONE
|
||||||
&& move != ttMove
|
&& move != ttMove
|
||||||
|
@ -295,7 +298,7 @@ Move MovePicker::next_move<false>() {
|
||||||
return move;
|
return move;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case QUIETS_1_S1: case QUIETS_2_S1:
|
case GOOD_QUIETS: case BAD_QUIETS:
|
||||||
move = *cur++;
|
move = *cur++;
|
||||||
if ( move != ttMove
|
if ( move != ttMove
|
||||||
&& move != killers[0]
|
&& move != killers[0]
|
||||||
|
@ -304,28 +307,28 @@ Move MovePicker::next_move<false>() {
|
||||||
return move;
|
return move;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BAD_CAPTURES_S1:
|
case BAD_CAPTURES:
|
||||||
return *cur--;
|
return *cur--;
|
||||||
|
|
||||||
case EVASIONS_S2: case CAPTURES_S3: case CAPTURES_S4:
|
case ALL_EVASIONS: case QCAPTURES_1: case QCAPTURES_2:
|
||||||
move = pick_best(cur++, endMoves);
|
move = pick_best(cur++, endMoves);
|
||||||
if (move != ttMove)
|
if (move != ttMove)
|
||||||
return move;
|
return move;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CAPTURES_S5:
|
case PROBCUT_CAPTURES:
|
||||||
move = pick_best(cur++, endMoves);
|
move = pick_best(cur++, endMoves);
|
||||||
if (move != ttMove && pos.see(move) > captureThreshold)
|
if (move != ttMove && pos.see(move) > captureThreshold)
|
||||||
return move;
|
return move;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CAPTURES_S6:
|
case RECAPTURES:
|
||||||
move = pick_best(cur++, endMoves);
|
move = pick_best(cur++, endMoves);
|
||||||
if (to_sq(move) == recaptureSquare)
|
if (to_sq(move) == recaptureSquare)
|
||||||
return move;
|
return move;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case QUIET_CHECKS_S3:
|
case CHECKS:
|
||||||
move = *cur++;
|
move = *cur++;
|
||||||
if (move != ttMove)
|
if (move != ttMove)
|
||||||
return move;
|
return move;
|
||||||
|
|
Loading…
Add table
Reference in a new issue