| Crates.io | sudoko |
| lib.rs | sudoko |
| version | 0.6.0 |
| created_at | 2025-07-05 08:32:57.689315+00 |
| updated_at | 2025-08-04 08:27:34.988102+00 |
| description | A comprehensive Sudoku solving library with multiple strategies, puzzle generation, and WebAssembly support |
| homepage | https://github.com/iamdhakrey/sudoko |
| repository | https://github.com/iamdhakrey/sudoko |
| max_upload_size | |
| id | 1738828 |
| size | 120,250 |
A comprehensive, modular Rust library and application suite for solving advanced Sudoku puzzles of various sizes (3x3, 4x4, 5x5, and more) using multiple solving strategies, with WebAssembly (WASM) and terminal UI support.
Add the core library to your Rust project:
[dependencies]
sudoko = "0.3"
# For WebAssembly support
sudoko = { version = "0.3", features = ["wasm"] }
Install the terminal UI application:
cargo install sudoko-tui
For WebAssembly projects, use the core library with WASM features enabled.
This workspace consists of two main crates:
sudoko - Core Library with WASM Supportsudoko/--features wasmSudoku, SudokuSolver, Cell, Difficulty, and utilitiesWasmSudoku and WASM utilities (when wasm feature is enabled)sudoko-tui - Terminal User Interfacesudoko-tui/cargo build
# Core library
cargo build -p sudoko
# Core library with WASM support
cargo build -p sudoko --features wasm
# Terminal UI
cargo build -p sudoko-tui
# Solve a puzzle
cargo run -p sudoko --bin sudoko-cli -- solve "530070000600195000..." 9
# Generate a puzzle
cargo run -p sudoko --bin sudoko-cli -- generate 9 hard
# Get help
cargo run -p sudoko --bin sudoko-cli -- --help
cargo run -p sudoko-tui
Use the provided build-wasm.sh script to build for web, node, and bundler targets:
./build-wasm.sh
See web-example/ for a browser demo.
use sudoko::{Sudoku, SudokuSolver, Difficulty};
// Create a new puzzle
let mut puzzle = Sudoku::new(9);
// Load from string
let puzzle = Sudoku::from_string("530070000...", 9)?;
// Solve the puzzle
let mut solver = SudokuSolver::new();
let solution = solver.solve(puzzle)?;
// Generate a new puzzle
let puzzle = solver.generate_puzzle(9, Difficulty::Hard)?;
import { WasmSudoku } from './pkg/sudoko.js';
// Create a new puzzle
const sudoku = new WasmSudoku(9);
// Load an example puzzle
const example = create_example_puzzle();
// Solve it
example.solve();
// Render as text
console.log(example.render_text());
MIT