Code Monkey home page Code Monkey logo

rock-paper-scissors's Introduction

Rock Paper Scissors

The game

Welcome to the Rock Paper Scissors GitHub project! This repository contains the code for a simple implementation of the classic game "Rock Paper Scissors". It provides a retro game user interface (UI) for players to interact with and play the game.

Table of Contents

Project Description

The project aims to provide a user-friendly version of the popular game "Rock Paper Scissors". The game follows the traditional rules: the user select either rock, paper, or scissors, and the computer randomnly select its choice. The round winner, awarded with +1 point, is determined based on the game's rules: rock beats scissors, scissors beats paper, and paper beats rock. First to score 5 points wins the game.

The project is implemented in Vanilla JavaScript.

Features

  • Play Rock Paper Scissors against the computer.
  • User-friendly interface with buttons for player input.
  • Real-time updates of the game result and score.
  • Option to reset the game and start over.

Repository Structure

The repository hase the following structure:

  • img/: Directory that holds the image assets used in the user interface.
  • index.html: The main HTML file that contains the user interface and game logic.
  • script.js: The JavaScript file that handles the game functionality.
  • style.css: The CSS file that styles the user interface.
  • README.md: The README file that provides an overview of the project and instructions for running the game.

How to Play

You can play the live version of the game here.

Installation

To run this project locally, follow these steps:

  1. Clone the repository:

    git clone https://github.com/sofiabaezzato/rock-paper-scissors.git
  2. Navigate to the project directory:

    cd rock-paper-scissors

Usage

  1. Open the index.html file in your preferred web browser.
  2. Select either "Rock," "Paper," or "Scissors" by clicking on the corresponding button.
  3. The computer will randomly select its move.
  4. The result of the round will be displayed, along with the updated scores.
  5. To start a new game, click on the "Reset" button.

Project Reflections

  1. This is the first project I completed entirely from scratch, without any assistance or guidance.
  2. This project has allowed me to gain more confidence in JavaScript, specifically in DOM manipulation using the addEventListener() method and getElementById() method.
  3. Other important concepts that I have learned to use, hopefully correctly, are variables, scope, and hoisting.
  4. Even though I had a clear vision of the entire project from the beginning, translating that into clean code proved to be extremely challenging. In the end, the code functions as intended, but I acknowledge that it may appear messy and the logic could be simplified. I hope to improve my skills in writing cleaner and more concise code in the future.
  5. In the end, I added a function that displays random sentences of victory or defeat. I thought it would be a nice touch to conclude this awesome project.

rock-paper-scissors's People

Contributors

sofiabaezzato 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.