Soberango 0.00.0 realized.

Discussion of anything and everything relating to chess playing software and machines.

Moderators: hgm, Rebel, chrisw

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

Re: My test (Soberango 0.02.0)

Post by Sven »

Luis Babboni wrote:
Luis Babboni wrote:
Luis Babboni wrote:Is this table correct?:
http://www.e4ec.org/immr.html

king and knight vs king and knight is not tie?

Thanks!
This link do not said king + 2 knights vs king is tie but it is :(
Need to fix Soberango 0.04.0
Fixed.
Soberango 0.04.1 uploaded:
http://www.luisbtenis.com.ar/Soberango/Soberango.html
KNNK is effectively a draw in almost all cases but not a draw by FIDE rule since there are mate-in-1 positions, always caused by a blunder.
[d] 6k1/8/6K1/5NN1/8/8/8/8 w - - 0 1
White plays 1.Ne7+ or 1.Nh6+, and if Black replies 1...Kh8?? instead of 1...Kf8 then it is a mate-in-1 position.

If you really need a rule for KNNK then a rule of thumb like the following might help: it is a draw if the side with the lone king is to move, or if the lone king is not in a corner, or if the distance between both kings is greater than 2, or if the side with the knights (is to move and) can't give check.
User avatar
Luis Babboni
Posts: 464
Joined: Sat Feb 28, 2015 4:37 pm
Location: Argentina

Re: My test (Soberango 0.02.0)

Post by Luis Babboni »

I tested in Arena 3.5.1 moving Ne7 and said is tie and end the game. :?
Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: My test (Soberango 0.02.0)

Post by Sven »

Luis Babboni wrote:I tested in Arena 3.5.1 moving Ne7 and said is tie and end the game. :?
It might depend on settings. Of course it is a trivial draw, just not by FIDE rule. But a GUI might be configured to end such games immediately just in order to save time when testing engines with a large number of games.

As an engine developer you will usually deal with this kind of position during search only. There you could either ignore it completely, or apply criteria like those I mentioned above, or do something similar. At move decision level you simply do nothing since KNNK is not a draw by rule.
User avatar
Luis Babboni
Posts: 464
Joined: Sat Feb 28, 2015 4:37 pm
Location: Argentina

Re: My test (Soberango 0.02.0)

Post by Luis Babboni »

Sven Schüle wrote:
Luis Babboni wrote:I tested in Arena 3.5.1 moving Ne7 and said is tie and end the game. :?
It might depend on settings. Of course it is a trivial draw, just not by FIDE rule. But a GUI might be configured to end such games immediately just in order to save time when testing engines with a large number of games.

As an engine developer you will usually deal with this kind of position during search only. There you could either ignore it completely, or apply criteria like those I mentioned above, or do something similar. At move decision level you simply do nothing since KNNK is not a draw by rule.
Actually in the search Soberango gives 0 points to this situation and the alpha beta deal with it as with any other position with 0 points but the difference is that the tree is cuted not allowing moves after it and jump to other move at the same depth.
You say could be a mistake to do it?
Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: My test (Soberango 0.02.0)

Post by Sven »

Luis Babboni wrote:
Sven Schüle wrote:
Luis Babboni wrote:I tested in Arena 3.5.1 moving Ne7 and said is tie and end the game. :?
It might depend on settings. Of course it is a trivial draw, just not by FIDE rule. But a GUI might be configured to end such games immediately just in order to save time when testing engines with a large number of games.

As an engine developer you will usually deal with this kind of position during search only. There you could either ignore it completely, or apply criteria like those I mentioned above, or do something similar. At move decision level you simply do nothing since KNNK is not a draw by rule.
Actually in the search Soberango gives 0 points to this situation and the alpha beta deal with it as with any other position with 0 points but the difference is that the tree is cuted not allowing moves after it and jump to other move at the same depth.
You say could be a mistake to do it?
No, it is ok. You can assign a draw score (e.g. 0) to all KNNK positions, and that will be fine in more than 99.99% of all cases. Or you can try to be even more accurate by taking care of the "mate-in-1" special case, with rules like those I mentioned above.
User avatar
hgm
Posts: 27796
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: My test (Soberango 0.02.0)

Post by hgm »

A more subtle way to address it is reduce the depth to 1 ply in KNNK, when it was higher, but evaluate it as 0 at depth = 0. Then you won't miss the mate-in-1 positions.
User avatar
Luis Babboni
Posts: 464
Joined: Sat Feb 28, 2015 4:37 pm
Location: Argentina

Re: My test (Soberango 0.02.0)

Post by Luis Babboni »

Thanks guys! :wink:
User avatar
Luis Babboni
Posts: 464
Joined: Sat Feb 28, 2015 4:37 pm
Location: Argentina

Re: My test (Soberango 0.02.0)

Post by Luis Babboni »

I´m working on it.

May be cause the way I programmed Soberango or my capabilities, is not easy for me to do the last Sven rule:
"if the side with the knights (is to move and) can't give check."

HG´s seems easier but I think Soberango is still not ready to do it.
Please say me if I understand the idea correctly because I do not understand the last two parts you said:
"when it was higher" and "but evaluate it as 0 at depth = 0"
You say that if at some depth of the search Soberango found a KNNK position with KNN side to move, I could give 0 points to it but add one more ply after it to look if there is a checkmate?
The problem for me is that actually Soberango just use fixed depth search (your idea is to do something like a quiesense search do prolonguing one more ply here as if it is a capture situation that quiesense search meed to increase the depth?Sorry if I say a nonsense, I still not sure what quiesense search is! :oops: )
In fact to know that is a checkmate, Soberango needs even one more ply cause it detects a chechmate just seeing a side is in check with not possible moves to do.

If I understood correctly it seems I have to wait to develop more Soberango to aply HS´s suggestion and for the moment aply just 3 first Sven rules.... or fight sometime to try to add the 4th Seven´s rule too.

Thanks for your time people!! :D
User avatar
Luis Babboni
Posts: 464
Joined: Sat Feb 28, 2015 4:37 pm
Location: Argentina

Re: My test (Soberango 0.02.0)

Post by Luis Babboni »

Decided!
I will make my own little "tablebase" for KNNK when lone king is in a corner, kings distance is less than 3 and is not lone king turn to move.
I think it will have just 720 positions (surely could be less using simetries)
User avatar
hgm
Posts: 27796
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: My test (Soberango 0.02.0)

Post by hgm »

Normally Chess engines pass the (requested) remaining depth to the recursive Search() routine. That does not exclude you have a fixed-depth search; in that case a call Search(d) would always make calls to Search(d-1), unless d=0, in which case it would return the static evaluation as score. This is more flexible than keeping a 'ply' counter that tracks how far you are from the root, (and compare that to a fixed maximum), as at any point along a branch you could decide you want to search that particular branch deeper (e.g. if you are in check there) or less deep.

In this context, what I am saying is that when there is a call to Search with remaining depth >= 1, but the side to move has KNNK, you should make it act like the remaining depth = 1. If the remaining depth was 0, you would normally return the static eval (something like +600 or -600), but instead you would return 0.

This assumed that remaining depth = 1 would be enough to see a mate in 1. (E.g. because at d=0 you would detect you are in check, and in that case not return the static evaluation, but search an extra ply ('check extension') to make sure you can get out of check, and if you cannot, return the score for being checkmated.) If you need higher depth to detect mate in 1, because you do not do check extensions or do not detect whether you are in check when the remaining depth = 0, the idea reains the same, but you would have to replace the '1' in it by the depth you would need to recognize mate in 1. The whole idea can be worded as "when in KNNK, if you cannot deliver mate in 1, it is a draw".

In most of my engines my Search() routine first tests if it can capture the King (and when it can, it immediately returns a +INFINITY score, making sure that the parent node will consider the move leading to the current position not better than resigning). Then I test if the opponent would be able to capture my King, if he were on move (which he is not). If he can, I am in check. Then I add 1 to the requested depth, to make sure I never stop searching when in check. If after that the requested remaining depth equals 0, I would in any case not search any non-captures, but just assume that one of those would be as good as the current static evaluation of the position. I would not assume I could do any better than that unless actual search of a capture would prove that the opponent had left some material up for grabs (QS).