A few things to debate for my chess engine

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

ZirconiumX
Posts: 1334
Joined: Sun Jul 17, 2011 11:14 am

Re: A few things to debate for my chess engine

Post by ZirconiumX »

Numbers after 1. e4:

'Vanilla' Alpha-Beta (Plain) (Not even QSearch)
info string dbg: nodes: 4269096 = ALL, 324290 = CUT, 42705 = PV
info string dbg: search: pruning: 0 = Futility, 0 = Extended Futility, 0 = Nullmove, 0 = Hash Table, 0 = Multi-Cut
info string dbg: search: reductions: 0 = Razoring, 0 = Fail-High, 0 = Late Move
info string dbg: search: extensions: 0 = Check, 0 = One Reply, 0 = Singular
info depth 6 score cp -95 nodes 4636091 time 55810 nps 6112 pv b8c6 b1c3 g8f6 f1c4 f6e4 c3e4
bestmove b8c6

^^ + Futility Pruning
info string dbg: nodes: 4278416 = ALL, 323293 = CUT, 39918 = PV
info string dbg: search: pruning: 2138 = Futility, 0 = Extended Futility, 0 = Nullmove, 0 = Hash Table, 0 = Multi-Cut
info string dbg: search: reductions: 0 = Razoring, 0 = Fail-High, 0 = Late Move
info string dbg: search: extensions: 0 = Check, 0 = One Reply, 0 = Singular
info depth 6 score cp -90 nodes 4641627 time 45563 nps 7608 pv b8c6 b1c3 g8f6 d1f3 f6e4 c3e4
bestmove b8c6

3. Qf3!? is an interesting move to my mind...

^^ + Extended Futility Pruning
info string dbg: nodes: 4278416 = ALL, 323293 = CUT, 39918 = PV
info string dbg: search: pruning: 2138 = Futility, 0 = Extended Futility, 0 = Nullmove, 0 = Hash Table, 0 = Multi-Cut
info string dbg: search: reductions: 0 = Razoring, 0 = Fail-High, 0 = Late Move
info string dbg: search: extensions: 0 = Check, 0 = One Reply, 0 = Singular
info depth 6 score cp -90 nodes 4641627 time 52253 nps 6634 pv b8c6 b1c3 g8f6 d1f3 f6e4 c3e4
bestmove b8c6

^^ + Razoring
info string dbg: nodes: 4278416 = ALL, 323293 = CUT, 39918 = PV
info string dbg: search: pruning: 2138 = Futility, 0 = Extended Futility, 0 = Nullmove, 0 = Hash Table, 0 = Multi-Cut
info string dbg: search: reductions: 0 = Razoring, 0 = Fail-High, 0 = Late Move
info string dbg: search: extensions: 0 = Check, 0 = One Reply, 0 = Singular
info depth 6 score cp -90 nodes 4641627 time 51087 nps 6785 pv b8c6 b1c3 g8f6 d1f3 f6e4 c3e4
bestmove b8c6

^^ + PVS
info string dbg: nodes: 0 = ALL, 601335 = CUT, 31880 = PV
info string dbg: search: pruning: 4719 = Futility, 744 = Extended Futility, 0 = Nullmove, 0 = Hash Table, 0 = Multi-Cut
info string dbg: search: reductions: 48 = Razoring, 0 = Fail-High, 0 = Late Move
info string dbg: search: extensions: 0 = Check, 0 = One Reply, 0 = Singular
info depth 6 score cp -90 nodes 8300394 time 101592 nps -2850 pv b8c6 b1c3 g8f6 d1f3 f6e4 c3e4
bestmove b8c6

So PVS is searching MORE nodes?!

^^ + LMR
info string dbg: nodes: 22284 = ALL, 352891 = CUT, 9894 = PV
info string dbg: search: pruning: 4391 = Futility, 525 = Extended Futility, 0 = Nullmove, 0 = Hash Table, 0 = Multi-Cut
info string dbg: search: reductions: 64 = Razoring, 0 = Fail-High, 16600 = Late Move
info string dbg: search: extensions: 0 = Check, 0 = One Reply, 0 = Singular
info depth 6 score cp -60 nodes 3621310 time 42644 nps -15797 pv g8f6 e4e5 b8c6 e5f6 g7f6 b1c3
bestmove g8f6

