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

A few things to debate for my chess engine

Post by ZirconiumX »

Number 1:
Do I make my nullmove all-powerful and watch it play rubbishly in the endgame etc, or do I make my Futility Pruning all-powerful and starve nullmove of nodes?

Number 2:
Play well, and slowly, or play rubbishly, but go extremely fast.

Number 3:
Evaluation (ATM I only have PSTs, and mobility made it bring out it's queen on move 2..) or Search (Alpha-Beta, has no move ordering as I'm not sure how to implement it, Futility, Extended Futility, Limited Razoring, Nullmove, LMR, Some extensions, FHR and some other stuff)?

Number 4:
Blog (lucichess.blogspot.com ) or Tinker?

Matthew:out
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: A few things to debate for my chess engine

Post by Evert »

ZirconiumX wrote:Number 1:
Do I make my nullmove all-powerful and watch it play rubbishly in the endgame etc, or do I make my Futility Pruning all-powerful and starve nullmove of nodes?
I think Bob Hyatt reported that, in Crafty, it hurts to not do null-move everywhere. I may be misremembering the exact details.
Anyway, the answer is that you tune for optimal playing strength, so you look for the middle-ground (and then find heuristics that let you avoid the middle-ground and be more agressive with your pruning).
Number 2:
Play well, and slowly, or play rubbishly, but go extremely fast.
Not sure what you mean, but again: you tune for optimal playing strength.
Number 3:
Evaluation (ATM I only have PSTs, and mobility made it bring out it's queen on move 2..) or Search (Alpha-Beta, has no move ordering as I'm not sure how to implement it, Futility, Extended Futility, Limited Razoring, Nullmove, LMR, Some extensions, FHR and some other stuff)?
You need both (by the way, move ordering is a must-have).
Again, you tune for optimal playing strength.
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 »

ZirconiumX wrote:Number 1:
Do I make my nullmove all-powerful and watch it play rubbishly in the endgame etc, or do I make my Futility Pruning all-powerful and starve nullmove of nodes?

Number 2:
Play well, and slowly, or play rubbishly, but go extremely fast.

Number 3:
Evaluation (ATM I only have PSTs, and mobility made it bring out it's queen on move 2..) or Search (Alpha-Beta, has no move ordering as I'm not sure how to implement it, Futility, Extended Futility, Limited Razoring, Nullmove, LMR, Some extensions, FHR and some other stuff)?

Number 4:
Blog (lucichess.blogspot.com ) or Tinker?

Matthew:out
For question one, sounds like you need to tune your null-move search a bit. You certainly don't want to try it in a pawn-only endgame, as null-move will completely hide zugzwang and cause you to play poorly. Turn it off when no pieces are left. However, that is not cautious enough, as with just a knight, you still see lots of zugzwang positions, and null-move fails because not moving should NEVER be better than making a move, yet in zugzwang that is exactly what happens, and null-move breaks the search.

I'd solve those issues first, as I don't see any issues related to null-move hurting endgames in my program. Just remember that if zugzwang is possible, so are errors. The benefits far outweigh the costs, if it is done carefully.
User avatar
lucasart
Posts: 3232
Joined: Mon May 31, 2010 1:29 pm
Full name: lucasart

Re: A few things to debate for my chess engine

Post by lucasart »

ZirconiumX wrote:Number 1:
Do I make my nullmove all-powerful and watch it play rubbishly in the endgame etc, or do I make my Futility Pruning all-powerful and starve nullmove of nodes?

Number 2:
Play well, and slowly, or play rubbishly, but go extremely fast.

Number 3:
Evaluation (ATM I only have PSTs, and mobility made it bring out it's queen on move 2..) or Search (Alpha-Beta, has no move ordering as I'm not sure how to implement it, Futility, Extended Futility, Limited Razoring, Nullmove, LMR, Some extensions, FHR and some other stuff)?

Number 4:
Blog (lucichess.blogspot.com ) or Tinker?

Matthew:out
Starting from a basic PVS algorithm, with simple eval (material + pst), you'll find null move is a massive improvement. Probably 150 elo alone, at least.

