Lesson Rock Paper Scissors (Lizard Spock)

The project I am asking about it located here.

https://www.codecademy.com/paths/web-development/tracks/getting-started-with-javascript/modules/learn-javascript-functions/projects/rock-paper-scissors-javascript

Basically I wanted to know if the project projects are limited to only the instructions like the lessons are. I was having a bit of fun because the core code worked out great. So I then decided to add lizard and Spock to the game and now it doesn’t work very well not meaning it doesn’t all the time but does quite a bit. Anyway are the projects setup to allow this because they give the impression they are not limited like the lessons?

Projects are free form, self-corrected by the learner so yes, we can pretty much do what we wish. The proviso would be to first complete the project according to instructions, Save it on you local machine fo you have a copy, then play around with your ideas and practice creating the needed logic for your improvements/revision to work as expected.

First, sketch out the win/lose scenarios. Each throw can be defeated by two others, instead of just one.

Search for “Sheldon’s Game”, either the video excerpt or a transciption (or script for the scene) and get Sheldon’s description of what beats what.

Some years ago this topic did come up so there should also be some examples in the forums. I’ll dig around and see if I can find the one I wrote. It should have a link to the above scene.

Having syntax issues with the project rock, paper, and scissors

The above topic has a post that describes an approach. Still looking for other examples.

Thats exactly what I had done was the original game to complete the project but adding more seemed to make it worse. heck I didn’t even get to bomb because it went crazy after lizard and scissors.

const getUserChoice = (userInput) => {userInput = userInput.toLowerCase();
if (userInput === ‘rock’ || userInput === ‘paper’ || userInput === ‘scissors’ || userInput === ‘lizard’ || userInput === ‘spock’ || userInput === ‘bomb’) {
return userInput;
}
else {
console.log(‘Error!’)
}
};

const getComputerChoice = (randomNumber) => {randomNumber = Math.floor(Math.random() * 5);
switch (randomNumber) {
case 0:
return ‘rock’;
case 1:
return ‘paper’;
case 2:
return ‘scissors’;
case 3:
return ‘lizard’;
case 4:
return ‘spock’;
}
};

const determineWinner = (userChoice, computerChoice) => {
if (userChoice === computerChoice) {
return ‘The game is a tie!’;
}

if (userChoice === ‘paper’){
if (computerChoice === ‘scissors’) {
return ‘The Computer Won!’;
} else {
return ‘You Won!’;
}
}

if (userChoice === 'rock'){ 

if (computerChoice === ‘paper’) {
return ‘The Computer Won!’;
} else {
return ‘You Won!’;
}
}

if (userChoice === 'lizard'){ 

if (computerChoice === ‘rock’) {
return ‘The Computer Won!’;
} else {
return ‘You Won!’;
}
}

if (userChoice === ‘scissors’){
if (computerChoice === ‘spock’) {
return ‘The Computer Won!’;
} else {
return ‘You Won!’;
}
}

if (userChoice === ‘lizard’){
if (computerChoice === ‘scissors’) {
return ‘The Computer Won!’;
} else {
return ‘You Won!’;
}
}

if (userChoice === ‘paper’){
if (computerChoice === ‘lizard’){
return ‘The Computer Won!’;
} else {
return ‘You Won!’;
}
}

if (userChoice === ‘spock’){
if (computerChoice === ‘paper’){
return ‘The Computer Won!’;
} else {
return ‘You Won!’;
}
}

if (userChoice === 'rock'){ 

if (computerChoice === ‘spock’){
return ‘The Computer Won!’;
} else {
return ‘You Won!’;
}
}

if (userChoice === 'scissors'){ 

if (computerChoice === ‘rock’){
return ‘The Computer Won!’;
} else {
return ‘You Won!’;
}
}
};

console.log(determineWinner(‘lizard’, ‘scissors’));

const playGame = () => {
const userChoice = getUserChoice(‘lizard’);
const computerChoice = getComputerChoice();
console.log('You threw: ’ + userChoice );
console.log('The computer threw: ’ + computerChoice );
console.log(determineWinner(userChoice, computerChoice));
};

playGame();