1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
//
// This file is part of zero_sum.
//
// zero_sum is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// zero_sum is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with zero_sum. If not, see <http://www.gnu.org/licenses/>.
//
// Copyright 2016 Chris Foster
//

//! 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.
//!
//! # Usage
//!
//! This crate is [on crates.io](https://crates.io/crates/zero_sum) and can be
//! used by adding `zero_sum` to the dependencies in your project's `Cargo.toml`.
//!
//! ```toml
//! [dependencies]
//! zero_sum = "0.1"
//! ```
//!
//! and add this to your crate root:
//!
//! ```rust
//! #[macro_use]
//! extern crate zero_sum;
//! # fn main() { }
//! ```
//!
//! # 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 evaluation type
//! (usually a tuple wrapper around a numeric type, i.e. `struct Eval(i32);`)
//! with `analysis::Evaluation`, and implement `analysis::Evaluatable` and
//! `analysis::Extrapolatable` on the `State` type.
//!
//! # Example
//!
//! A working example can be found in [examples/tic_tac_toe.rs](https://github.com/cdbfoster/zero_sum/blob/master/examples/tic_tac_toe.rs).

extern crate fnv;
#[macro_use]
extern crate lazy_static;
extern crate rand;
extern crate time;

pub mod analysis;

pub use self::ply::Ply;
pub use self::resolution::Resolution;
pub use self::state::State;

mod ply;
mod resolution;
mod state;