Hi Daniel,
I think your winboard code misses handling of at least the following commands which are actually sent by WinBoard to your engine:
- protover
- random
- level
- hard
- computer
For a first, very simple approach you might ignore all of them, perhaps except "level" (but follow the link provided by Dann for more details). Just "continue" when detecting any of these commands. Also there may be a few more commands to handle.
By not handling them you fall into the piece of code where you expect a move sent by the opponent:
- Code: Select all
m = verif_coup(line);
if(m == -1)
printf("coup illegal\n");
which would explain your problems.
Btw in console mode your engine does not receive these commands (no WinBoard GUI at the other end) but you may reproduce the behaviour by simply typing the commands "protover 2" or "random" at your move prompt. You should see "coup illegal" in both cases.
Finally you have to change "coup" into "move" when sending the engine's best move (meilleur_coup) with 'printf("coup %s\n", ...)'. The WinBoard protocol expects the word "move" here.
The same applies to 'printf("coup illegal\n")', better use 'printf("Illegal move: %s\n", line);' to match the protocol requirements. This would also help you to identify the command or move your engine claims to be illegal.
Sven