Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/javascript-workbook.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

282 changes: 282 additions & 0 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 29 additions & 4 deletions 01week/rockPaperScissors.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
// Student: Jon Gorman
// Class: 211 JavaScript Tue/Thur
// Instructor: Renee Dudley
// Date: 10/10/17
//
//Make a function for rock paper scissors game
//function should include a way to check for a tie
//function should include a way to check for player one win
//function should include a way to check for player two win
//function should have a way to check that game is played correctly i.e.(no use of words other tha those needed for game
'use strict';

const assert = require('assert');
Expand All @@ -8,10 +18,21 @@ const rl = readline.createInterface({
});


function rockPaperScissors(hand1, hand2) {

// Write code here

function rockPaperScissors(a, b) {
// make variables that allow the function to pass the test ie. lowercase and whitespace.
const hand1 = a.toLowerCase().trim();
const hand2 = b.toLowerCase().trim();
//check for a tie
if (hand1 === hand2) {
return "It's a tie!";
// Write code here
// Check for hand one win
} else if (hand1 === 'rock' && hand2 === 'scissors' || hand1 === 'paper' && hand2 === 'rock' || hand1 === 'scissors' && hand2 === 'paper') {
return "Hand one wins!"
//Check for player two win
} else if (hand1 === 'rock' && hand2 === 'paper' || hand1 === 'paper' && hand2 === 'scissors' || hand1 === 'scissors' && hand2 === 'rock') {
return "Hand two wins!"
}
}

function getPrompt() {
Expand Down Expand Up @@ -49,3 +70,7 @@ if (typeof describe === 'function') {
getPrompt();

}
//"good programmers look both ways before crossing one way street"
//// else if (hand1 && hand2 !== 'rock', 'paper', 'scissors'){
// return "\sYour tryig to play a different game!\s"
// }