Level command question

Programming Topics (Computer Chess) and technical aspects as test techniques, book building, program tuning etc

Moderator: Andres Valverde

Level command question

Postby Fermin Serrano » 07 May 2008, 16:33

I have a confussion with level command. It is not clear in the protocol:

level 40 5 0 -> means 40 moves in 5 minutes or
level 40 0:30 0 -> means 40 moves in 30 seconds.

after the control of 40 moves is reached,
what I have to do? does I receive a new level command? or must I set the level command like when it was received....

also in tournament mode (level xx yy 0) or (level 0 xx yy), I have seen that many engines run out of time and winboard let them continue playing. How can my engine call for the flag and take the game as won?
User avatar
Fermin Serrano
 
Posts: 72
Joined: 10 Apr 2008, 18:20
Location: Madrid (Spain)

Re: Level command question

Postby Zach Wegner » 07 May 2008, 17:45

For the first question, the time control is repeating. That means that after 40 moves, 5 minutes or 30 seconds is just added to the clock and it starts over.

For the second, just make sure -autoflag is on. Winboard should then flag the game for you.
User avatar
Zach Wegner
 
Posts: 182
Joined: 26 Sep 2004, 22:02
Location: Austin, Texas, USA

Re: Level command question

Postby H.G.Muller » 08 May 2008, 08:12

If you specify a number of moves M > 0, WinBoard will add the same time as you originally after M moves or every multimple of M moves. The engine can plan for this, but does not recieve a new 'level' command. It does get notified of the extra time, though, as the 'time' command specifies how much time is left until the next possible flag event. But it does not tell how many moves it has to live on this time. And this is of course very relevant for the engine to know how to wisely spend it. So you must keep trach of that yourself.

Unlike what the protocol description says, white and black have their own clocks, and if you suddenly let an engine play the other color (by giving an extra 'go' command during the opponent's turn) it inherits the time left on the opponent's clock. For counting the moves to know where to expect your next time quota, always count from the beginning of the game.

You are encouraged to implement the 'level' command such that your engine does a sensible thing when future WB versions would send it during a game. E.g. if you were playing 40/60', and after move 40 you would recieve "level 60 90 0" you should realize that the next new time quota will come at move 60 (in stead of 80). The TC parameter of the 'level' command can basically be always ignored, as WB in practice sends 'time' commands before every move. But the 'level' command is essential for knowing how long you have to last on this time.
User avatar
H.G.Muller
 
Posts: 3453
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: Level command question

Postby Zach Wegner » 09 May 2008, 02:20

H.G.Muller wrote:You are encouraged to implement the 'level' command such that your engine does a sensible thing when future WB versions would send it during a game. E.g. if you were playing 40/60', and after move 40 you would recieve "level 60 90 0" you should realize that the next new time quota will come at move 60 (in stead of 80).

Why 60? ZCT would think it would come at move 100, which makes a lot more sense to me...
User avatar
Zach Wegner
 
Posts: 182
Joined: 26 Sep 2004, 22:02
Location: Austin, Texas, USA

Re: Level command question

Postby H.G.Muller » 09 May 2008, 15:25

Well, we would have to make a choice here, and it seemed to me that the way it is most likely to work by accident on engines that had not implemented the 'level' command with the idea in mind that it could be recieved during the game.

But you are right: there are two stratightforward ways to implement this. You could use 'level' to initialize a countdown counter, and at the same time remember the first argument to add it if the counter hits zero. The other way would be to just remember the argument, and keep track of the move number, and expect new time when the move number equals a multiple of the argument.

Perhaps I should make WinBoard support both modes of secondary time control, (sending a new 'level' command with accumulated arguments, or just for the next session), so that the user can select which mode to use on which engine.
User avatar
H.G.Muller
 
Posts: 3453
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL


Return to Programming and Technical Discussions

Who is online

Users browsing this forum: No registered users and 38 guests