aclap-dev / joclyboard

Multiplatform 3D/2D desktop application for playing board games
Other
44 stars 20 forks source link

Request: support "Level" command for CECP engines #18

Open fsmosca opened 7 years ago

fsmosca commented 7 years ago

I tried to install my CECP engine to play capablanca chess variant. The debug showed that JoclyBoard did not send a level command when I set my time control to 40 moves in 5 minutes.

engine details that I use

variant: capablanca
workingDir: c:\engines\Bihasa-v3.2
initialCommands:
  - xboard

Debug:

0.000: - Starting server: Bihasa-v3.2.exe
0.000: - Priority class set to normal
0.000: - Thread priority set to normal
0.000: > xboard
0.000: > new
0.000: > variant capablanca
0.000: > force
0.000: > e2e4
0.000: > time 5997
0.000: > otim 4688
0.000: > go
0.000: < # Bihasa v3.2
0.000: < # Compiled: Jan 31 2012
0.000: < # Can only play Capablanca and gothic chess variants
0.000: < 
0.000: < # Reading initialization file...
0.000: < 
0.125: < # Resign                   : OFF
0.140: < # Resign Score             : -1200
0.140: < # Resign Score Count       : 5
0.140: < # Book                     : OFF
0.140: < # Contempt Value           : 0
0.140: < # Ponder                   : ON
0.140: < 
0.140: < # Pawn_Value 75 100
0.140: < # Knight_Value 310 310
0.140: < # Bishop_Value 350 350
0.140: < # Rook_Value 530 530
0.140: < # ArchBishop_Value 870 870
0.140: < # Chancellor_Value 990 990
0.140: < # Queen_Value 1040 1040
0.140: < 
0.140: < # Closing initialization file...
0.140: < 
0.140: < 
0.140: < # Default chess variant is capablanca
0.140: < feature done=0

My comments on GUI and engine communications.

  1. 0.000: > xboard JB - Joclyboard sent xboard command to the engine Bihasa. JB sent this command probably because of the setting initialCommands: - xboard. I would recommend sending this xboad command always whenever CECP engine is started.

  2. 0.000: > new I would suggest here to send "protover 2" command, so that the GUI may knew the name of the engine and the features it is capable of. Example.

    
    > xboard
    < feature done=0

protover 2 < feature ping=1 time=1 setboard=1 name=1 colors=1 debug=1 < feature draw=0 sigint=0 sigterm=0 reuse=0 analyze=1 ics=1 < feature variants="capablanca,gothic" < feature option="MultiPV -spin 1 1 300" < feature memory=1 < feature myname="Bihasa v3.2" < feature done=1


So the name of the program is Bihasa v3.2 because of the line
`feature myname="Bihasa v3.2"
`
It can do multipv and it can play also gothic chess variant. It also supports analyze command useful for analyzing moves by infinite analysis.

After JB received the text line feature done=1 it is now ready to send other commands to the engine, this means that JB should wait for this text from the engine. This feature is new to protocol version 2. Older engines does not support this.

  1. 0.000: > variant capablanca By sending command protover 2, JB will be able to see what CECP engine variants it supported because the engine will send feature variants="capablanca,gothic"

When user play a game, JB could probably send: xboard protover 2 wait for feature done=1 new post allows the engine to show its output level 40 5 0 user has set the time control in GUI for example that is 40 moves in 5 minutes, repeating and 0 sec increments, for time control without period it can be level 0 5 1 and that is 5 minutes for the whole game with 1s inc per move. This command is important to CECP engine when playing games. variant capablanca time xxxx otim yyyy e2e4 send the move to the engine go is not needed if you send the move to the engine without sending force command engine is thinking now... e7e5 engine has finished thinking and sent the move to the gUI time xxx1 otim yyy1 b1c3 GUI sent a move to engine engine is thinking now... preparing for reply ...

Couple of hints:

  1. Send the level command before a game starts, done only once.
  2. Send time and otim before sending a move to the engine. The engine would think after receiving the move, go command is not needed, assuming you don't send force command to the engine before.

CECP ref: https://www.gnu.org/software/xboard/engine-intf.html#11