Giter Club home page Giter Club logo

aca_211_rockpaperscissors's Introduction

JS211_CurrentDateTimeProjectCircleCI

Austin Coding Academy

JavaScript 211 Project: Rock, Paper, Scissors

Project Checklist

  1. Fork and Clone Rock, Paper, Scissors Repo
  2. Ensure you have installed all dependencies/packages: npm i
  3. Practice running the unit tests for the program:
    • npm test main.js
  4. Use a whiteboard to find a solution to the Rock, Paper, Scissors program
  5. Translate the broad ideas to psuedo code
  6. Convert the psuedo code to real JavaScript Code
  7. Type into your text editor the JavaScript code you've come up with one step at a time
  8. Work through your bugs.
  9. Play the game with the command: node main.js
  10. Achieve green checks for each of your unit tests.


Rock, Paper, Scissors (R.P.S) Overview

Build a function,that will take in an input from a user then another input from another user and compare them against one another to determine the winner of the game!

Project Objective - R.P.S

  1. Build a rock, paper, scissors game.
  2. Use the code plan below to get started.
  3. Start out by white boarding which means writing in English (no code) each step of that needs to be coded.

Code Planning R.P.S

  1. User1 input of rock, paper, or scissors.
  2. User2 input of rock, paper, or scissors.
  3. Compare User1 input to User2 input.
  4. If User1 input is 'rock' and User2 input is 'scissor', User1 wins.
  5. If User1 input is 'rock' and User2 input is 'paper', User2 wins.
  6. If User1 input is 'rock' and User2 input is 'rock', it's a tie.
  7. If User1 input is 'paper' and User2 input is 'rock', User1 wins.
  8. If User1 input is 'paper' and User2 input is 'scissors', User2 wins.
  9. If User1 input is 'paper' and User2 input is 'paper', it's a tie.
  10. If User1 input is 'scissors' and User2 input is 'paper', User1 wins.
  11. If User1 input is 'scissors' and User2 input is 'rock', User2 wins.
  12. If User1 input is 'scissors' and User2 input is 'scissors', it's a tie.

Can you think of a simpler way?

Follow-Up Video - R.P.S

<iframe src="https://player.vimeo.com/video/377156267" width="640" height="360" frameborder="0" allow="autoplay; fullscreen" allowfullscreen></iframe>

Push Yourself Further

  1. What should the program return if the user inputs something that isn't "rock", "paper", or "scissors"?
  2. Can you use .trim() to solve the problem if a user types in a space with their input?
  3. Minimize redundancy: D.R.Y. up your code. Are their ways to not type as much as you've typed? Can you make the code smaller?
  4. Compartmentalize your code into individual functions. This game doesn't have to run just one function, can you pull code blocks out and put them into other functions that can be called from rockPaperScissors?

Hints

  1. Read ALL of the comments in main.js
  2. Read the Objective and Code Planning section above.
  3. Use the JS Docs at MDN to convert long if/else statements to switch case statements.
  4. Push yourself further
  5. Clone, setup, testing, and running instructions for all projects is below

Cloning Your Project

  1. Click the 'Fork' button (choose your account if prompted).

  2. Copy HTTPS URL from your forked repository

  3. In your terminal/gitBash/CommandPrompt navigate (using cd) into a directory where you want to start keeping your repositories. (/jsDevFolder)

  4. Clone your new repository by typing git clone <forked clone URL> (the HTTPS URL you copied above) Forking a repository

  5. Now go into the new directory by using cd project-repo

  6. Add the base repository as an upstream git remote add upstream https://github.com/AustinCodingAcademy/<PROJECT-REPO>.git

  7. Check the configuration of your remotes with git remote -v, it should look very similar to this (except it'll be YOUR username)

$ git remote -v

origin  [email protected]:username/javascript-workbook.git (fetch)
origin  [email protected]:username/javascript-workbook.git (push)
upstream    [email protected]:AustinCodingAcademy/javascript-workbook.git (fetch)
upstream    [email protected]:AustinCodingAcademy/javascript-workbook.git (push)

Setup

  1. From your project directory, run npm i to tell NPM to install all the node modules we use in this class (see package.json)

  2. Use your textEditor (VS Code) to change your files.

  3. When you're finished git status, stage your file git add ., commit your changes git commit -m "functions working", and push to GitHub git push

    git status
    git add .
    git commit -m "Initial Commit"
    git push origin gh-pages
  4. Now go to your forked repository on GitHub (at https://github.com/your-username/javascript-workbook). A little yellow box should have popped up asking you to make a Pull Request. Click to review.

  5. Click "Create Pull Request"

  6. Every time you make a change and push to GitHub, this PR will automatically update. No need to do it more than once.

Running the apps

Simply run node path/to/file.js

example node 01week/rockPaperScissors.js

Running Tests

Tests are a great way to make sure you code works the way you planned it would, and to make sure you don't break something in the future. We will be using them to test our understanding of the lesson. It's also our main way to assign grades for an assignment.

To run a the tests on a file run npm test path/to/file.js, etc.

Running the Linter

Simply run npm run lint

Running the Server

  1. Run npm start
  2. To break out of the server, press ctrl + c

Get latest workbook updates

  1. To get the latest code/homework/test updates, be sure to have a "clean working directory" by committing or removing all of your changes. You check for a "clean working environment" by running git status and making sure no files show up.

  2. Run git pull upstream gh-pages

Contributing workflow

aca_211_rockpaperscissors's People

Contributors

hipperger avatar jillmory avatar

Watchers

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