7 releases (stable)
Uses old Rust 2015
1.2.0 | Apr 23, 2017 |
---|---|
1.1.2 | Feb 9, 2017 |
1.0.0 | Nov 3, 2016 |
0.2.0 | Sep 14, 2016 |
0.1.0 | Sep 9, 2016 |
#1389 in Game dev
Used in takkerus
240KB
5K
SLoC
zero_sum
An analysis engine for zero-sum games.
This crate provides a number of traits that can be used to facilitate the implementation of a zero-sum game, and to allow the analysis thereof.
Also provided through the use of optional features are implementations for tic-tac-toe and the game of tak.
For usage instructions, see the documentation.
lib.rs
:
An analysis engine for zero-sum games.
This crate provides a number of traits that can be used to facilitate the implementation of a zero-sum game, and to allow the analysis thereof.
Also provided through the use of optional features are implementations for tic-tac-toe and the game of tak.
Usage
This crate is on crates.io and can be
used by adding zero_sum
to the dependencies in your project's Cargo.toml
.
[dependencies]
zero_sum = "1.2"
and add this to your crate root:
extern crate zero_sum;
If you want to implement the library, you'll need to include a #[macro_use]
line before extern crate zero_sum;
If you want to use one of the implementations provided inside the zero_sum::impls
module, you'll need to specify the appropriate features in your project's Cargo.toml
:
[features]
default = ["zero_sum/with_tak"]
for instance, to include the tak
module.
Implementation
The three basic traits are Ply
, Resolution
, and State
. These form
the basic building blocks of any zero-sum game.
In order to provide analysis, one must also create an evaluator type with
analysis::Evaluator
that has an associated evaluation type that implements
analysis::Evaluation
(usually a tuple wrapper around a numeric type, i.e.
struct Eval(i32);
). Finally, implement analysis::Extrapolatable
on the
State
type.
Example
The provided tic-tac-toe implementation is very simple and a usage example can be found in examples/tic_tac_toe.rs.
Dependencies
~0–3.5MB
~68K SLoC