unserializable / monchester

Monchester, chess engine for CECP interfaces and console
GNU General Public License v3.0
4 stars 1 forks source link

Improve CECP-compliance of error-reporting #10

Closed unserializable closed 3 years ago

unserializable commented 3 years ago

Announce errors with prefix, optional description and command name

As leftover from console-only interface 'Unrecognized command' is sent also when speaking CECP

command : xboard
# received xboard
protover 2
feature myname="Monchester 1.0" name=1 setboard=1 ping=1 edit=0 memory=0 usermove=0 analyze=0 colors=0 sigint=0 sigterm=0 done=1
dafadsfds
Unrecognized command

However, most compatible way of CECP is:

Error (ERRORTYPE): COMMAND

given earlier situation, that would be e.g.: Error (Unrecognized command): dafadsfds or Error: dafadsfds or Error (unknown command): dafadsfds, etc

Verify robust command argument parsing

E.g. to_int is used for CECP sd argument parsing and when given in succession, this fails with conversion error announced.

# Monchester 1.0 ~(11826 kN/s)
command : xboard
# received xboard
sdf
Could not convert 'f' to integer.

Expected behaviour would be to announce unknown command error in the same format as described before, e.g: Error (unknown command): sdf Similarly for other imaginable happenings like stx, etc.

unserializable commented 3 years ago

At the moment have no other ideas for the improvements. Perhaps the board-printing chatter is better off to be removed altogether unless compiled with special debug flags -- but those are done as CECP comments, so should not affect any functionality negatively.

unserializable commented 3 years ago

This error reporting change seems to have helped with Arena engine autodetection -- not a recommended way to set up engines there, but nevertheless available and apparently used by some people.

image

Key point seems to be that after receiving xboard, protover 2, uci and possibly isready, the last two are rejected with CECP-compliant Error (comment): command and then Arena goes on to talk soft CECP only.

Sample log from Linux Arena 3.10beta

Arena 3.10beta

