Skip to content

One of the first few JavaScript projects I will be taking on

Notifications You must be signed in to change notification settings

sanjoliwatts/Rock-Paper-Scissors

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Rock-Paper-Scissors

One of the first few JavaScript projects I will be taking on This project is a take on the traditional rock paper scissors game, details of which can be found here.

Motivation

I started out with the very informative courses at The Odin Project and have begun with Web Development 101. This part was one of the many sub-projects I shall be taking on in the Javascript Basics portion. The entire exercise is proving to be a very good learning experience.

Screenshots

Tech/Framewroks Used

Nothing fancy just same old HTML5, CSS3 and Javascript

Features

  • Clean minimal design
  • Material design cards
  • Harmonius colours
  • Executes the requirements of the game perfectly

Code Example

Below is one of the main functions in Javascript used to find the outcome of a single round:

function computerPlay(playerSelection){
    sel=selection
    let arr=['rock','paper','scissors']
    let computerSelection=randomselect(arr)

    if(computerSelection===playerSelection){
        return ['T','-1']
    }
    else{
        if(computerSelection==='rock'){
            if(sel==='paper'){
                return ['W','1']
            }
            else if(sel==='scissors'){
                return ['L','0']
            }
        }
        else if(computerSelection==='paper'){
            if(sel==='rock'){
                return ['L','0']
            }
            else if(sel==='scissors'){
                return ['W','1']
            }
        }
        else if(computerSelection==='scissors'){
            if(sel==='rock'){
                return ['W','1']
            }
            else if(sel==='paper'){
                return ['L','0']
            }
        }
    }

}

How to Play?

Find the game here

Credits

©Ipshita Chatterjee | 2018

Made for the project that can be found here

About

One of the first few JavaScript projects I will be taking on

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 43.0%
  • HTML 34.0%
  • CSS 23.0%