Improve IvanHoe?

Code, algorithms, languages, construction...
ThinkingALot
Posts: 144
Joined: Sun Jun 13, 2010 7:32 am
Contact:

Re: Improve IvanHoe?

Post by ThinkingALot » Sat Jul 02, 2011 8:26 am

Btw, there's a small bug in Ivanhoe (fixed in Houdini) which probably costs less than 5 ELO: (in low search)

Code: Select all

if (depth <= 3 && POS0->Value + 4 * depth < VALUE) {
    NextMove->phase = TRANS3;
    NextMove->mask = (VALUE - POS0->Value) + 4 * depth + 5;
}
It's probably meant to be NextMove->mask = (VALUE - POS0->Value) - 4 * depth + 5.
Peterpan wrote:I am not a chess programmer,just a baby,but if/when i write a chess engine or modify Ivanhoe i will not use this way you have described in your post.
It depends on the idea in question. If one, say, managed to spot the LMR idea in some open source program it'd be very difficult to "forget" it. Because the idea itself is very simple and not "code dependent", i.e. it can be implemented in many ways. So one'd have a choice between deliberately making one's engine weaker and employing the idea:).

mcostalba
Posts: 91
Joined: Thu Jun 10, 2010 11:45 pm
Real Name: Marco Costalba

Re: Improve IvanHoe?

Post by mcostalba » Sat Jul 02, 2011 8:57 am

Richard Vida wrote: And if you really want to play it safe, this can be further enhanced. In my experiments (with Critter, IPPO* behavior may be different - YMMV) I tried to restrict this cut-off with several other conditions:
a) no pawns at 7th rank
b) no queen capture is possible
c) no mate threat (in IPPO framework this information is not available, I think)
d) king safety of the side to move did not worsen relative to the previous ply
.

I won't tell which combination is the best - test yourself :)
In Stockfish razoring is always done after TT lookup, and, further, we do a qsearch() before returning, just to be sure, so I think points a) b) c) are already covered, instead condition d) is new and I will think about it.

The only place where we blindly return without even a qsearch() is the static null move pruning, in this case we return when we are much above beta, so conditions should be reversed, namely opponents has no pawns at 7th rank, good king safety, and so on...

mcostalba
Posts: 91
Joined: Thu Jun 10, 2010 11:45 pm
Real Name: Marco Costalba

Re: Improve IvanHoe?

Post by mcostalba » Sat Jul 02, 2011 9:07 am

ThinkingALot wrote:Recently I ran several tests of Stockfish's history pruning (futility_move_count). It appears that this feature makes the engine perform better at fixed depth controls. However when the prunings are turned off the engine reaches the same depth a bit faster. There are also some reasons to believe (without sufficient statistical basis yet) that the ELO boost provided by history prunings is greater at greater depths. Therefore it may be useful to use history prunings in Ivanhoe, especially in low and cut nodes.

P.S. The easiest way of improving Ivanhoe: disassemble Houdini (relatively easy) and copy its ideas :).
One thing that makes me go mad about current move count based pruning formula:

Code: Select all

          // Move count based pruning
          if (   moveCount >= futility_move_count(depth)
              && (!threatMove || !connected_threat(pos, move, threatMove))
              && bestValue > VALUE_MATED_IN_PLY_MAX) 
          {
              continue;
          }
is that it does NOT take in account the position evaluation, if we reach the move count limit for that depth we return independently if position evaluation is very low, good or even very above beta. This is _proved_ wrong because I have made some statistical tests disabling the pruning end checking afterwards if the "would be pruned" moves make a cut-off and so pruning would have been an error. I measured much more "pruning errors" when position evaluation is high instead of low. Also in all the Ippo* friends move count pruning is strictly bounded with position evaluation, nevertheless I was _never_ able to succeed in including evaluation in the above formula, all my attempts failed and were weaker than current implementation...this is something that really makes me go mad !

ThinkingALot
Posts: 144
Joined: Sun Jun 13, 2010 7:32 am
Contact:

Re: Improve IvanHoe?

Post by ThinkingALot » Sat Jul 02, 2011 10:08 am

mcostalba wrote:this is something that really makes me go mad !
Me too:). Magical prunings :).
I think there's a great opportunity for improving modern engines in combining
(1) such history based prunings
(2) cut/all approach from ippolit
Any tactical threat, even if a refutation is available, is likely to cause a research in PV mode!

However combining (1) and (2) is quite a challenging task. For now I failed to receive any ELO gain from this idea... The trick is to make these PV researches consume as little additional time as possible.

mcostalba
Posts: 91
Joined: Thu Jun 10, 2010 11:45 pm
Real Name: Marco Costalba

Re: Improve IvanHoe?

Post by mcostalba » Sat Jul 02, 2011 12:12 pm

ThinkingALot wrote:
mcostalba wrote:this is something that really makes me go mad !
Me too:). Magical prunings :).
I think there's a great opportunity for improving modern engines in combining
(1) such history based prunings
(2) cut/all approach from ippolit
Any tactical threat, even if a refutation is available, is likely to cause a research in PV mode!

However combining (1) and (2) is quite a challenging task. For now I failed to receive any ELO gain from this idea... The trick is to make these PV researches consume as little additional time as possible.
I don't believe a lot in cut/all approach, in my point of view, all nodes that still do not cut-off after the first 3-4 moves are ALL nodes, so if a difference has to be exploited it should be found in a different approach at the very first moves of a node, otherwise you can apply ALL parameters everywhere and it should already be the best you can do.

We have tried in the past with some ALL/CUT approach but with no success at all, in the best case it was a same strength change.

veritas
Posts: 111
Joined: Thu Jun 16, 2011 2:35 pm

Re: Improve IvanHoe?

