Worst advice

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

Henk
Posts: 7220
Joined: Mon May 27, 2013 10:31 am

Re: Worst advice

Post by Henk »

hgm wrote:I guess it depends on what your threshold is for calling something complex. Search will obviously never be as simple as a "hello world" program.

Aborting the search never struck me as a problem. I just have a global 'abortFlag', and I test it directly after UnMake() to do an instant return when it is set. In King Slayer/Simple the abortFlag is only set if the search time exceeds the 'panic' limit, which is probed every 1024 nodes to not loose too much time on clock reading.
Another argument why functional programming is not practical.
Although with parallel tasks global variables give problems.
Henk
Posts: 7220
Joined: Mon May 27, 2013 10:31 am

Re: Worst advice

Post by Henk »

hgm wrote:True, but that is order of importance, which doesn't necessarily coincide with temporal order. If you start with a slow design that uses crummy algorithms, you might have painted yourself in a corner by the time you get to the speed part, and need to rewrite so much that you might as well start over again.
But you have a less detailed specification. Although it may be useless if you can't transform it into a very efficient one if necessary of course.
flok

Re: Worst advice

Post by flok »

Henk wrote:Although with parallel tasks global variables give problems.
Use an "std::atomic_bool" for your abort-flag.
Henk
Posts: 7220
Joined: Mon May 27, 2013 10:31 am

Re: Worst advice

Post by Henk »

hgm wrote:I guess it depends on what your threshold is for calling something complex. Search will obviously never be as simple as a "hello world" program.

Aborting the search never struck me as a problem. I just have a global 'abortFlag', and I test it directly after UnMake() to do an instant return when it is set. In King Slayer/Simple the abortFlag is only set if the search time exceeds the 'panic' limit, which is probed every 1024 nodes to not loose too much time on clock reading.
At this moment I already count eleven variables that affect behavior of best move search. So I don't think search is simple.
flok

Re: Worst advice

Post by flok »

I looked a bit on what there's to work on in my chess engine.

I read for example https://chessprogramming.wikispaces.com ... Extensions and I have a question. Currently I'm processing all capture-moves in quiescence search. Am I right that this may be a bit overdoing it? And that the wikipage mentioned tells me that I only need to do recaptures?
Joost Buijs
Posts: 1564
Joined: Thu Jul 16, 2009 10:47 am
Location: Almere, The Netherlands

Re: Worst advice

Post by Joost Buijs »

flok wrote:I looked a bit on what there's to work on in my chess engine.

I read for example https://chessprogramming.wikispaces.com ... Extensions and I have a question. Currently I'm processing all capture-moves in quiescence search. Am I right that this may be a bit overdoing it? And that the wikipage mentioned tells me that I only need to do recaptures?
That's indeed overdoing it, this will take an enormous amount of time.
You only have to consider captures that will lift your score above alpha.
Therefore it is useless to try captures with a negative see.
kbhearn
Posts: 411
Joined: Thu Dec 30, 2010 4:48 am

Re: Worst advice

Post by kbhearn »

all captures is almost certainly overdoing it. recaptures only might be underdoing it but would certainly cover the most common cases of why qsearch is needed (avoiding ending every line with the side to move eating the biggest piece on the board they can)

the low hanging fruit to skip:
bad captures (Qxprotected pawn at the extreme, SEE < 0 in general)
futile captures (when you're down by 3pts compared to alpha, taking a pawn is still going to fail low because the opponent will be allowed to stand pat immediately so you can avoid processing the move)
User avatar
cdani
Posts: 2204
Joined: Sat Jan 18, 2014 10:24 am
Location: Andorra

Re: Worst advice

Post by cdani »

In Andscacs in quiescence I do:

* First hash move, even if it's a quiet move.
* Then promotions to queen + captures without bad SEE ones and without futile ones.
* Then checks (in first quiescence call).

From the 5th level of quiescence I do only recaptures.
flok

Re: Worst advice

Post by flok »

Odd: if I disable quiescence-search of limit it to 1 or 2, then I get silly moves:

Code: Select all

info depth 1 seldepth 1 score cp 40 time 9 nodes 41 pv e2e4
...
info depth 6 seldepth 6 score cp 94 time 2532 nodes 165366 pv d2d4 a7a6 g1f3 d1d3
info depth 6 seldepth 6 score cp -19 time 5379 nodes 370469 pv e2e3 d7d5 d1h5 d8d6 f1b5 b8c6
info depth 7 seldepth 7 score cp 56 time 8557 nodes 593431 pv a2a3 a7a6 e2e4 a6a5 d2d4 e7e5 b1c3
info depth 7 seldepth 7 score cp 67 time 11126 nodes 767157 pv a2a3 b7b6 e2e4 c8a6 d1h5 a6f1 e1f1
Henk
Posts: 7220
Joined: Mon May 27, 2013 10:31 am

Re: Worst advice

Post by Henk »

Only advice ever (I think) that worked for Skipper is to extend search when king in check. All other never gave (easy measurable) improvements.