Taming the Tiger :-)

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

Moderators: hgm, Harvey Williamson, bob

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
User avatar
tiger
Posts: 819
Joined: Sat Mar 11, 2006 2:15 am
Location: Guadeloupe (french caribbean island)
Contact:

Re: Taming the Tiger :-)

Post by tiger » Fri Apr 22, 2011 1:46 am

Sean Evans wrote:
tiger wrote: I'm not so sure about the material value. I guess it must be done by breaking down the material into queens, major pieces and minor pieces. Gambit Tiger cannot do much without its queen for example. // Christophe
The Queen is a major piece. Best not to think that way, a computer program can be very aggressive if it has two minors pieces, especially both bishops.

You have to trust the aggressive programming in GT to unnerve human opponents. If you over quantify MV, then [[Goto GT]] will not occur as often and be less effective. Even if there is not much material left on the board GT and CT would probably see similar moves, especially if they both reach the TBs, so a MINVALUE for MV is not overly important; it is the MAXVALUE for MV; i.e. when GT starts and kicks the game into high gear throwing the human into a blunder especially on short time controls.

Any way good luck with your decision.

Cordially,

Sean

Mmh... I think you are right.


// Christophe

User avatar
Eelco de Groot
Posts: 4133
Joined: Sun Mar 12, 2006 1:40 am
Location: Groningen

Re: Taming the Tiger :-)

Post by Eelco de Groot » Fri Apr 22, 2011 9:20 am

tiger wrote:
Sean Evans wrote:
tiger wrote: OK, it deserves a try. Meanwhile, you are free to test it manually. One thing I will have to decide is this: if there is little material left, switching to the aggressive mode will not work anyway. Where should I draw the line? Maybe you can help by testing manually?// Christophe
One idea would be to have a combined formula for both Material Value (MV) and Eval Level (EL), example:

IF [(MV>15 points) and (EL<-2.00)] then [Goto GT]

Cordially,

Sean :)

I agree with the general formula.

Evaluation below -2 sounds about right.

I'm not so sure about the material value. I guess it must be done by breaking down the material into queens, major pieces and minor pieces.

Gambit Tiger cannot do much without its queen for example.

That's where I could use help from you, the users: here we are dealing with human opposition. I cannot do any automatic testing and would need to play all games myself, manually. This could take a long time and would maybe work just against me, not against other players.

An interesting feature, but that could be very tricky to implement well.


// Christophe

Hi guys, not my thread but just as a comment: Christophe maybe you could test it with engines anyway, when lacking the human guinea pigs on Guadeloupe? Gambit Tiger I remember was not weaker that much than the normal Tiger, I remember there was some list where it even did better than the classic Tiger. In engine games there probably is a higher eval treshold where the game is lost, assuming the engines make fewer mistakes. Then all you have to do is find a treshold where it does not matter much whether it is Gambit Tiger or Tiger playing. May be well above a lost position. And below that threshold you may get a surprise effect against humans. But you wonder if Gambit Tiger is not doing better against humans anyway, and you need to come up with a real suicidal mode to do even better against humans than Gambit Tiger. Possibly you could use the same treshold against humans but increase all the positional values for maximum surprise effect. And in engine play you would use the same treshold but only use Gambit Tiger below it.

Anyway, in Rainbow Serpent I was going in the other direction, trying not starting a King attack if this hurts other positional features. The idea is that it does not matter much if you own King Safety is lowered, as long as your opponent's King safety gets even worse. But if at the same time other positional features are also sacrificed, you create multiple weaknesses, that you can not repair anymore if the attack is too weak to succeed. You do something of the same in a Gambit Tiger setting if it is not just King Safety that is increased, you include other positional features. Also I think if an attack is not sufficient to mate the opponent, but material is invested, it is the endgame after the attack or aborted attack that is important so in some way it would be good to include more endgame features also. I have not yet figured out what is a good way to do that.

Not anything fancy, just making some terms dependant on each other instead of just adding them. At the moment it is just a few lines that I have changed in Rainbow Serpent, I store the King safety for both sides instead of adding them directly to the score and when the other eval terms have been collected I add a correction term/factor that simply is the sum of the other eval terms, from White's viewpoint, to counter the increased weight of King Safety, if the position suffers from choosing a King attack this correction factor should go down and hopefully the King attack would be aborted before too much damage is done.

Code: Select all

  // Evaluate kings after all other pieces because we need complete attack
  // information when computing the king safety evaluation.
  bonus +=  evaluate_king<WHITE, HasPopCnt>&#40;pos, ei, margins&#41;
          - evaluate_king<BLACK, HasPopCnt>&#40;pos, ei, margins&#41;;
is changed to, after changing the return type of evaluate_king to Value instead of Score:

Code: Select all

  // Evaluate kings after all other pieces because we need complete attack
  // information when computing the king safety evaluation.
  whiteKingSafety =  evaluate_king<WHITE, HasPopCnt>&#40;pos, ei, margins&#41;;
  blackKingSafety =  evaluate_king<BLACK, HasPopCnt>&#40;pos, ei, margins&#41;;
