Crates.io | battlerust |
lib.rs | battlerust |
version | 0.3.0 |
source | src |
created_at | 2022-12-09 19:27:00.660559 |
updated_at | 2022-12-09 19:27:00.660559 |
description | A Battleship game implementation in Rust |
homepage | |
repository | https://github.com/joamag/battlerust |
max_upload_size | |
id | 733455 |
size | 58,193 |
A Battleship game implementation in Rust 🦀.
Create an application to allow a single human player to play a one-sided game of Battleships against ships placed by the computer.
The program should create a 10x10 grid, and place a number of ships on the grid at random with the following sizes:
The player enters coordinates of the form “A5”, where "A" is the column and "5" is the row, to specify a square to target. Shots result in hits, misses or sinks. The game ends when all ships are sunk.
Provider | Stable | URL |
---|---|---|
Cloudfare | True |
battlerust.joao.me |
Cloudfare | True |
battlerust.pages.dev |
Cloudfare | False |
master.battlerust.pages.dev |
cd frontends/console
cargo build
cargo run
cargo install wasm-pack
wasm-pack build --release --target=web --out-dir=frontends/web/lib -- --features wasm
cd frontends/web
npm install && npm run build
cd dist && python3 -m http.server
cd frontends/console
rustup target add wasm32-wasi
cargo build --release --target wasm32-wasi
cd ../../target/wasm32-wasi/release
wasmtime battlerust-console.wasm
You can use WebAssembly.sh to play around with the WASI compliant WASM assembly and interact with this Web shell in the same way as you would in your normal OS shell.
In alternative you can use the Wasmtime WASM runtime to run the WASM binary in your local computer.