#chess-engine #uci #movegen #ugi #monster-chess #uai

bin+lib monster_ugi

A library that connects a chess engine using the monster-chess movegen library to the UGI protocol

20 releases

0.0.20 Dec 13, 2023
0.0.19 Dec 12, 2023
0.0.8 Mar 29, 2023

#397 in Game dev

Download history 295/week @ 2024-02-15 24/week @ 2024-02-22 16/week @ 2024-02-29 85/week @ 2024-03-28 42/week @ 2024-04-04

127 downloads per month

MIT license

16KB
298 lines

monster-ugi

Overview

monster-ugi is a fairy chess engine wrapper written in Rust for engines written using the monster-chess move generation library. It easily allows you to expose an API for your engine, and connect it to one of the UCI, UAI, or UGI protocols. It primarily aims for your engine to be compatible with cutegames. Cutegames uses the UGI protocol, which is a superset of the existing UCI and UAI protocols respectfully. To use it, implement the EngineBehavior trait:

impl<const T: usize> EngineBehavior<T> for RandomEngine<T> {
    fn select_move(&mut self, board: &mut Board<T>, time_control: TimeControl) -> MoveSelectionResults {
        let best_move = *board.generate_legal_moves(0).choose(&mut self.0).expect("Could not find a move to pick between for random movegen.");
        MoveSelectionResults {
            best_move,
            evaluation: 0
        }
    }

    fn get_engine_info(&mut self) -> EngineInfo {
        EngineInfo {
            name: "Random",
            author: "Corman"
        }
    }

    fn is_ready(&mut self) -> bool {
        true
    }

    fn stop_search(&mut self) {}
}

Then create an instance of engine:

let engine = Engine {
    behavior: RandomEngine::new(thread_rng()),
    game: Chess::create()
}

and run UGI.

run_ugi(engine);

License

monster-ugi available under the MIT license. See LICENSE for the full license text.

Dependencies

~1MB
~20K SLoC