Tempo ?

Discussion of chess software programming and technical issues.

Moderator: Ras

Golem

Tempo ?

Post by Golem »

What is the goal of the following code (taken from toga 1.3.1) ? That's not the first time I see code about "tempo" (-> crafty has it, if I remember correctly) but I don't understand the added value of this kind of code. What about asymetric (different) value for black and white ?

Code: Select all

   // Tempo

   if (COLOUR_IS_WHITE(board->turn)){
		opening += 20;
		endgame += 10;
	}
	else{
		opening -= 20;
		endgame -= 10;
   }
I don't understand the relation between this code and the common definition of a tempo in a chess game.
In chess, a "tempo" is a gain in time-units (represented by moves). When one player gains a tempo, it effectively means that his opponent has been forced to waste one or more moves.

A tempo is usually gained by developing a piece that attacks another of greater value, which must at once move or be lost. The benefit to the player gaining a tempo is that it enables him to marshall his forces more swiftly and effectively. In the opening part of a game, this usually results in a lead in development.
What about trying to implement real chess tempo (see bold text in the definition) ? Maybe it can be useful in order to analyze opening position ?
Tord Romstad
Posts: 1808
Joined: Wed Mar 08, 2006 9:19 pm
Location: Oslo, Norway

Re: Tempo ?

Post by Tord Romstad »

Golem wrote:What is the goal of the following code (taken from toga 1.3.1) ? That's not the first time I see code about "tempo" (-> crafty has it, if I remember correctly) but I don't understand the added value of this kind of code. What about asymetric (different) value for black and white ?
It is not asymmetric: Positive scores are good for white, negative scores are good for black.

Code: Select all

   // Tempo

   if (COLOUR_IS_WHITE(board->turn)){
		opening += 20;
		endgame += 10;
	}
	else{
		opening -= 20;
		endgame -= 10;
   }
I don't understand the relation between this code and the common definition of a tempo in a chess game.
It is simply a bonus for being the side to move. With the exception of zugzwang positions, which are very rare, it is usually better to be the side to move than to be in an otherwise identical position where it's the other side's turn to move.

I do something similar, but I don't just have a constant bonus: I give additional bonuses for having the side to move combined with possible discovered checks and queen contact checks.
In chess, a "tempo" is a gain in time-units (represented by moves). When one player gains a tempo, it effectively means that his opponent has been forced to waste one or more moves.

A tempo is usually gained by developing a piece that attacks another of greater value, which must at once move or be lost. The benefit to the player gaining a tempo is that it enables him to marshall his forces more swiftly and effectively. In the opening part of a game, this usually results in a lead in development.
What about trying to implement real chess tempo (see bold text in the definition) ? Maybe it can be useful in order to analyze opening position
That definition is better suited to help humans think about chess than as a basis for a static evaluation term in a chess program. I think it is easier and more natural to encourage the program for activating its pieces quickly, for instance by giving a progressive penalty based on the number of pieces with poor mobility.

Tord
Golem

Re: Tempo ?

Post by Golem »

Tord Romstad wrote: It is not asymmetric: Positive scores are good for white, negative scores are good for black.
Ok, the exemple I've shown is symmetric but I have seen some code where it is not (but I can't remember which code it was). What will be the involvement of asymmetric value like this one (for exemple) :

Code: Select all

   if (COLOUR_IS_WHITE(board->turn)){
      eval += 20;   //+0.20 for white
   }
   else{
      eval -= 14;    // +0.14 for black -> kind of racism ? ;-)
   } 
Tord Romstad wrote: It is simply a bonus for being the side to move. With the exception of zugzwang positions, which are very rare, it is usually better to be the side to move than to be in an otherwise identical position where it's the other side's turn to move.
OK, this seems logic to me. I think I understand better now. I will simply call it "side to move bonus", the term "tempo" seems a little bit confusing for me.
Tord Romstad wrote: I do something similar, but I don't just have a constant bonus: I give additional bonuses for having the side to move combined with possible discovered checks and queen contact checks.
I will have a look at your code when I have time (and more experience in the reading of chess code) but I want to understand most of the fruit/toga code before.
Tord Romstad wrote: I think it is easier and more natural to encourage the program for activating its pieces quickly, for instance by giving a progressive penalty based on the number of pieces with poor mobility.
In fact, the concept of "tempo" is somewhat hidden behind the "mobility code" ?

PS to Tord : Thank you for your reply.
PS to everyone : Sorry in advance, if my questions seems futile or stupid...
Dann Corbit
Posts: 12808
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Tempo ?

Post by Dann Corbit »

Here is an article to explain:
http://en.wikipedia.org/wiki/Tempo_(chess)
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Tempo ?

Post by bob »

