What do you focus on to make your engine better?

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

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

Re: LMR and move ordering

Post by Evert »

cdani wrote: Results of three tests (4 seconds + 0.02):

Code: Select all

randand81019_81019noqmo_4_02b.pgn
 1 Andscacs 0.81019        147   10   10  1566   86%  -147   18%
 2 Andscacs 0.81019noqmo  -147   10   10  1566   14%   147   18%

randand81019_81019nolmr_4_02b.pgn
 1 Andscacs 0.81019         53    8    8  1542   66%   -53   34%
 2 Andscacs 0.81019nolmr   -53    8    8  1542   34%    53   34%

randand81019noqmo_81019moqmo_nolmr_4_02b.pgn
 1 Andscacs 0.81019noqmo         120    9    9  1566   80%  -120   17%
 2 Andscacs 0.81019noqmo_nolmr  -120    9    9  1566   20%   120   17%
I guess it makes sense that if you don't sort quiet moves, then not doing LMR helps you (so the third test is less of a regression than the first but more than the second). What worries me about these results though is that the draw rate is very different for the second run. I have seen that when that happens, it often means that there is something wrong with the test (not always though, but often enough that I worry when I see it). Usually the elo difference between test versions is much smaller of course, so that may be why.

What is your normal draw-rate in testing?
User avatar
cdani
Posts: 2204
Joined: Sat Jan 18, 2014 10:24 am
Location: Andorra

Re: LMR and move ordering

Post by cdani »

Evert wrote: What worries me about these results though is that the draw rate is very different for the second run. I have seen that when that happens, it often means that there is something wrong with the test (not always though, but often enough that I worry when I see it). Usually the elo difference between test versions is much smaller of course, so that may be why.

What is your normal draw-rate in testing?
The draw rate is smaller in the examples where the elo differences are bigger, because the stronger engine smashes the other version.

So draw rate is higer in the second test because the elo difference is "only" 53+53 elo.
Evert wrote: I guess it makes sense that if you don't sort quiet moves, then not doing LMR helps you (so the third test is less of a regression than the first but more than the second).
Sorry, I don't understand. Not doing LMR when there is quiet move ordering loses 53+53 elo. Not doing LMR where ther is not quiet move ordeding loses 120+120 elo.
jdart
Posts: 4366
Joined: Fri Mar 10, 2006 5:23 am
Location: http://www.arasanchess.org

Re: What do you focus on to make your engine better?

Post by jdart »

Ferdy wrote:Focus on finding bugs is one.
I second that. An engine can play legal chess and even play good moves most of the time, and still have serious bugs. In particular it is very important that all evaluation code do what you intend it to do. I just recently found a sign error in my eval function where it was applying a bonus where it should have a penalty. That code wasn't being triggered often, but still, you don't want that kind of thing. An easy test that catches some problems is to eval a position twice, once with the board flipped and side to move changed. You should get the same value (Crafty did this, ages ago, I learned this trick from it).

I also have some unit tests now that test some key engine functions (see https://github.com/jdart1/arasan-chess/ ... c/unit.cpp).

--Jon
Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: What do you focus on to make your engine better?

Post by Ferdy »

jdart wrote:
Ferdy wrote:Focus on finding bugs is one.
I second that. An engine can play legal chess and even play good moves most of the time, and still have serious bugs. In particular it is very important that all evaluation code do what you intend it to do. I just recently found a sign error in my eval function where it was applying a bonus where it should have a penalty. That code wasn't being triggered often, but still, you don't want that kind of thing. An easy test that catches some problems is to eval a position twice, once with the board flipped and side to move changed. You should get the same value (Crafty did this, ages ago, I learned this trick from it).

I also have some unit tests now that test some key engine functions (see https://github.com/jdart1/arasan-chess/ ... c/unit.cpp).

--Jon
I have already this flip position thing too. Would you explain what testIsPinned() is doing?
Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: LMR and move ordering

Post by Ferdy »

cdani wrote:I have done some basic tests to try to verify the relation between LMR and move ordering. I used different versions of Andscacs:

* andscacs081019.exe, is like 10 elo stronger than the last published version
* andscacs081019nolmr.exe, the same without lmr.
* andscacs081019noqmo.exe, the same without quiet move ordering.
* andscacs081019noqmo_nolmr.exe, the same without quiet move ordering and also without lmr.

Results of three tests (4 seconds + 0.02):

Code: Select all

randand81019_81019noqmo_4_02b.pgn
 1 Andscacs 0.81019        147   10   10  1566   86%  -147   18%
 2 Andscacs 0.81019noqmo  -147   10   10  1566   14%   147   18%

randand81019_81019nolmr_4_02b.pgn
 1 Andscacs 0.81019         53    8    8  1542   66%   -53   34%
 2 Andscacs 0.81019nolmr   -53    8    8  1542   34%    53   34%

randand81019noqmo_81019moqmo_nolmr_4_02b.pgn
 1 Andscacs 0.81019noqmo         120    9    9  1566   80%  -120   17%
 2 Andscacs 0.81019noqmo_nolmr  -120    9    9  1566   20%   120   17%
In this file there are the different executables and the resulting pgns:
http://www.andscacs.com/andscacs81019_test.zip
Nice test method. I may try this later in my engine.
I have a question on noqmo, an example if cap has move order score of 1000 (further classified into winning, equal ...), killer1 ... = 900, others = 500 and Quiet Moves move order score = 0. So something like you set it to zero. Is that what you mean in noqmo?
User avatar
cdani
Posts: 2204
Joined: Sat Jan 18, 2014 10:24 am
Location: Andorra

Re: LMR and move ordering

Post by cdani »

Ferdy wrote: I have a question on noqmo, an example if cap has move order score of 1000 (further classified into winning, equal ...), killer1 ... = 900, others = 500 and Quiet Moves move order score = 0. So something like you set it to zero. Is that what you mean in noqmo?
noqmo = no quiet move ordering. In quiet move ordering I include, so I removed in this version:

* value of history.
* penalizations for piece going back.
* killers, countermoves, and the like.
* other minor optimizations for quiets.

So after good captures, all the quiets are processed only by the inherent ordering of move generation.
Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: LMR and move ordering

Post by Ferdy »

cdani wrote:
Ferdy wrote: I have a question on noqmo, an example if cap has move order score of 1000 (further classified into winning, equal ...), killer1 ... = 900, others = 500 and Quiet Moves move order score = 0. So something like you set it to zero. Is that what you mean in noqmo?
noqmo = no quiet move ordering. In quiet move ordering I include, so I removed in this version:

* value of history.
* penalizations for piece going back.
* killers, countermoves, and the like.
* other minor optimizations for quiets.

So after good captures, all the quiets are processed only by the inherent ordering of move generation.
Thanks that is clear enough.
jdart
Posts: 4366
Joined: Fri Mar 10, 2006 5:23 am
Location: http://www.arasanchess.org

Re: What do you focus on to make your engine better?

Post by jdart »

isPinned() is a function defined in board.h. It is used to test whether a move would cause discovered check if executed, or in other words, if the piece being moved is pinned and cannot move to the specified destination square. That part of the unit test just verifies that this function works as expected: finds pins where they exist and doesn't fail in certain cases such as moves in the direction of the pin.

--Jon
Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: What do you focus on to make your engine better?

Post by Ferdy »

jdart wrote:isPinned() is a function defined in board.h. It is used to test whether a move would cause discovered check if executed, or in other words, if the piece being moved is pinned and cannot move to the specified destination square. That part of the unit test just verifies that this function works as expected: finds pins where they exist and doesn't fail in certain cases such as moves in the direction of the pin.

--Jon
Thanks.