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

ncpig

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

4 releases (2 breaking)

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

#159 in Machine learning

Download history 250/week @ 2024-09-23 247/week @ 2024-09-30 27/week @ 2024-10-07

524 downloads per month

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

~4MB
~64K SLoC