Golem wrote:What is the goal of the following code (taken from toga 1.3.1) ? That's not the first time I see code about "tempo" (-> crafty has it, if I remember correctly) but I don't understand the added value of this kind of code. What about asymetric (different) value for black and white ?

Code: Select all

   // Tempo

   if (COLOUR_IS_WHITE(board->turn)){
		opening += 20;
		endgame += 10;
	}
	else{
		opening -= 20;
		endgame -= 10;
   }
I don't understand the relation between this code and the common definition of a tempo in a chess game.
In chess, a "tempo" is a gain in time-units (represented by moves). When one player gains a tempo, it effectively means that his opponent has been forced to waste one or more moves.

A tempo is usually gained by developing a piece that attacks another of greater value, which must at once move or be lost. The benefit to the player gaining a tempo is that it enables him to marshall his forces more swiftly and effectively. In the opening part of a game, this usually results in a lead in development.
What about trying to implement real chess tempo (see bold text in the definition) ? Maybe it can be useful in order to analyze opening position ?
The side on move gets a 20 point (middlegame) or 10 point (endgame) bonus for having the right to move, which is the definition of "tempo"...

By the way, that definition is not quite right. If you look at any good chess book, where white has played e4 Nf3 Bc4 and O-O, and black has played Nf6, Ng8, Nf6, Ng8, they will say that white is ahead by 4 tempi, as white is 4 moves ahead. Usually they will say that developing a piece where it attacks a more valuable piece "gains a tempo" because the opponent has to waste a move to get the more valuable piece to a safer square.. Moving the same piece twice in the opening loses one move.
User avatar
Don
Posts: 5106
Joined: Tue Apr 29, 2008 4:27 pm

Re: Tempo ?

Post by Don »

My programs have always had a small side to move bonus applied at the point where you stop the search. We called it the "stand pat" bonus. Is that pretty much standard practice?

It did help some positions where where the computer would give a silly check (or expect the opponent to) just to change who gets the last move.
Ron Murawski
Posts: 397
Joined: Sun Oct 29, 2006 4:38 am
Location: Schenectady, NY

Re: Tempo ?

Post by Ron Murawski »

Dann Corbit wrote:Here is an article to explain:
http://en.wikipedia.org/wiki/Tempo_(chess)
Dann,

The '(chess)' is not part of the URL unless you use this syntax:
http://en.wikipedia.org/wiki/Tempo_%28chess%29

I think that's where you meant to point. :)

Ron
Dann Corbit
Posts: 12808
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Tempo ?

Post by Dann Corbit »

Ron Murawski wrote:
Dann Corbit wrote:Here is an article to explain:
http://en.wikipedia.org/wiki/Tempo_(chess)
Dann,

The '(chess)' is not part of the URL unless you use this syntax:
http://en.wikipedia.org/wiki/Tempo_%28chess%29

I think that's where you meant to point. :)

Ron
In my browser, I can cut and paste:
http://en.wikipedia.org/wiki/Tempo_(chess)
but you are right that the link does not work to just click on it.
Ron Murawski
Posts: 397
Joined: Sun Oct 29, 2006 4:38 am
Location: Schenectady, NY

Re: Tempo ?

Post by Ron Murawski »

Dann Corbit wrote:
Ron Murawski wrote:
Dann Corbit wrote:Here is an article to explain:
http://en.wikipedia.org/wiki/Tempo_(chess)
Dann,

The '(chess)' is not part of the URL unless you use this syntax:
http://en.wikipedia.org/wiki/Tempo_%28chess%29

I think that's where you meant to point. :)

Ron
In my browser, I can cut and paste:
http://en.wikipedia.org/wiki/Tempo_(chess)
but you are right that the link does not work to just click on it.
The link problem is caused by the bulletin board software. Escaping the parentheses symbols with hex codes (URL encoding) is the way to make it work correctly. There's supposed to be a BBCode method as well, but it doesn't seem to work on this board. At least, not for me...

Ron
wgarvin
Posts: 838
Joined: Thu Jul 05, 2007 5:03 pm
Location: British Columbia, Canada

Re: Tempo ?

Post by wgarvin »

Don wrote:My programs have always had a small side to move bonus applied at the point where you stop the search. We called it the "stand pat" bonus. Is that pretty much standard practice?

It did help some positions where where the computer would give a silly check (or expect the opponent to) just to change who gets the last move.
If evaluation is meant to estimate the winning chances of either side, a "side to move" bonus makes sense. In an otherwise-equal position, the side to move has slightly more control over things: he gets to choose any available move, which might constrain his opponent's choice of moves after that.

I wonder if this bonus should be set to 0 for positions prone to Zugzwang (if there is a reasonable way to identify them in eval)? Or is it small enough to not matter much in those cases?