And then at the end I have now something like this:

Code: Select all

  // King safety is corrected with the rest of the evaluation and then added to the score.
  if &#40;whiteKingSafety || blackKingSafety&#41;
  &#123;
	  Value evalCorrection = mg_value&#40;bonus&#41;/&#40;10&#41;;
	  
	  Value w = (&#40;0x250 + evalCorrection - &#40;blackKingSafety/0x30&#41;) * whiteKingSafety&#41;/0x100;
	  
	  bonus += make_score&#40;w, 0&#41;; //was&#58; apply_weight&#40;make_score&#40;w, 0&#41;, Weights&#91;KingDangerUs + WHITE&#93;);
	  
	  w = (&#40;0x250 - evalCorrection - &#40;whiteKingSafety/0x30&#41;) * blackKingSafety&#41;/0x100; // + &#40;whiteKingSafety/0x30&#41; introduces color-asymmetry
	  
	  bonus -= make_score&#40;w, 0&#41;; //apply_weight&#40;make_score&#40;w, 0&#41;, Weights&#91;KingDangerUs + BLACK&#93;);
	  
	  bonus += make_score&#40;&#40;mg_value&#40;bonus&#41;>>6&#41; * &#40;abs&#40;eg_value&#40;bonus&#41;)>>6&#41;,&#40;eg_value&#40;bonus&#41;>>6&#41; * &#40;abs&#40;eg_value&#40;bonus&#41;)>>6&#41;); // introduces side to move asymmetry, when eg_value is negative and mg_value positive the formula is wrong and not mirrored between the two sides, but maybe it is a feature, not a bug.	  
  &#125;
Eelco
Debugging is twice as hard as writing the code in the first
place. Therefore, if you write the code as cleverly as possible, you
are, by definition, not smart enough to debug it.
-- Brian W. Kernighan

User avatar
Eelco de Groot
Posts: 4133
Joined: Sun Mar 12, 2006 1:40 am
Location: Groningen

correction Re: Taming the Tiger :-)

Post by Eelco de Groot » Fri Apr 22, 2011 9:49 am

If negative king safety is seen as logical false

Code: Select all

  // King safety is corrected with the rest of the evaluation and then added to the score. 
  if &#40;whiteKingSafety || blackKingSafety&#41; 
  &#123;
should probably be:

Code: Select all

  // King safety is corrected with the rest of the evaluation and then added to the score.
  if &#40;whiteKingSafety != VALUE_ZERO || blackKingSafety != VALUE_ZERO&#41;
  &#123;
Eelco
Debugging is twice as hard as writing the code in the first
place. Therefore, if you write the code as cleverly as possible, you
are, by definition, not smart enough to debug it.
-- Brian W. Kernighan

User avatar
tiger
Posts: 819
Joined: Sat Mar 11, 2006 2:15 am
Location: Guadeloupe (french caribbean island)
Contact:

Re: Taming the Tiger :-)

Post by tiger » Sat Apr 23, 2011 1:02 am

Eelco de Groot wrote:
tiger wrote:
Sean Evans wrote:
tiger wrote: OK, it deserves a try. Meanwhile, you are free to test it manually. One thing I will have to decide is this: if there is little material left, switching to the aggressive mode will not work anyway. Where should I draw the line? Maybe you can help by testing manually?// Christophe
One idea would be to have a combined formula for both Material Value (MV) and Eval Level (EL), example:

IF [(MV>15 points) and (EL<-2.00)] then [Goto GT]

Cordially,

Sean :)

I agree with the general formula.

Evaluation below -2 sounds about right.

I'm not so sure about the material value. I guess it must be done by breaking down the material into queens, major pieces and minor pieces.

Gambit Tiger cannot do much without its queen for example.

That's where I could use help from you, the users: here we are dealing with human opposition. I cannot do any automatic testing and would need to play all games myself, manually. This could take a long time and would maybe work just against me, not against other players.

An interesting feature, but that could be very tricky to implement well.


// Christophe

Hi guys, not my thread but just as a comment: Christophe maybe you could test it with engines anyway, when lacking the human guinea pigs on Guadeloupe? Gambit Tiger I remember was not weaker that much than the normal Tiger, I remember there was some list where it even did better than the classic Tiger.

The "classical" Gambit Tiger is probably 30 elo points below Chess Tiger, which is not bad.

But in more recent versions I have slightly increased the aggressivity and speculative terms, which results in an even bigger elo difference.


In engine games there probably is a higher eval treshold where the game is lost, assuming the engines make fewer mistakes.

Actually I believe it's the opposite. Between computers, a score below -1.5 often results in a lost game and a score above +1.5 often ends in a win. There was a time I would even adjudicate games at +/-2.5 because between computers the outcome was practically already known.

I tend to think that against humans the thresold would be higher, at least +/-2, because they do more mistakes: this add noise to the statistics and you would get more games won from a -2 position and more games lost from a +2 position.


