Skip to content

jacobwong98/connect4

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 

Repository files navigation

Connect 4/TOOT and OTTO

Prerequisites

  • Rust toolchain (rustup, rustc, cargo)
  • wasm-pack
  • Run cargo install cargo-generate to get cargo-generate
  • npm

Starting project

  1. Use the following template
    cargo generate --git https://github.com/rustwasm/wasm-pack-template.git --name rust-connect-four
    
  2. cd rust-connect-four
  3. Run wasm-pack build to build the project. This should generate pkg directory
  4. Run npm init wasm-app www
  5. Go into the www directory and run npm install so all initial dependencies are installed
  6. Add the following code into package.json file:
"dependencies": {
    "wasm-connect-four": "file:../pkg"
}
  1. Modify www/index.js change "hello-wasm-pack" to "wasm-connect-four"
  2. Within www directory
npm install
npm run start
  1. Go to localhost:8080 in any browser to see the alert message appear

Notes

When the server is running (after running npm run start):

  • Updates to www will appear automatically
  • Updates to rust files in src appear after running wasm-pack build without taking down server

If there are issues with www being recognized as a submodule after running step 4 (or in general), see this link

About

421 Project part 3 (get ready for pain)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published