Author: Mikael Bäckman
Date: 06:15:06 09/21/03
Hi! I have a problem with my search. I'm sick of debugging it, maybe you guys can find the problem. :) The below code is supposed to be a fail-soft, but when it fails high or low at root, the score will always be on the window boundary. If I disable hash and nullmove, the problem still exists. Even if I evaluate with material only, the problem is the same. I don't use futility pruning, SEE, etc. For example, my logfile for : [D]rnbq1rk1/ppppbppp/8/3pP3/3P2Q1/8/PPP2PPP/R1B1KBNR w KQ - 0 7 searching 1 [-10000, 10000] -1.09 1 0.0 Kd1 1/1 -1.04 11 0.0 a3 1/3 -0.99 12 0.0 a4 1/1 -0.93 24 0.0 Qd1 1/1 -0.76 36 0.0 Bd2 1/1 -0.74 37 0.0 Be3 1/1 -0.72 38 0.0 Bf4 1/1 -0.67 44 0.0 Bh6 1/1 searching 2 [-100, -34] -0.73 165 0.0 Bh6 Bb4+ c3 2/8 searching 3 [-106, -40] -0.40 1k 0.0 Bh6! 3/13 searching 4 [-106, 10000] 0.89 9k 0.1 Bh6 g5 Bxf8 Qxf8 4/13 searching 5 [56, 122] 1.22 13k 0.1 Bh6! 5/13 searching 6 [56, 10000] 1.49 37k 0.2 Bh6 Bf6 exf6 Qxf6 Bg5 Qd6 6/17 searching 7 [116, 182] 1.82 83k 0.4 Bh6! 7/18 Same position with material evaluation only, hash and nullmove disabled: searching 1 [-10000, 10000] 0.00 1 0.0 Kd1 1/1 searching 2 [-33, 33] 0.00 76 0.0 Kd1 Kh8 2/4 searching 3 [-33, 33] 0.00 552 0.0 Kd1 Kh8 Ke1 3/6 0.33 1k 0.0 Bh6! 3/10 searching 4 [-33, 10000] 1.80 8k 0.0 Bh6 g6 Bxf8 Kxf8 4/12 searching 5 [147, 213] 1.80 46k 0.1 Bh6 g6 Bxf8 Kxf8 Kd1 5/16 searching 6 [147, 213] 1.80 234k 0.4 Bh6 g6 Bxf8 Kxf8 Kd1 d6 6/16 searching 7 [147, 213] 1.80 1364k 2.4 Bh6 g6 Bxf8 Kxf8 Kd1 d6 Qg3 7/26 The fail high values are always on the window boundary. :( After stripping the code of 'junk', here's what's left of it: int evaluate(wtm) { return wtm ? matscore : -matscore; } int qSearch(int wtm, int alpha, int beta) { score = evaluate(wtm); if (score > alpha) { if (score >= beta) return score; alpha = score; } pLast = genAllCapMoves(wtm, pFirst); nLegal = 0; while (pMove = nextMove(pFirst, pLast)) { if (makeMove(wtm, pMove)) { nLegal++; score = -qSearch(wtm^1, -beta, -alpha); unmakeMove(pMove); if (score > alpha) { if (score >= beta) return score; alpha = score; } } } if (!nLegal) return score; return alpha; } int alphaBeta(int depth, int wtm, int alpha, int beta) { if (depth < 1) return qSearch(wtm, alpha, beta); pLast = genAllMoves(wtm, pFirst); bestScore = -MATE; nLegal = 0; while (pMove = nextMove(pFirst, pLast)) { if (makeMove(wtm, pMove)) { score = -alphaBeta(depth - 1, wtm^1, -beta, -alpha); unmakeMove(pMove); if (score > bestScore) { bestScore = score; if (score > alpha) { if (score >= beta) return score; alpha = score; } } nLegal++; } } if (!nLegal) { if (isCheck()) bestScore += tree.ply; else bestScore = 0; } return bestScore; } Any help is greatly appriciated. /Mikael
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.