Crates.io | ncpig |
lib.rs | ncpig |
version | 0.4.0 |
source | src |
created_at | 2024-09-27 02:01:17.569281 |
updated_at | 2024-10-21 22:51:12.015894 |
description | Non-Cooperative Perfect Information Games, and algorithms to play them. |
homepage | |
repository | https://git.sr.ht/~ryguy/ncpig |
max_upload_size | |
id | 1388178 |
size | 149,643 |
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
.
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(())
}
See the wiki for more info that could be useful to developers.