Post by veritas » Sat Jul 02, 2011 2:05 pm

Peterpan wrote:hi ThinkingAlot

Yes one could do that,well not anyone,but people familiar with this kind of thing... and for them i assume it would be relatively easy to do so.
But this will make us no better than them (the ones accused of stealing segments of code and ideas from for example Fruit and Crafty.And then others stealing from and Ivanhoe & Robbolito and calling it their own)
I am not a chess programmer,just a baby,but if/when i write a chess engine or modify Ivanhoe i will not use this way you have described in your post.
I will use ideas available openly and create new ideas,not walk in the shadow of others and this way keep my integrity.

Although one may say then what if the ideas were stolen by others by reverse engineering and posted on the web as open now for anyone to use...?? this is a whole new debate and then this thing gets complicated ;)

computer chess is getting too complicated now :)
to be to proud to investigate houdini condemns to ignorance...in the politest sense
of lacking knowledge

one does not have to do a Vas or kranium and simply copy and paste what is discovered, simply to see why houdini is so fast and has such end game knowledge ( Those are key )then use the knowledge gained to implement your own interpretation of them will lift you from struggling forever to having an engine at least capable if a level playing field with houdini
houdart used ippolits codes and made use of the best ideas others had implemented before him and very likely did add his own touches m he should be congratulated for that but punished for never fully crediting those he plagiarized , not punished with bans that are to him ( unlike rybka's )meaningless and ineffectual but by haveing the same game played on him and leveling the playing board

Jesse Roden song...." Reason to change "
includes lyrics ,,,,"Dont be so damn proud !"

veritas
Posts: 111
Joined: Thu Jun 16, 2011 2:35 pm

Re: Improve IvanHoe?

Post by veritas » Sat Jul 02, 2011 2:05 pm

Peterpan wrote:hi ThinkingAlot

Yes one could do that,well not anyone,but people familiar with this kind of thing... and for them i assume it would be relatively easy to do so.
But this will make us no better than them (the ones accused of stealing segments of code and ideas from for example Fruit and Crafty.And then others stealing from and Ivanhoe & Robbolito and calling it their own)
I am not a chess programmer,just a baby,but if/when i write a chess engine or modify Ivanhoe i will not use this way you have described in your post.
I will use ideas available openly and create new ideas,not walk in the shadow of others and this way keep my integrity.

Although one may say then what if the ideas were stolen by others by reverse engineering and posted on the web as open now for anyone to use...?? this is a whole new debate and then this thing gets complicated ;)

computer chess is getting too complicated now :)
to be to proud to investigate houdini condemns to ignorance...in the politest sense
of lacking knowledge

one does not have to do a Vas or kranium and simply copy and paste what is discovered, simply to see why houdini is so fast and has such end game knowledge ( Those are key )then use the knowledge gained to implement your own interpretation of them will lift you from struggling forever to having an engine at least capable if a level playing field with houdini
houdart used ippolits codes and made use of the best ideas others had implemented before him and very likely did add his own touches m he should be congratulated for that but punished for never fully crediting those he plagiarized , not punished with bans that are to him ( unlike rybka's )meaningless and ineffectual but by having the same game played on him and leveling the playing board

Jesse Roden song...." Reason to change "
includes lyrics ,,,,"Dont be so damn proud !"

User avatar
Ubaldo Andrea Farina
Posts: 6
Joined: Sun Jul 03, 2011 5:53 pm
Real Name: Ubaldo Andrea Farina

Re: Improve IvanHoe?

Post by Ubaldo Andrea Farina » Sun Jul 03, 2011 6:42 pm

Richard Vida wrote:
BB+ wrote:
Richard Vida wrote:Is this question addressed purely to Mark (BB+)? Or is others contribution welcomed too?
This question is more than a year old! I just bumped it because there was a bit of TalkChess discussion over what I meant regarding Rajlich's contribution. Feel free to express any opinions for improvement (including banal ones like: "change the name").
And if you really want to play it safe, this can be further enhanced. In my experiments (with Critter, IPPO* behavior may be different - YMMV) I tried to restrict this cut-off with several other conditions:
a) no pawns at 7th rank
b) no queen capture is possible
c) no mate threat (in IPPO framework this information is not available, I think)
d) king safety of the side to move did not worsen relative to the previous ply
.

I won't tell which combination is the best - test yourself :)
I also tried using the king safety together with the other conditions but there was no improvement. Does it make a difference for you? BTW I also don't directly return the score but I call the quiescence first.

BB+
Posts: 1484
Joined: Thu Jun 10, 2010 4:26 am

Re: Improve IvanHoe?

Post by BB+ » Mon Jul 04, 2011 6:21 am

In IPPOLIT sources in 'low_depth' search there was a possibility to return immediately with SCOUT-1 when the EVAL is much bellow SCOUT (> value of queen). This test was done *before* hash table lookup.
The R3 behaviour is a bit different (it returns something else, and there's also another pre-hash [indeed, pre-repetition] test), but indeed R3 has this before hash table lookup.
The trick is to make these PV researches consume as little additional time as possible.
My recollection is that various schemes (maybe even in Fruit/Toga) tried to first re-search at a slightly lower depth. I have no idea if that was beneficial.

Quocvuong82
Posts: 14
Joined: Sat Mar 05, 2011 8:32 am
Real Name: Quocvuong82

Re: Improve IvanHoe?

Post by Quocvuong82 » Fri Jul 08, 2011 11:00 am

Speed-up: +10 ELO
Improve Eval: + 30 ELO
Improve Search, Pruning, ...: + 30 ELO
Fix-bugs: +30 ELO
-------------------------------------------------
Total = 100 ELO.
:D :o :shock:

Post Reply