#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

#203 in Machine learning

Download history 209/week @ 2024-09-21 160/week @ 2024-09-28 151/week @ 2024-10-05 8/week @ 2024-10-12 197/week @ 2024-10-19 11/week @ 2024-10-26

401 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