Crate ncpig

Source
Expand description

Algorithms for (multiplayer) non-cooperative perfect information games.

§Example

use ncpig::prelude::*;
use ncpig_testing::rolit::*;

fn main() -> anyhow::Result<()> {
    let game = Rolit::new([RolitPlayer::Green, RolitPlayer::Blue]);
    let state = RolitState::default();

    let bot = Random::new();

    let competition = Competition::new(&game, [&bot, &bot], true);
    let finalstate = competition.play(state)?;

    for player in game.players() {
        println!("{player}: {}", game.score(player, &finalstate)?);
    }

    Ok(())
}

Modules§

competition
Have search algorithms compete against each other in a Game.
game
Build a game that is compatible with the ncpig search algorithms.
prelude
All the important stuff.
search
Search algorithms for determining an Action to take at the State of a Game.