Skip to content

Commit

Permalink
leaf node only when oppo5 is false
Browse files Browse the repository at this point in the history
test f15
  • Loading branch information
dhbloo committed Oct 13, 2024
1 parent b1a0f33 commit 01996d8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Rapfi/search/ab/search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -635,8 +635,9 @@ Value search(Board &board, SearchStack *ss, Value alpha, Value beta, Depth depth
thisThread->numNodes.fetch_add(1, std::memory_order_relaxed);

Color self = board.sideToMove(), oppo = ~self;
uint16_t oppo5 = board.p4Count(oppo, A_FIVE); // opponent five
uint16_t oppo4 = oppo5 + board.p4Count(oppo, B_FLEX4); // opponent straight four and five
uint16_t oppo5 = board.p4Count(oppo, A_FIVE); // opponent five
uint16_t oppo4 = oppo5 + board.p4Count(oppo, B_FLEX4); // opponent straight four and five
bool isLeaf = depth <= 0; // Consider this as leaf node if depth reaches zero

int moveCount = 0, nonMatedCount = 0;
Value bestValue = -VALUE_INFINITE, maxValue = VALUE_INFINITE, value;
Expand Down Expand Up @@ -786,8 +787,7 @@ Value search(Board &board, SearchStack *ss, Value alpha, Value beta, Depth depth

// Step 6. Static evaluation
Value eval = VALUE_NONE;
int improvement = 0; // Static eval change in the last two ply
bool isLeaf = depth <= 0; // Consider this as leaf node if depth reaches zero
int improvement = 0; // Static eval change in the last two ply

if (oppo4 && !isLeaf) {
// Use static evaluation from previous ply if opponent makes a four/five attack
Expand Down Expand Up @@ -826,7 +826,7 @@ Value search(Board &board, SearchStack *ss, Value alpha, Value beta, Depth depth
improvement = ss->staticEval - (ss - 2)->staticEval;

// Return static eval when we reach leaf node
if (isLeaf)
if (isLeaf && !oppo5)
return eval;
}

Expand Down

0 comments on commit 01996d8

Please sign in to comment.