Code Monkey home page Code Monkey logo

rockpaperscissors's Introduction

Rock Paper Scissors Project

Overview:

In this unit, coders will create a Rock, Paper, Scissors game. To create this project, coders will use JavaScript to take user input, use the Math Library to pick a random computer choice, and use conditionals to determine the winner.

Day 1

Planning

Set-Up

JavaScript

  • Use JavaScript to display the value of the input on the page

HTML and CSS

  • Add any more HTML elements you will need to the page
  • Customize your HTML with CSS

Wrap

  • Save and submit your website using the link on the session agenda.

Day 2

Javascript

  • Outside of your click handler, declare the variables you'll need to track the user choice, computer choice and winner and assign them values of empty strings.
  • Outside of your click handler, declare a randomNumber variable and set it equal to 0
  • When the user initiates the game, generate a random number and assign it to the randomNumber variable.
  • When the user initiates the game, store the user choice.
  • When the user initiates the game, display user choice to the screen.

Wrap

  • Save and submit your website using the link on the session agenda.

Day 3

JavaScript

  • Write a conditional statement which, given the number range of randomNumber, assigns ‘rock’, ‘paper’ or ‘scissors’ to the variable that holds the computer choice.
  • Display the computer choice to the screen.
  • Write conditional statements that compare the user choice to the computer choice to determine the winner of the game.
  • Display the winner to the screen.
  • Clear the input value once a result is displayed.

Wrap

  • Save and submit your website using the link on the session agenda.

Projects Extensions:

  • Style your page to fit the developer's personality
  • Validate the input so that it will return “Not valid input” if the user types in a wrong choice.
  • Accept any form of a word regardless of capitalization (i.e. “Rock” “rock” roCk”)
  • Keep track of total wins and losses, until the page refreshes.
  • Allow for more variety in throwing options. Example: Rock-Paper-Scissors-Lizard-Spock

References/Tools

rockpaperscissors's People

Contributors

pwjablonski avatar ericascripted avatar emilygarvey avatar jewelsy avatar gilbertghang avatar carolynnjimenez avatar

Watchers

James Cloos 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.