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 |
#225 in Machine learning
213 downloads per month
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