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
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
//
// 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-2017 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.
//!
//! Also provided through the use of optional features are implementations
//! for tic-tac-toe and the game of [tak](http://cheapass.com/tak/).
//!
//! # 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 = "1.2"
//! ```
//!
//! and add this to your crate root:
//!
//! ```rust
//! extern crate zero_sum;
//! # fn main() { }
//! ```
//!
//! 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`:
//!
//! ```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](https://github.com/cdbfoster/zero_sum/blob/master/examples/tic_tac_toe.rs).

#![feature(test)]

extern crate fnv;
extern crate test;

#[cfg(feature = "with_tak")]
#[macro_use]
extern crate lazy_static;

#[cfg(feature = "with_tak")]
extern crate rand;

#[cfg(feature = "with_tak_ann")]
extern crate blas;

#[macro_use]
pub mod analysis;

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

#[cfg(any(feature = "with_tak", feature = "with_tic_tac_toe"))]
pub mod impls;

mod ply;
mod resolution;
mod state;