LMR helps fight the surge in nodes.

^^ + Fail High Reductions
info string dbg: nodes: 7108 = ALL, 169759 = CUT, 9133 = PV
info string dbg: search: pruning: 1078 = Futility, 64 = Extended Futility, 0 = Nullmove, 0 = Hash Table, 0 = Multi-Cut
info string dbg: search: reductions: 19 = Razoring, 47709 = Fail-High, 7667 = Late Move
info string dbg: search: extensions: 0 = Check, 0 = One Reply, 0 = Singular
info depth 6 score cp 45 nodes 1735808 time 20864 nps
83196 pv b8c6 e4e5 c6e5 d1e2 e5c6 e2e7
bestmove b8c6

Fail High Reductions also helps fight the surge.

^^ + Check Extension
info string dbg: nodes: 7227 = ALL, 167034 = CUT, 8952 = PV
info string dbg: search: pruning: 988 = Futility, 64 = Extended Futility, 0 = Nullmove, 0 = Hash Table, 0 = Multi-Cut
info string dbg: search: reductions: 19 = Razoring, 48077 = Fail-High, 7518 = Late Move
info string dbg: search: extensions: 739 = Check, 0 = One Reply, 0 = Singular
info depth 6 score cp 45 nodes 1679166 time 21957 nps 76475 pv b8c6 e4e5 c6e5 d1e2 e5c6 e2e7
bestmove b8c6

^^ + One Reply Extension
info string dbg: nodes: 7227 = ALL, 167034 = CUT, 8952 = PV
info string dbg: search: pruning: 988 = Futility, 64 = Extended Futility, 0 = Nullmove, 0 = Hash Table, 0 = Multi-Cut
info string dbg: search: reductions: 19 = Razoring, 48077 = Fail-High, 7518 = Late Move
info string dbg: search: extensions: 739 = Check, 0 = One Reply, 0 = Singular
info depth 6 score cp 45 nodes 1679166 time 19592 nps 85706 pv b8c6 e4e5 c6e5 d1e2 e5c6 e2e7
bestmove b8c6

^^ + Singular Extension
info string dbg: nodes: 7347 = ALL, 202699 = CUT, 9515 = PV
info string dbg: search: pruning: 1239 = Futility, 64 = Extended Futility, 0 = Nullmove, 0 = Hash Table, 0 = Multi-Cut
info string dbg: search: reductions: 19 = Razoring, 52849 = Fail-High, 6960 = Late Move
info string dbg: search: extensions: 1448 = Check, 0 = One Reply, 5236 = Singular
info depth 6 score cp 45 nodes 1799282 time 20620 nps 87259 pv b8c6 e4e5 c6e5 d1e2 e5c6 e2e7
bestmove b8c6

^^ + Nullmove Pruning
info string dbg: nodes: 7967 = ALL, 141668 = CUT, 8026 = PV
info string dbg: search: pruning: 2552 = Futility, 102 = Extended Futility, 38969 = Nullmove, 0 = Hash Table, 0 = Multi-Cut
info string dbg: search: reductions: 0 = Razoring, 21266 = Fail-High, 6520 = Late Move
info string dbg: search: extensions: 1330 = Check, 0 = One Reply, 4073 = Singular
info depth 6 score cp 45 nodes 1568473 time 16022 nps 97894 pv b8c6 e4e5 c6e5 d1e2 e5c6 e2e7
bestmove b8c6

Nullmove now seems to work...

Matthew:out
Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: A few things to debate for my chess engine

Post by Sven »

ZirconiumX wrote:b8c6 e4e5 c6e5 d1e2 e5c6 e2e7

Nullmove now seems to work...
But the search is still screwed up. For instance, in the example above the moves 2.e5? and especially 4.Qxe7?? are horrible blunders. I suggest not to care about improvements like futility pruning, razoring, nullmove etc. as long as the basic search itself is wrong. If you have no working qsearch then implementing nullmove etc. makes no sense.

Sven
ZirconiumX
Posts: 1334
Joined: Sun Jul 17, 2011 11:14 am

Re: A few things to debate for my chess engine

Post by ZirconiumX »

But my QSearches always fail...

