#ai #machine-learning #monte-carlo #game-ai #game #multiplayer-game #maxn

ncpig

Non-Cooperative Perfect Information Games, and algorithms to play them

5 releases (3 breaking)

0.4.0 Oct 21, 2024
0.3.0 Oct 4, 2024
0.2.0 Oct 2, 2024
0.1.1 Sep 27, 2024
0.1.0 Sep 27, 2024

#227 in Machine learning

GPL-3.0-only

66KB
1.5K SLoC

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.


lib.rs:

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

Dependencies

~3.5MB
~63K SLoC