Pure Rust 2048 engine with multiplier tiles and score tracking.
- Classic 2048 mechanics
- Special multiplier tiles: -1 (x1), -2 (x2), -4 (x4)
- Simple functional API for simulations/AI
- Detects victory (
65536
tile) and game over
Create a new 4x4 board with two starting tiles.
- Apply a move.
- On success returns
(new_board, delta_score, state)
state
is an enum:State::{Victory, GameOver, Continue}
.- Use
Direction::{Up,Down,Left,Right}
fordir
.
use akioi_2048::{init, step, Direction, State};
fn main() {
let board = init();
let (next, delta, state) = step(board, Direction::Down).unwrap();
println!("delta={delta}, state={state:?}, next={next:?}");
}
This library is intended to be published to crates.io. See .github/workflows/publish.yml
.