tools_2048/
lib.rs

1//! **tools-2048** is a library that provides the core logic of the popular game 2048, along with a basic AI to play the game.
2//! Arbitrary board sizes are supported with the minimum being 4x4.
3//!
4//! Example usage:
5//! ```rust
6//! use tools_2048::{Game, GameMove, GameState, GameResult};
7//!
8//! // create a new game with a 4x4 board
9//! let mut game: Game<4> = Game::new().unwrap();
10//!
11//! // make a move
12//! game.make_move(GameMove::Left);
13//! game.make_move(GameMove::Right);
14//! game.make_move(GameMove::Up);
15//! game.make_move(GameMove::Down);
16//!
17//! // find the best move and make it
18//! game.make_move(game.find_best_move(10_000).unwrap());
19//!
20//! assert_eq!(game.state(), GameState::InProgress);  // the game should still be in progress
21//! assert_eq!(game.result(), GameResult::Pending);  // the result shouldn't be decided yet
22//! ```
23
24pub mod core;
25pub mod error;
26
27#[doc(inline)]
28pub use core::*;
29
30#[doc(inline)]
31pub use error::*;