Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/scottgriv/rust-wasm_game_of_life
Implementation of Conway's Game of Life using Rust and WebAssembly, with real-time visualization in the browser.
https://github.com/scottgriv/rust-wasm_game_of_life
conways-game-of-life game-of-life rust web-assembly webassembly webassembly-demo
Last synced: about 2 months ago
JSON representation
Implementation of Conway's Game of Life using Rust and WebAssembly, with real-time visualization in the browser.
- Host: GitHub
- URL: https://github.com/scottgriv/rust-wasm_game_of_life
- Owner: scottgriv
- License: unlicense
- Created: 2024-06-03T18:29:42.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-06-14T16:38:26.000Z (8 months ago)
- Last Synced: 2024-12-08T16:46:53.089Z (about 2 months ago)
- Topics: conways-game-of-life, game-of-life, rust, web-assembly, webassembly, webassembly-demo
- Language: Rust
- Homepage: https://scottgriv.github.io/rust-wasm_game_of_life/
- Size: 17.4 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
---------------
Conway's Game of Life
A web-based implementation of **Conway's Game of Life** using `Rust` and `WebAssembly`.
**The Game of Life**, also known simply as **Life**, is a cellular automaton devised by the British mathematician *John Horton Conway* in 1970. It is a zero-player game, meaning that its evolution is determined by its initial state, requiring no further input. One interacts with the **Game of Life** by creating an initial configuration and observing how it evolves. It is *Turing complete* and can simulate a universal constructor or any other *Turing machine*.
- Visit a demo of the application [here](https://scottgriv.github.io/rust-wasm_game_of_life/).
---------------## Table of Contents
- [Features](#features)
- [Getting Started](#getting-started)
- [Dependencies](#dependencies)
- [Installation](#installation)
- [Usage](#usage)
- [What's Inside?](#whats-inside)
- [Resources](#resources)
- [License](#license)
- [Credits](#credits)## Features
- **Rust Implementation:** The core logic of the game is implemented in Rust, leveraging its performance and safety features.
- **WebAssembly:** The Rust code is compiled to WebAssembly, enabling it to run efficiently in the browser.
- **Interactive Visualization:** The game grid is rendered in the browser using HTML and JavaScript, allowing users to see the simulation in real-time.## Getting Started
### Dependencies
1. Install Rust using the recommended method, rustup:
```bash
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
```2. Install wasm-pack using Cargo (the Rust package manager):
```bash
cargo install wasm-pack
```3. Ensure you have Node.js and npm installed.
You can download them from [Node.js](https://nodejs.org/).4. Install http-server globally using npm:
```bash
npm install -g http-server
```### Installation
1. Clone the Repository:
```bash
git clone https://github.com/scottgriv/rust-wasm_game_of_life
```2. Change to the Directory:
```bash
cd rust-wasm_game_of_life
```3. Add Cargo to PATH:
```bash
export PATH="$HOME/.cargo/bin:$PATH"
```4. Source the Shell Configuration:
```bash
source ~/.zshrc
```5. Remove Existing `pkg` Directories (if they exist):
```bash
rm -rf pkg www/pkg
```6. Build the Project package folder and files with `wasm-pack`:
```bash
wasm-pack build --target web
```7. Move Generated `pkg` folder to `www`:
```bash
mv pkg www/
```8. Remove optional Auto-Generated files (if you need them for your repository):
```bash
rm www/pkg/README.md www/pkg/.gitignore
```9. Set up the Web Server:
```bash
cd www
http-server
```## Usage
- Open your web browser and navigate to:
```bash
http://localhost:8080
```## What's Inside?
```bash
rust-wasm_game_of_life/ # Root directory
├── .github/ # GitHub folder
│ └── workflows/ # GitHub Actions folder
│ └── gh-pages.yml # GitHub Pages workflow
├── src/ # Source code
│ └── lib.rs # Rust code for the game logic
├── www/ # Web assets
│ ├── index.html # HTML file
│ ├── index.js # JavaScript file
│ └── pkg/ # WebAssembly package
│ ├── package.json # JSON package file
│ ├── rust_wasm_game_of_life.js
│ ├── rust_wasm_game_of_life_bg.wasm
│ ├── rust_wasm_game_of_life_bg.wasm.d.ts
│ └── rust_wasm_game_of_life.d.ts
├── target/ # Generated
├── Cargo.toml # Dependencies
├── .gitignore # git ignore file
├── LICENSE # License file
└── README.md # This file
```## Resources
- [Rust](https://www.rust-lang.org/)
- [WebAssembly](https://webassembly.org/)
- [Rust and WebAssembly](https://rustwasm.github.io/book/introduction.html)
- [Conway's Game of Life](https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life)
- [Play Conway's Game of Life](https://playgameoflife.com/)## License
This project is released under the terms of **The Unlicense**, which allows you to use, modify, and distribute the code as you see fit.
- [The Unlicense](https://choosealicense.com/licenses/unlicense/) removes traditional copyright restrictions, giving you the freedom to use the code in any way you choose.
- For more details, see the [LICENSE](LICENSE) file in this repository.## Credits
**Author:** [Scott Grivner](https://github.com/scottgriv)
**Email:** [[email protected]](mailto:[email protected])
**Website:** [scottgrivner.dev](https://www.scottgrivner.dev)
**Reference:** [Main Branch](https://github.com/scottgriv/rust-wasm_game_of_life)---------------