ncpig

Crates.ioncpig
lib.rsncpig
version0.4.0
sourcesrc
created_at2024-09-27 02:01:17.569281
updated_at2024-10-21 22:51:12.015894
descriptionNon-Cooperative Perfect Information Games, and algorithms to play them.
homepage
repositoryhttps://git.sr.ht/~ryguy/ncpig
max_upload_size
id1388178
size149,643
Ryan Crisanti (rcrisanti)

documentation

https://docs.rs/ncpig

README

ncpig 🐷

Algorithms for (multiplayer) non-cooperative perfect information games, written in rust ⚡️.

The core crate is in ncpig. Numerous example games used for testing can be found in ncpig-testing.

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(())
}

Developers

See the wiki for more info that could be useful to developers.

Commit count: 0

cargo fmt