Then all you have to do is find a treshold where it does not matter much whether it is Gambit Tiger or Tiger playing. May be well above a lost position. And below that threshold you may get a surprise effect against humans. But you wonder if Gambit Tiger is not doing better against humans anyway, and you need to come up with a real suicidal mode to do even better against humans than Gambit Tiger. Possibly you could use the same treshold against humans but increase all the positional values for maximum surprise effect. And in engine play you would use the same treshold but only use Gambit Tiger below it.


The idea sounds correct and should be tested: if I find a significant thresold (but not too desesperate) where switching to Gambit mode does not lower significantly the elo rating against computers, then it has real chances to be effective against human players, yes.

The threshold condition has to be paired with a condition about the material left on the board. If the switch always happens in the late middlegame of in the endgame, it means nothing. If the switch can happen before or in the middlegame and still no big loss in elo is measured, bingo, it works.

I'm simplifiying here, as the condition on material left has to be a little bit smarter and take into account the ability to mount an attack. As I said, without the queen the potential is already greatly reduced. So some queenless middlegames would not apply for a switch to Gambit mode.

Anyway, in Rainbow Serpent I was going in the other direction, trying not starting a King attack if this hurts other positional features. The idea is that it does not matter much if you own King Safety is lowered, as long as your opponent's King safety gets even worse. But if at the same time other positional features are also sacrificed, you create multiple weaknesses, that you can not repair anymore if the attack is too weak to succeed. You do something of the same in a Gambit Tiger setting if it is not just King Safety that is increased, you include other positional features. Also I think if an attack is not sufficient to mate the opponent, but material is invested, it is the endgame after the attack or aborted attack that is important so in some way it would be good to include more endgame features also. I have not yet figured out what is a good way to do that.

Not anything fancy, just making some terms dependant on each other instead of just adding them. At the moment it is just a few lines that I have changed in Rainbow Serpent, I store the King safety for both sides instead of adding them directly to the score and when the other eval terms have been collected I add a correction term/factor that simply is the sum of the other eval terms, from White's viewpoint, to counter the increased weight of King Safety, if the position suffers from choosing a King attack this correction factor should go down and hopefully the King attack would be aborted before too much damage is done.

Code: Select all

  // Evaluate kings after all other pieces because we need complete attack
  // information when computing the king safety evaluation.
  bonus +=  evaluate_king<WHITE, HasPopCnt>&#40;pos, ei, margins&#41;
          - evaluate_king<BLACK, HasPopCnt>&#40;pos, ei, margins&#41;;
is changed to, after changing the return type of evaluate_king to Value instead of Score:

Code: Select all

  // Evaluate kings after all other pieces because we need complete attack
  // information when computing the king safety evaluation.
  whiteKingSafety =  evaluate_king<WHITE, HasPopCnt>&#40;pos, ei, margins&#41;;
  blackKingSafety =  evaluate_king<BLACK, HasPopCnt>&#40;pos, ei, margins&#41;;
And then at the end I have now something like this:

Code: Select all

  // King safety is corrected with the rest of the evaluation and then added to the score.
  if &#40;whiteKingSafety || blackKingSafety&#41;
  &#123;
	  Value evalCorrection = mg_value&#40;bonus&#41;/&#40;10&#41;;
	  
	  Value w = (&#40;0x250 + evalCorrection - &#40;blackKingSafety/0x30&#41;) * whiteKingSafety&#41;/0x100;
	  
	  bonus += make_score&#40;w, 0&#41;; //was&#58; apply_weight&#40;make_score&#40;w, 0&#41;, Weights&#91;KingDangerUs + WHITE&#93;);
	  
	  w = (&#40;0x250 - evalCorrection - &#40;whiteKingSafety/0x30&#41;) * blackKingSafety&#41;/0x100; // + &#40;whiteKingSafety/0x30&#41; introduces color-asymmetry
	  
	  bonus -= make_score&#40;w, 0&#41;; //apply_weight&#40;make_score&#40;w, 0&#41;, Weights&#91;KingDangerUs + BLACK&#93;);
	  
	  bonus += make_score&#40;&#40;mg_value&#40;bonus&#41;>>6&#41; * &#40;abs&#40;eg_value&#40;bonus&#41;)>>6&#41;,&#40;eg_value&#40;bonus&#41;>>6&#41; * &#40;abs&#40;eg_value&#40;bonus&#41;)>>6&#41;); // introduces side to move asymmetry, when eg_value is negative and mg_value positive the formula is wrong and not mirrored between the two sides, but maybe it is a feature, not a bug.	  
  &#125;
Eelco

Actually in Gambit Tiger the King safety is the key. The other positional features are not changed. The King safety evaluation is changed to become much more speculative, and its weight is increased.

Also, the evaluation is almost symetrical in order to allow analysis for both sides. So Gambit Tiger could in theory act very cowardly if it overestimates its opponent's attack but fortunately I do not see it happening often, probably because it is alway the first to mount an attack.


// Christophe

Post Reply