/web3-game

Web3 Application to play Rock, Paper, Scissors, Spock, Lizard

Primary LanguageJavaScriptMIT LicenseMIT

RPS Game

Web3 dApp to play Rock, Paper, Scissors, Spock, Lizard

Table of Contents

About The Project

This project was bootstrapped with Create React App. Built with Web3js and openzeppelin-contracts. Simple dApp to play Rock, Paper, Scissors, Spock, and Lizard with this smart contract: RPS.sol

Game Rules

A Simple Way to Remember Who Wins:

Scissors cuts paper.
Paper covers rock.
Rock crushes lizard.
Lizard poisons Spock.
Spock smashes scissors.
Scissors decapitates lizard.
Lizard eats paper.
Paper disproves Spock.
Spock vaporizes rock.
Rock crushes scissors.

Rock Paper Scissors Lizard Spock en.svg

Tech Stack

Prerequisites

Make sure to have Ganache, Truffle, and NPM installed.

How To Use In Dev?

  1. Get Ganache running locally. Add local Ganache network to Metamask and connect it to the local Ganache instance. Import atleast 2 accounts to metamask.
  2. Navigate to web3-game/:
    cd /path/to/folder/web3-game/
    
  3. Fill in the .env.sample file, and then rename the file to .env.development. Here are some details about the fields in the config file:
    1. REACT_APP_TIMEOUT: Duration before which the other player can recover ETH in case non-activity. Default is 5 minute. (Default=300000)
    2. REACT_APP_POLL_FREQUENCY: Polling frequency to check if the other player has reacted. (Default=5000)
  4. Get dependencies:
    npm install
    
  5. Run the app:
    npm start
    

Contributing

Feel free to fork this repository, make changes, and submit pull requests. Any kind of contributions are welcome!

License

MIT