RUCI
Rust Universal Chess Interface.
This crate parses and creates UCI messages.
It follows the UCI standard and uses shakmaty for relevant types.
See the examples for a demo on how to send and receive messages.
Comparison
There's two other crates that I'm aware of which serve a similar purpose. Keep in mind that this is a shallow comparison, I haven't looked extensively and I am not an expert.
vampirc-uci:- Doesn't use shakmaty, which AFAIK is the go-to chess crate now.
- Uses
pestfor parsing (ruci does it manually). - More dependencies;
pestandchrono. Ruci only has shakmaty and two macros which don't get included in the final binary. - Lot more tests than ruci. However, ruci has simpler parsing and less code. But yes, I am guilty.
- Doesn't separate GUI and engine messages. This is bad if you want to communicate with an engine/GUI, because you're going to need functions like
send_messageandread_message, where you want to specify which message you are sending and receiving. - Less direct implementation of the UCI standard.
- Maybe a pet peeve, but sometimes uses enum fields instead of separate types. IMHO this is bad because you can't represent just an
idmessage, because the fields are baked into the whole enum. - Doesn't provide the actual IO communication with an engine.
shakmaty-uci:- This library is based on/inspired by
vampirc-uci, so all of the above bullet points apply, except:- Uses shakmaty.
- Uses
nomfor parsing. - Doesn't have any other dependencies.
- This library is based on/inspired by
Feature flags
engine-connection: enables a structs to manage the IO when it comes to working with a UCI engine. Note that this will addtokioandparking_lotas dependencies. If you're making an engine, listen to stdin and parse it into agui::Message, then print a string representation of anengine::Message.serde: enablesSerializeandDeserializefor most types. All of the implementations are derived with no parameters.