Magic's QSearch failed. LUCI's QSearch is failing.

Code: Select all

int Quies(int alpha, int beta)
{
	int				moves = 0,
					stand_pat_score = 0,
					val = 0;
	MOVE			moveBuf[200];
	
	nodes++;
	qnodes++;
	
	stand_pat_score = Eval();
	if (stand_pat_score >= beta)
		return beta;
	if (stand_pat_score > alpha)
		alpha = stand_pat_score;
		
	moves = QGen(side, moveBuf);
	if (moves == 0)
		return alpha;
	
	for &#40;int i = 0; i < moves; i++) &#123;
		if (!MakeMove&#40;moveBuf&#91;i&#93;)) &#123;
			UnmakeMove&#40;);
			continue;
		&#125;
		
		val = -Quies&#40;-beta, -alpha&#41;;
		UnmakeMove&#40;);
		
		if &#40;val >= beta&#41;
			return beta;
		if &#40;val > alpha&#41;
			alpha = val;
	&#125;
	return alpha;
&#125;
Causes erroneous mate scores to be returned...

Code: Select all

LUCI, by Pham Hong Nguyen, Matthew Brades

e2e4
info depth 1
info currmove b8a6 currmovenumber 1
info score cp 0
info currmove b8c6 currmovenumber 2
info score cp -19999
info currmove g8f6 currmovenumber 3
info score cp -19999
info currmove g8h6 currmovenumber 4
info score cp -19999
info currmove a7a6 currmovenumber 5
info score cp -19999
info currmove a7a5 currmovenumber 6
info score cp -19999
info currmove b7b6 currmovenumber 7
info score cp -19999
info currmove b7b5 currmovenumber 8
info score cp -19999
info currmove c7c6 currmovenumber 9
info score cp -19999
info currmove c7c5 currmovenumber 10
info score cp -19999
info currmove d7d6 currmovenumber 11
info score cp -19999
info currmove d7d5 currmovenumber 12
info score cp -19999
info currmove e7e6 currmovenumber 13
info score cp -19999
info currmove e7e5 currmovenumber 14
info score cp -19999
info currmove f7f6 currmovenumber 15
info score cp -19999
info currmove f7f5 currmovenumber 16
info score cp -19999
info currmove g7g6 currmovenumber 17
info score cp -19999
info currmove g7g5 currmovenumber 18
info score cp -19999
info currmove h7h6 currmovenumber 19
info score cp -19999
info currmove h7h5 currmovenumber 20
info score cp -19999
info score upperbound 0
info string dbg&#58; nodes&#58; 0 = ALL, 0 = CUT, 1 = PV, 27 = Quiescence
info string dbg&#58; search&#58; pruning&#58; 0 = Futility, 0 = Extended Futility, 1 = Nullmove, 0 = Hash Table, 0 = Multi-Cut
info string dbg&#58; search&#58; reductions&#58; 0 = Razoring, 0 = Fail-High, 0 = Late Move
info string dbg&#58; search&#58; extensions&#58; 0 = Check, 0 = One Reply, 1 = Singular
info depth 1 score cp 0 nodes 51 time 8 nps 6375 pv b8a6 
info depth 2
info currmove b8a6 currmovenumber 1
info score cp -20000
info score upperbound -20000
info string dbg&#58; nodes&#58; 2 = ALL, 1 = CUT, 1 = PV, 60 = Quiescence
info string dbg&#58; search&#58; pruning&#58; 0 = Futility, 0 = Extended Futility, 1 = Nullmove, 0 = Hash Table, 0 = Multi-Cut
info string dbg&#58; search&#58; reductions&#58; 0 = Razoring, 0 = Fail-High, 0 = Late Move
info string dbg&#58; search&#58; extensions&#58; 1 = Check, 0 = One Reply, 2 = Singular
info depth 2 score mate -0 nodes 117 time 9 nps 13000 pv b8a6 
info depth 3
info score upperbound -20000
info string dbg&#58; nodes&#58; 3 = ALL, 1 = CUT, 1 = PV, 60 = Quiescence
info string dbg&#58; search&#58; pruning&#58; 0 = Futility, 0 = Extended Futility, 1 = Nullmove, 0 = Hash Table, 0 = Multi-Cut
info string dbg&#58; search&#58; reductions&#58; 0 = Razoring, 0 = Fail-High, 0 = Late Move
info string dbg&#58; search&#58; extensions&#58; 2 = Check, 0 = One Reply, 2 = Singular
info depth 3 score mate -0 nodes 118 time 10 nps 11800 pv b8a6 
info depth 4
info score upperbound -20000
info string dbg&#58; nodes&#58; 4 = ALL, 1 = CUT, 1 = PV, 60 = Quiescence
info string dbg&#58; search&#58; pruning&#58; 0 = Futility, 0 = Extended Futility, 1 = Nullmove, 0 = Hash Table, 0 = Multi-Cut
info string dbg&#58; search&#58; reductions&#58; 0 = Razoring, 0 = Fail-High, 0 = Late Move
info string dbg&#58; search&#58; extensions&#58; 3 = Check, 0 = One Reply, 2 = Singular
info depth 4 score mate -0 nodes 119 time 10 nps 11900 pv b8a6 
info depth 5
info score upperbound -20000
info string dbg&#58; nodes&#58; 5 = ALL, 1 = CUT, 1 = PV, 60 = Quiescence
info string dbg&#58; search&#58; pruning&#58; 0 = Futility, 0 = Extended Futility, 1 = Nullmove, 0 = Hash Table, 0 = Multi-Cut
info string dbg&#58; search&#58; reductions&#58; 0 = Razoring, 0 = Fail-High, 0 = Late Move
info string dbg&#58; search&#58; extensions&#58; 4 = Check, 0 = One Reply, 2 = Singular
info depth 5 score mate -0 nodes 120 time 47 nps 2553 pv b8a6 
info depth 6
info score upperbound -20000
info string dbg&#58; nodes&#58; 6 = ALL, 1 = CUT, 1 = PV, 60 = Quiescence
info string dbg&#58; search&#58; pruning&#58; 0 = Futility, 0 = Extended Futility, 1 = Nullmove, 0 = Hash Table, 0 = Multi-Cut
info string dbg&#58; search&#58; reductions&#58; 0 = Razoring, 0 = Fail-High, 0 = Late Move
info string dbg&#58; search&#58; extensions&#58; 5 = Check, 0 = One Reply, 2 = Singular
info depth 6 score mate -0 nodes 121 time 47 nps 2574 pv b8a6 
info depth 7
info score upperbound -20000
info string dbg&#58; nodes&#58; 7 = ALL, 1 = CUT, 1 = PV, 60 = Quiescence
info string dbg&#58; search&#58; pruning&#58; 0 = Futility, 0 = Extended Futility, 1 = Nullmove, 0 = Hash Table, 0 = Multi-Cut
info string dbg&#58; search&#58; reductions&#58; 0 = Razoring, 0 = Fail-High, 0 = Late Move
info string dbg&#58; search&#58; extensions&#58; 6 = Check, 0 = One Reply, 2 = Singular
info depth 7 score mate -0 nodes 122 time 48 nps 2541 pv b8a6 
info depth 8
info score upperbound -20000
info string dbg&#58; nodes&#58; 8 = ALL, 1 = CUT, 1 = PV, 60 = Quiescence
info string dbg&#58; search&#58; pruning&#58; 0 = Futility, 0 = Extended Futility, 1 = Nullmove, 0 = Hash Table, 0 = Multi-Cut
info string dbg&#58; search&#58; reductions&#58; 0 = Razoring, 0 = Fail-High, 0 = Late Move
info string dbg&#58; search&#58; extensions&#58; 7 = Check, 0 = One Reply, 2 = Singular
info depth 8 score mate -0 nodes 123 time 48 nps 2562 pv b8a6 
info depth 9
info score upperbound -20000
info string dbg&#58; nodes&#58; 9 = ALL, 1 = CUT, 1 = PV, 60 = Quiescence
info string dbg&#58; search&#58; pruning&#58; 0 = Futility, 0 = Extended Futility, 1 = Nullmove, 0 = Hash Table, 0 = Multi-Cut
info string dbg&#58; search&#58; reductions&#58; 0 = Razoring, 0 = Fail-High, 0 = Late Move
info string dbg&#58; search&#58; extensions&#58; 8 = Check, 0 = One Reply, 2 = Singular
info depth 9 score mate -0 nodes 124 time 48 nps 2583 pv b8a6 
info depth 10
info score upperbound -20000
info string dbg&#58; nodes&#58; 10 = ALL, 1 = CUT, 1 = PV, 60 = Quiescence
info string dbg&#58; search&#58; pruning&#58; 0 = Futility, 0 = Extended Futility, 1 = Nullmove, 0 = Hash Table, 0 = Multi-Cut
info string dbg&#58; search&#58; reductions&#58; 0 = Razoring, 0 = Fail-High, 0 = Late Move
info string dbg&#58; search&#58; extensions&#58; 9 = Check, 0 = One Reply, 2 = Singular
info depth 10 score mate -0 nodes 125 time 48 nps 2604 pv b8a6 
info depth 11
info score upperbound -20000
info string dbg&#58; nodes&#58; 11 = ALL, 1 = CUT, 1 = PV, 60 = Quiescence
info string dbg&#58; search&#58; pruning&#58; 0 = Futility, 0 = Extended Futility, 1 = Nullmove, 0 = Hash Table, 0 = Multi-Cut
info string dbg&#58; search&#58; reductions&#58; 0 = Razoring, 0 = Fail-High, 0 = Late Move
info string dbg&#58; search&#58; extensions&#58; 10 = Check, 0 = One Reply, 2 = Singular
info depth 11 score mate -0 nodes 126 time 49 nps 2571 pv b8a6 
info depth 12
info score upperbound -20000
info string dbg&#58; nodes&#58; 12 = ALL, 1 = CUT, 1 = PV, 60 = Quiescence
info string dbg&#58; search&#58; pruning&#58; 0 = Futility, 0 = Extended Futility, 1 = Nullmove, 0 = Hash Table, 0 = Multi-Cut
info string dbg&#58; search&#58; reductions&#58; 0 = Razoring, 0 = Fail-High, 0 = Late Move
info string dbg&#58; search&#58; extensions&#58; 11 = Check, 0 = One Reply, 2 = Singular
info depth 12 score mate -0 nodes 127 time 49 nps 2591 pv b8a6 
info depth 13
info score upperbound -20000
info string dbg&#58; nodes&#58; 13 = ALL, 1 = CUT, 1 = PV, 60 = Quiescence
info string dbg&#58; search&#58; pruning&#58; 0 = Futility, 0 = Extended Futility, 1 = Nullmove, 0 = Hash Table, 0 = Multi-Cut
info string dbg&#58; search&#58; reductions&#58; 0 = Razoring, 0 = Fail-High, 0 = Late Move
info string dbg&#58; search&#58; extensions&#58; 12 = Check, 0 = One Reply, 2 = Singular
info depth 13 score mate -0 nodes 128 time 49 nps 2612 pv b8a6 
info depth 14
info score upperbound -20000
info string dbg&#58; nodes&#58; 14 = ALL, 1 = CUT, 1 = PV, 60 = Quiescence
info string dbg&#58; search&#58; pruning&#58; 0 = Futility, 0 = Extended Futility, 1 = Nullmove, 0 = Hash Table, 0 = Multi-Cut
info string dbg&#58; search&#58; reductions&#58; 0 = Razoring, 0 = Fail-High, 0 = Late Move
info string dbg&#58; search&#58; extensions&#58; 13 = Check, 0 = One Reply, 2 = Singular
info depth 14 score mate -0 nodes 129 time 50 nps 2580 pv b8a6 
info depth 15
info score upperbound -20000
info string dbg&#58; nodes&#58; 15 = ALL, 1 = CUT, 1 = PV, 60 = Quiescence
info string dbg&#58; search&#58; pruning&#58; 0 = Futility, 0 = Extended Futility, 1 = Nullmove, 0 = Hash Table, 0 = Multi-Cut
info string dbg&#58; search&#58; reductions&#58; 0 = Razoring, 0 = Fail-High, 0 = Late Move
info string dbg&#58; search&#58; extensions&#58; 14 = Check, 0 = One Reply, 2 = Singular
info depth 15 score mate -0 nodes 130 time 50 nps 2600 pv b8a6 
info depth 16
info score upperbound -20000
info string dbg&#58; nodes&#58; 16 = ALL, 1 = CUT, 1 = PV, 60 = Quiescence
info string dbg&#58; search&#58; pruning&#58; 0 = Futility, 0 = Extended Futility, 1 = Nullmove, 0 = Hash Table, 0 = Multi-Cut
info string dbg&#58; search&#58; reductions&#58; 0 = Razoring, 0 = Fail-High, 0 = Late Move
info string dbg&#58; search&#58; extensions&#58; 15 = Check, 0 = One Reply, 2 = Singular
info depth 16 score mate -0 nodes 131 time 50 nps 2620 pv b8a6 
info depth 17
info score upperbound -20000
info string dbg&#58; nodes&#58; 17 = ALL, 1 = CUT, 1 = PV, 60 = Quiescence
info string dbg&#58; search&#58; pruning&#58; 0 = Futility, 0 = Extended Futility, 1 = Nullmove, 0 = Hash Table, 0 = Multi-Cut
info string dbg&#58; search&#58; reductions&#58; 0 = Razoring, 0 = Fail-High, 0 = Late Move
info string dbg&#58; search&#58; extensions&#58; 16 = Check, 0 = One Reply, 2 = Singular
info depth 17 score mate -0 nodes 132 time 51 nps 2588 pv b8a6 
info depth 18
info score upperbound -20000
info string dbg&#58; nodes&#58; 18 = ALL, 1 = CUT, 1 = PV, 60 = Quiescence
info string dbg&#58; search&#58; pruning&#58; 0 = Futility, 0 = Extended Futility, 1 = Nullmove, 0 = Hash Table, 0 = Multi-Cut
info string dbg&#58; search&#58; reductions&#58; 0 = Razoring, 0 = Fail-High, 0 = Late Move
info string dbg&#58; search&#58; extensions&#58; 17 = Check, 0 = One Reply, 2 = Singular
info depth 18 score mate -0 nodes 133 time 51 nps 2607 pv b8a6 
info depth 19
info score upperbound -20000
info string dbg&#58; nodes&#58; 19 = ALL, 1 = CUT, 1 = PV, 60 = Quiescence
info string dbg&#58; search&#58; pruning&#58; 0 = Futility, 0 = Extended Futility, 1 = Nullmove, 0 = Hash Table, 0 = Multi-Cut
info string dbg&#58; search&#58; reductions&#58; 0 = Razoring, 0 = Fail-High, 0 = Late Move
info string dbg&#58; search&#58; extensions&#58; 18 = Check, 0 = One Reply, 2 = Singular
info depth 19 score mate -0 nodes 134 time 51 nps 2627 pv b8a6 
info depth 20
info score upperbound -20000
info string dbg&#58; nodes&#58; 20 = ALL, 1 = CUT, 1 = PV, 60 = Quiescence
info string dbg&#58; search&#58; pruning&#58; 0 = Futility, 0 = Extended Futility, 1 = Nullmove, 0 = Hash Table, 0 = Multi-Cut
info string dbg&#58; search&#58; reductions&#58; 0 = Razoring, 0 = Fail-High, 0 = Late Move
info string dbg&#58; search&#58; extensions&#58; 19 = Check, 0 = One Reply, 2 = Singular
info depth 20 score mate -0 nodes 135 time 51 nps 2647 pv b8a6 
bestmove b8a6
Need I say more?!

Matthew:out
AlvaroBegue
Posts: 931
Joined: Tue Mar 09, 2010 3:46 pm
Location: New York
Full name: Álvaro Begué (RuyDos)

Re: A few things to debate for my chess engine

Post by AlvaroBegue »

You shouldn't continue until you get a working quiescence search.

If your attempts at implementing a quiescence search haven't been successful, you should figure out what you are doing wrong. Pick a position where your program does something clearly wrong and narrow it down to a specific call to quiescence not doing the right thing. Then execute the function step by step in a debugger to see what it's doing wrong.
Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: A few things to debate for my chess engine

Post by Sven »

ZirconiumX wrote:But my QSearches always fail...

Magic's QSearch failed. LUCI's QSearch is failing.
[...]
Causes erroneous mate scores to be returned...

Code: Select all

LUCI, by Pham Hong Nguyen, Matthew Brades

e2e4
info depth 1
info currmove b8a6 currmovenumber 1
info score cp 0
info currmove b8c6 currmovenumber 2
info score cp -19999
...
Need I say more?!
The "Quies" code you posted does not contain any mate scores, unless your static evaluation function produces them (which I doubt). So it must be the remaining search code that is responsible for the score of "-19999" after analyzing 1.e4 Nc6. I think you should figure out why that happens. If it does not happen without "Quies" then this does not mean automatically that the error is within the "Quies" function, it can also be in the environment of its caller.

Sven
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: A few things to debate for my chess engine

Post by bob »

Sven Schüle wrote:
ZirconiumX wrote:But my QSearches always fail...

Magic's QSearch failed. LUCI's QSearch is failing.
[...]
Causes erroneous mate scores to be returned...

Code: Select all

LUCI, by Pham Hong Nguyen, Matthew Brades

e2e4
info depth 1
info currmove b8a6 currmovenumber 1
info score cp 0
info currmove b8c6 currmovenumber 2
info score cp -19999
...
Need I say more?!
The "Quies" code you posted does not contain any mate scores, unless your static evaluation function produces them (which I doubt). So it must be the remaining search code that is responsible for the score of "-19999" after analyzing 1.e4 Nc6. I think you should figure out why that happens. If it does not happen without "Quies" then this does not mean automatically that the error is within the "Quies" function, it can also be in the environment of its caller.

Sven
I believe the most common reason for this is a flawed search where you let one side capture the king. That likely returns a score outside any valid alpha/beta window, which will produce errors. Another possibility is letting the capture a king occurrence cause your search to break and think it is mated at the next ply or whatever.
ZirconiumX
Posts: 1334
Joined: Sun Jul 17, 2011 11:14 am

Re: A few things to debate for my chess engine

Post by ZirconiumX »

Yup - adding an if-statement that prevented the king being captured, or a piece taking a piece of the same color did the trick.

However - LUCI now only searches to depth 5 - and that's with delta pruning.

Hmmm...

Matthew:out
Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: A few things to debate for my chess engine

Post by Sven »

ZirconiumX wrote:Yup - adding an if-statement that prevented the king being captured, or a piece taking a piece of the same color did the trick.
Sounds good!

But now, since you have detected errors in the context of move generation, I suggest that your next step should be to verify with "perft" that your move generation, board representation, making/unmaking, is-in-check, or legality checking code is really 100% correct. Any improvement of search or evaluation is useless as long as there are errors in the basic engine function.
ZirconiumX wrote:However - LUCI now only searches to depth 5 - and that's with delta pruning.
What do you mean by "only searches to depth 5"? Does the 6th iteration take "infinitely" long? In that case, maybe you observe some kind of search explosion, caused either by bugs or by bad move ordering. Do you use MVV/LVA ordering in quiescence search (function QGen())? Moves that capture a queen should be tried before moves capturing a rook, for instance, and a pawn capturing a knight should be tried before trying a bishop capturing a knight. If your quiescence search starts with QxP (where the pawn is defended) and the enemy replies with RxN then the queen might jump all over the board capturing pawns and minor pieces without getting caught early. This can cause a search explosion where the quiescence search takes extraordinarily long in few problematic leaf positions, and you see no progress in the full search.

Sven
User avatar
hgm
Posts: 27811
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: A few things to debate for my chess engine

Post by hgm »

ZirconiumX wrote:Yup - adding an if-statement that prevented the king being captured, or a piece taking a piece of the same color did the trick.

However - LUCI now only searches to depth 5 - and that's with delta pruning.

Hmmm...

Matthew:out
So how is your move sorting?
ZirconiumX
Posts: 1334
Joined: Sun Jul 17, 2011 11:14 am

Re: A few things to debate for my chess engine

Post by ZirconiumX »

@H.G.Muller None. I have none. They are searched in the order generated.

@Sven My move generator is based on the world's slowest, most useless one. The one from FirstChess. I mean by searching to depth 5 that it runs out of time (8 seconds) to start depth 6.

The normal move generator is fine bar e.p. and castling. The capture generator is where I've had to modify some things.

Matthew:out