thomasahle / sunfish

Sunfish: a Python Chess Engine in 111 lines of code
https://www.chessprogramming.org/Sunfish
Other
2.91k stars 536 forks source link

Tempo #11

Open thomasahle opened 10 years ago

thomasahle commented 10 years ago

Sunfish currently doesn't do 'tempo'. A mate in 6 is considered the same as a mate in 1.

Ravenslofty commented 10 years ago

I have this solved in my master. d6bb441

thomasahle commented 10 years ago

Interesting. Isn't it normally implemented by always subtracting a bit from the score returned in minmax?

Ravenslofty commented 10 years ago

Nope. If you always do that then you introduce a bug where a bad move searched shallowly is favoured over a good move searched deeply.

Matthew:out

thomasahle commented 10 years ago

But it doesn't have to be a big constant. Otherwise, don't you have to do a lot of 'correcting' in the TT code, like the describe on http://chessprogramming.wikispaces.com/Checkmate ? Another approach I've thought about is to keep the global movenumber in the Position representation. Then we could make MATE_SCORE-global_ply the value of a checkmate. This might give new problems in TT though.

2014-03-13 18:16 GMT+01:00 ZirconiumX notifications@github.com:

Nope. If you always do that then you introduce a bug where a bad move searched shallowly is favoured over a good move searched deeply.

Matthew:out

— Reply to this email directly or view it on GitHubhttps://github.com/thomasahle/sunfish/issues/11#issuecomment-37559774 .

Mvh. Thomas

Ravenslofty commented 10 years ago

Search deep enough and even 1 centipawn can make a difference.

It's better to have to deal with mate scores in the TT than having to deal with false mate scores in the TT.

Matthew:out

thomasahle commented 8 years ago

Have you tried testing the engines against each other and compared results?

Recursing commented 5 years ago

A mate in 6 is considered the same as a mate in 1.

I "solve" this in my rust engine by exiting the search early on mate found, which while not correct 100% of the time is a good approximation, makes the engine appear faster and can very easily be done by making _search yield the score

thomasahle commented 1 year ago

I like the way this is done in Micromax: https://home.hccnet.nl/h.g.muller/delay.html

But I haven't found a position where it matters in the current sunfish, so I can't really test whether it improves anything.