null move doesn;'t make it play rubbish in the endgame. I don't know on what basis you say that. perhaps you implemented incorrectly your null move ? I don't do nullmove when the side to play has no pieces, to avoid zugzwang. More refined programs to a null move verification search.

futility pruning on the other hand, and razoring improve very little, and make your program tactically weaker. Futility pruning is probably not worth much elo on its own.
User avatar
lucasart
Posts: 3232
Joined: Mon May 31, 2010 1:29 pm
Full name: lucasart

Re: A few things to debate for my chess engine

Post by lucasart »

bob wrote:
ZirconiumX wrote:Number 1:
Do I make my nullmove all-powerful and watch it play rubbishly in the endgame etc, or do I make my Futility Pruning all-powerful and starve nullmove of nodes?

Number 2:
Play well, and slowly, or play rubbishly, but go extremely fast.

Number 3:
Evaluation (ATM I only have PSTs, and mobility made it bring out it's queen on move 2..) or Search (Alpha-Beta, has no move ordering as I'm not sure how to implement it, Futility, Extended Futility, Limited Razoring, Nullmove, LMR, Some extensions, FHR and some other stuff)?

Number 4:
Blog (lucichess.blogspot.com ) or Tinker?

Matthew:out
For question one, sounds like you need to tune your null-move search a bit. You certainly don't want to try it in a pawn-only endgame, as null-move will completely hide zugzwang and cause you to play poorly. Turn it off when no pieces are left. However, that is not cautious enough, as with just a knight, you still see lots of zugzwang positions, and null-move fails because not moving should NEVER be better than making a move, yet in zugzwang that is exactly what happens, and null-move breaks the search.

I'd solve those issues first, as I don't see any issues related to null-move hurting endgames in my program. Just remember that if zugzwang is possible, so are errors. The benefits far outweigh the costs, if it is done carefully.
That's a very good and accurate summary. From experience I fully agree.

Regarding the null move implementation, I suggest you look at Fruit. In particular Fruit does a null move only when the static eval fails high. There are certainly many other ways to do it, but this one is simple and very good. In particular it ensures that no 2 null move can be played in a row.

I first misimplemented my nullmove and had problems where 2 Null Moves vcould be played consecutively: that will screw up your search completely!
User avatar
lucasart
Posts: 3232
Joined: Mon May 31, 2010 1:29 pm
Full name: lucasart

Re: A few things to debate for my chess engine

Post by lucasart »

also study well your move ordering!

it's worth spending time making statistics on which moves produce cutoffs, and run a test suite, until you reach depth with less and less nodes.
User avatar
hgm
Posts: 27788
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 »

lucasart wrote:I first misimplemented my nullmove and had problems where 2 Null Moves vcould be played consecutively: that will screw up your search completely!
How can that be? It is just a recursive implementation of Internal Iterative Deepening.

Micro-Max does an unlimited number of null-moves in a row, and it doesn't seem to hurt it.
ZirconiumX
Posts: 1334
Joined: Sun Jul 17, 2011 11:14 am

Re: A few things to debate for my chess engine

Post by ZirconiumX »

Right - Results

TT - It worked for Magic but is sh... in LUCI (in 3ms it does 1 ply, and triggers GDB when it gets to ply 2)

Nullmove - Normal parameter at the function call (fails to complete ply 1)
Fruit fail-high Nullmove also fails to complete ply 1, verified nullmove also fails to complete ply 1.

No Nullmove or TT - Fails to complete ply 1...

Hmmmm... (I think it may be the generator)

Matthew:out
tpetzke
Posts: 686
Joined: Thu Mar 03, 2011 4:57 pm
Location: Germany

Re: A few things to debate for my chess engine

Post by tpetzke »

Micro-Max does an unlimited number of null-moves in a row, and it doesn't seem to hurt it.
but probably not 2 in a row consecutively, because that means you were back to the position you started from just 2 plys deeper.

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

Re: A few things to debate for my chess engine

Post by ZirconiumX »

Last problem fixed - I'd been a bit too zealous with block comments and commented out the bit that calls the move generator.

Matthew:out