Project is build using the create-react-app cli and being deployed over Vercel
Demo - GUI Game is also available
Make sure you've git
, yarn
& nodejs
installed in your system.
Open terminal and follow these steps;
- Step 1: Clone the repo.
git clone https://github.com/ekas/react-rock-paper-scissors
You should now see a react-rock-paper-scissors
folder in your present working directory. Let's change directory to it.
cd react-rock-paper-scissors/
cd GameGUIApp
- Step 2: Frontend Build Instructions. Install dependencies.
yarn install
This will use yarn
to install project dependencies.
- Step 3: Start the frontend project.
yarn start
This will run a local instance of the application http://localhost:3000/
- Step 1: Use following command to run Test cases
yarn run test
- If you would like to add more Game Objects.
- Simply open
src/gameEngine.ts
file you wil find aGameRules
. Add JSON as follows:
{
name: "pencil",
image: "pencil.png",
rules: {
pencil: undefined, //default case when opponet choose the same Object
paper: true
scissors: false,
rock: true,
},
},
Note: Do not forget to add pencil.png in `public/images` folder. Furthermore, Add rule for pencil in other json Objects
- `true` if other object beats pencil
- `false` if other object does notbeats pencil
- Also, add object name
pencil
inGameObjectsType
in filesrc/types/Game.ts
.
- Simple Rock Paper Scissors Game app.
- Choose mode between Player vs Computer or Computer vs Computer.
- For Player vs Computer, user will jump to game screen and then chose a option. After, that a loader for 3 seconds will appear and once the loader finish results will be displayed.
- For Player vs Computer, user will jump to game screen. After, that a loader for 5 seconds will appear and once the loader finish random selection will be done for both players and results will be displayed.