alefnsc / react-jan-ken-pon-web

A simple Player vs Computer Jan Ken Pon game using React.js

Home Page:https://react-jan-ken-pon-web-afonseca.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Table of Contents

  1. Overview
  2. Components
  3. Game Logic
  4. Additional Features
  5. Project Structure
  6. Deployment
  7. How to Run Locally
  8. Contact

Jan Ken Pon Web App

Check out the live demo!

Home Screen Instructions Modal Game Board - Timer Game Board - Move

1. Overview

This project is a React-based implementation of the classic Jan Ken Pon (Rock, Paper, Scissors) game. It includes features such as a timer for move showing, dynamic display of player and computer moves, game status tracking, and a responsive layout. The project utilizes react-icons, react-toastify, and Tailwind for styling.

2. Components

  • Header: Displays the name of the game.
  • Main: Encompasses all application components.
  • Score: Shows the current game status.
  • Control: Handles player moves.
  • GameBoard: Displays timer and player/computer moves.
  • Home: Displays a friendly Home Page enabling to start the game.
  • Instructions: Provide a modal for displaying the instructions of the game.

3. Game Logic

  • Move Type: A standardized type for controlling moves.
  • MoveHelpers: Manages move types, options, and possible outcomes.
  • Result Function: Calculates the game result.
  • RandomMove Function: Generates a random move for the computer.
  • Logic: Implements the game logic using states such as player1Win, player2Win, player1Move, player2Move, and score.
  • useEffect Statements: Handle game logic and synchronize values across the application.

4. Additional Features

  • Toast Notifications: Utilizes react-toastify to provide alerts about round results.

5. Project Structure

  • GameBoard Component: it handles the game layout.
  • Home Page: Includes instructions and a modal for additional information.
  • Business Rule: The game runs in matches of three rounds, and the player who wins three rounds first wins the match.
  • Hooks: Created hooks for opening/closing the game and showing/hiding the modal.

6. Deployment

The project is deployed on Vercel. During deployment, there were some issues due to a deprecated type of react-toastify. Refer to the deployment section for troubleshooting details.

7. How to Run Locally

To run the project locally, follow these steps:

  1. Clone the repository: git clone https://github.com/alefnsc/react-jan-ken-pon-web.git
  2. Install dependencies: npm install
  3. Start the development server: npm run dev

Feel free to contribute and keep rocking!

8. Contact

About

A simple Player vs Computer Jan Ken Pon game using React.js

https://react-jan-ken-pon-web-afonseca.vercel.app


Languages

Language:TypeScript 86.4%Language:CSS 7.4%Language:JavaScript 4.0%Language:HTML 2.2%