Giter Club home page Giter Club logo

rock-paper-scissors's Introduction

Making a plan

  1. HTML & CSS -text - explain rules - list? -create radio buttons & group for rock, paper, scissors -play button -display wins, losses, and total games played -display result of each game: indicate what the computer threw and what the result was (win, loss, draw, total)

  2. JS -FUNCTIONS -getRandomThrow (impure) - in its own module -generate random # and transform into rock, paper, or scissors -return STRING -didUserWin (pure so TDD) -two parameters: player, computer -returns one of: win (player beats computer) loss (computer beats player) draw (throws identical) -nine possible outcomes; test each one at a time -3 x 3: player(rock v paper v scissors), computer(rock v paper v scissors) -APP -import functions -get needed DOM elements with querySelector -selected radio button (rock/paper/scissors) -play button -elements to display: -win, loss, or draw -total wins, losses, draws, games in current round -set initial state (let) -initial wins, losses, draws, total games in current round -use event handler to get checked radio button when "play" is clicked document.querySelector('input:checked')

-What should happen when user clicks the play button? -event listener -use querySelector to determine which radio button was selected -run getRandomThrow to generate computer's throw -run didUserWin to determine outcome of game -use outcome to increment wins/draws/losses -total can be derived -display outcome of game to user -display updated wins/draws/losses to user -reset radio button??

STRETCH:

  1. Add reset button
  2. Display how many times reset button was clicked
  3. TDD getRandomThrow function

rock-paper-scissors's People

Contributors

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