2021-02-14 23:50:38.516**Fast graphics mode ok
2021-02-14 23:50:39.561**----------New game---2021-02-14 23:50:39,561 Sun -------------
2021-02-14 23:50:39.871**Arena Start took: 2689 ms
2021-02-14 23:50:40.695**Loading  1
2021-02-14 23:53:48.457*1*---------------Starting engine 1 Monchester-1.0.1-14-g84db4ed---------------
2021-02-14 23:53:48.473*1*Configured Engine 1 Type:  Auto
2021-02-14 23:53:48.478*1*enginedebug:CommandLine: >>nice -1 /home/arena/arena/Engines/Monchester/monchester-1.0.1-14-g84db4ed <<
2021-02-14 23:53:48.478*1*enginedebug:-- executing engine--
2021-02-14 23:53:48.483*1*enginedebug:EngineReadThread create...
2021-02-14 23:53:48.484*1*enginedebug:EngineReadThread created suspended
2021-02-14 23:53:48.484*1*enginedebug:-- Thread now starting --
2021-02-14 23:53:48.485*1*enginedebug:-- Tengine.Redirect finished --
2021-02-14 23:53:48.485-->1:xboard
2021-02-14 23:53:48.505<--1:-- starting engine[slotnr].EngineProcess --
2021-02-14 23:53:48.507<--1:-- engine[slotnr].EngineProcess.Running --
2021-02-14 23:53:48.546-->1:protover 2
2021-02-14 23:53:48.591-->1:uci
2021-02-14 23:53:48.745<--1:# Monchester 1.0.1-14-g84db4ed ~(4327 kN/s)
2021-02-14 23:53:48.745<--1:command : # received xboard
2021-02-14 23:53:48.745<--1:feature myname="Monchester 1.0.1-14-g84db4ed" name=1 setboard=1 ping=1 edit=0 memory=0 usermove=0 analyze=0 colors=0 sigint=0 sigterm=0 done=1
2021-02-14 23:53:48.750-->1:accepted name
2021-02-14 23:53:48.750-->1:accepted setboard
2021-02-14 23:53:48.750-->1:accepted ping
2021-02-14 23:53:48.750-->1:accepted memory
2021-02-14 23:53:48.750-->1:accepted usermove
2021-02-14 23:53:48.750-->1:accepted analyze
2021-02-14 23:53:48.750-->1:accepted colors
2021-02-14 23:53:48.750-->1:accepted sigint
2021-02-14 23:53:48.750-->1:accepted sigterm
2021-02-14 23:53:48.750-->1:accepted done
2021-02-14 23:53:48.751<--1:Error (unknown command): uci
2021-02-14 23:53:48.763<--1:#8:  R N B Q K B N R 
2021-02-14 23:53:48.767<--1:#7:  P P P P P P P P 
2021-02-14 23:53:48.767<--1:#6:  - - - - - - - - 
2021-02-14 23:53:48.767<--1:#5:  - - - - - - - - 
2021-02-14 23:53:48.767<--1:#4:  - - - - - - - - 
2021-02-14 23:53:48.767<--1:#3:  - - - - - - - - 
2021-02-14 23:53:48.767<--1:#2:  p p p p p p p p 
2021-02-14 23:53:48.767<--1:#1:  r n b q k b n r 
2021-02-14 23:53:48.767<--1:#-------------------
2021-02-14 23:53:48.767<--1:#    A B C D E F G H       rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
2021-02-14 23:53:56.592-->1:isready
2021-02-14 23:53:56.643<--1:Error (unknown command): isready
2021-02-14 23:53:56.646<--1:#8:  R N B Q K B N R 
2021-02-14 23:53:56.658<--1:#7:  P P P P P P P P 
2021-02-14 23:53:56.658<--1:#6:  - - - - - - - - 
2021-02-14 23:53:56.658<--1:#5:  - - - - - - - - 
2021-02-14 23:53:56.658<--1:#4:  - - - - - - - - 
2021-02-14 23:53:56.658<--1:#3:  - - - - - - - - 
2021-02-14 23:53:56.659<--1:#2:  p p p p p p p p 
2021-02-14 23:53:56.659<--1:#1:  r n b q k b n r 
2021-02-14 23:53:56.659<--1:#-------------------
2021-02-14 23:53:56.659<--1:#    A B C D E F G H       rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
2021-02-14 23:53:56.863-->1:new
2021-02-14 23:53:56.863-->1:random
2021-02-14 23:53:56.863-->1:level 0 5 0
2021-02-14 23:53:56.863<--1:#8:  R N B Q K B N R 
2021-02-14 23:53:56.864<--1:#7:  P P P P P P P P 
2021-02-14 23:53:56.864<--1:#6:  - - - - - - - - 
2021-02-14 23:53:56.864-->1:post
2021-02-14 23:53:56.864-->1:hard
2021-02-14 23:53:56.864-->1:easy
2021-02-14 23:53:56.864-->1:ping 4
2021-02-14 23:53:56.864<--1:#5:  - - - - - - - - 
2021-02-14 23:53:56.864<--1:#4:  - - - - - - - - 
2021-02-14 23:53:56.864<--1:#3:  - - - - - - - - 
2021-02-14 23:53:56.864<--1:#2:  p p p p p p p p 
2021-02-14 23:53:56.865<--1:#1:  r n b q k b n r 
2021-02-14 23:53:56.868<--1:#-------------------
2021-02-14 23:53:56.871<--1:#    A B C D E F G H       rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
2021-02-14 23:53:56.871<--1:pong 4
2021-02-14 23:53:56.874-->1:name arena
2021-02-14 23:54:19.191*1*Start calc, move no: 2
2021-02-14 23:54:19.409-->1:level 0 5 0
2021-02-14 23:54:19.409-->1:new
2021-02-14 23:54:19.409-->1:random
2021-02-14 23:54:19.409-->1:level 0 5 0
2021-02-14 23:54:19.416<--1:#8:  R N B Q K B N R 
2021-02-14 23:54:19.416<--1:#7:  P P P P P P P P 
2021-02-14 23:54:19.416<--1:#6:  - - - - - - - - 
2021-02-14 23:54:19.416<--1:#5:  - - - - - - - - 
2021-02-14 23:54:19.417<--1:#4:  - - - - - - - - 
2021-02-14 23:54:19.417<--1:#3:  - - - - - - - - 
2021-02-14 23:54:19.417<--1:#2:  p p p p p p p p 
2021-02-14 23:54:19.417<--1:#1:  r n b q k b n r 
2021-02-14 23:54:19.417<--1:#-------------------
2021-02-14 23:54:19.417<--1:#    A B C D E F G H       rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
unserializable commented 2 years ago

Threads on Arena autodetection: Arena autodetection for CECP/XBoard -- 2021 (my report) Autodetection in Arena does not work (with WB engines) -- 2010