Skip to content

jordibonet-lambdaclass/wasm-game-of-life

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Conway's Game of Life [Rust 🦀 + WASM 🕸️]

Try it: https://conway-jordi.vercel.app/

What is Conway's Game of Life?

This a Rust implementation of Cownway's Game Of Life using WebAssembly.

Requirements

You need to have installed the Rust toolchain rustup. On a Unix system:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

You need to have installed wasm-pack. On a Unix system:

curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

Using cargo:

cargo install wasm-pack

Using npm:

npm install -g wasm-pack

Finally, you must have NodeJS installed.

Generate web server code

Generate the WebAssembly binary running this command:

wasm-pack build

This will create a pkg directory.

Initialize the NodeJS application:

npm init wasm-app web

This will generate a web directory.

Move the pkg directory into web directory.

cp -rf pkg web && rm -r pkg && rm web/pkg/.gitignore

Also we removed the pkg directory and the .gitignore file (for deployment).

Run the web server

You can start the NodeJS server using the following commands:

cd web
npm cache clean -f
rm -rf node_modules package-lock.json
npm i
npm run start

Deploy the app

For example, we can use Vercel to deploy our app.

You can deploy it with the following configuration:

Vercel configuration

About

A Rust implementation of Cownway's Game Of Life using WebAssembly.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published