Coder Social home page Coder Social logo

rspgame-next's Introduction

Introduction

Welcome! This is a web-based game allows you and another player to play additional version of Rock, Paper, and Scissors on chain.

The project focuses on keeping data updated with the blockchain, and preventing players from losing their money (Cryptographically Secure Random Value, timeout responses, e.t...). and some tricks with etherjs. But the prompts of game rules won't be stressed, and players are expected to know the rules before playing.

Rules explained

rules

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.

live demo

game contract for each round

Process

It's a game for two players, if you just want to test the game, it's better to use two browsers.

  1. First-hand creats the game: deploys the game contract, commits its move, assigns the second hand and stakes some money. First-hand will get the game address and salt after creating the game and first hand need to save the salt and send the game address for second hand to play.
  2. Second-hand joins the game with the game contract address provided by the first hand.
  3. Second-hand makes its move and stakes same amount of money as the first hand.
  4. First-hand reveals its move and salt. Result reveals and game over.
  5. If any party doesn't response within 5 minutes, the other party can end the game and get the stake back(if the second-hand didn't join, the first-hand will recieve its stake, and if the fist-hand was unwilling to reveal it's original move, the second-hand will get stakes of both).
  6. You can always restart a new game from landing page, every time the game restarted, a new contract will be deployed.

notes and project structure

  • turbopack is not supported yet
  • components: Reusable components for other projects
  • modules: Project-specific components that may only be reused within the project.
  • Hooks: Common hooks for broader usage.
  • services: Handles data fetching, caching, and state management. Separates data logic from UI elements.
  • Next framework, jotai for data management, tailwind for styling.

Getting Started

First, install dependencies:

npm install
# or
yarn install
# or
pnpm install

Then, run the dev env

npm run dev
# or
yarn dev
# or
pnpm dev

rspgame-next's People

Contributors

ricy137 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.