necocen / four-fours-rs

Solve four-fours with Rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Four fours calculator

0 = 44-44
1 = 44/44
2 = 4-(4+4)/4
3 = (4+4+4)/4
4 = 4+4*(4-4)
5 = (4+4*4)/4
6 = 4+(4+4)/4
7 = 44/4-4
8 = 4+4+4-4
9 = 4+4+4/4
10 = (44-4)/4

How to play

cargo run           # This prints ordinary four-fours
cargo run 9999      # This prints four-nines
cargo run 44444     # This prints five-fours (Uses VERY large memory)
cargo run --features with-rayon # parallelize calculations with rayon
cargo run --release # Release build

Wasm support

You can calculate four-fours from browser. (Currently it does not support with-rayon feature. To use rayon in wasm, see rayon-wasm.md.)

wasm-pack build
cd js
npm i
npm start

About

Solve four-fours with Rust


Languages

Language:Rust 86.6%Language:TypeScript 8.4%Language:JavaScript 4.6%Language:HTML 0.5%