chore(curriculum): update rps-game instructions and hasPlayerWonTheRound parameter (#62310)

This commit is contained in:
Giftea ☕
2025-09-25 14:58:34 +01:00
committed by GitHub
parent 1a59985a51
commit 57c515e230
11 changed files with 47 additions and 47 deletions

View File

@@ -9,7 +9,7 @@ dashedName: step-4
In this step, you will focus on determining if the player has won the round.
Create a `hasPlayerWonTheRound` function with two parameters called `player` and `computer`.
Create a `hasPlayerWonTheRound` function with two parameters called `playerChoice` and `computerChoice`. These parameters will take string values of either `"Rock"`, `"Paper"`, or `"Scissors"`, representing the selections made by the player and the computer.
The function should return `true` if the player has won the round, and `false` if the player has lost or tied the round.
@@ -27,10 +27,10 @@ You should have a function called `hasPlayerWonTheRound`.
assert.isFunction(hasPlayerWonTheRound);
```
Your function should have two parameters called `player` and `computer`.
Your function should have two parameters called `playerChoice` and `computerChoice`.
```js
assert.match(code, /hasPlayerWonTheRound\s*(?:=\s*)?\(\s*player\s*,\s*computer\s*\)\s*/);
assert.match(code, /hasPlayerWonTheRound\s*(?:=\s*)?\(\s*playerChoice\s*,\s*computerChoice\s*\)\s*/);
```
Your `hasPlayerWonTheRound` function should return a boolean.

View File

@@ -205,11 +205,11 @@ function getRandomComputerResult() {
return options[randomIndex];
}
function hasPlayerWonTheRound(player, computer) {
function hasPlayerWonTheRound(playerChoice, computerChoice) {
return (
(player === "Rock" && computer === "Scissors") ||
(player === "Scissors" && computer === "Paper") ||
(player === "Paper" && computer === "Rock")
(playerChoice === "Rock" && computerChoice === "Scissors") ||
(playerChoice === "Scissors" && computerChoice === "Paper") ||
(playerChoice === "Paper" && computerChoice === "Rock")
);
}

View File

@@ -240,11 +240,11 @@ function getRandomComputerResult() {
return options[randomIndex];
}
function hasPlayerWonTheRound(player, computer) {
function hasPlayerWonTheRound(playerChoice, computerChoice) {
return (
(player === "Rock" && computer === "Scissors") ||
(player === "Scissors" && computer === "Paper") ||
(player === "Paper" && computer === "Rock")
(playerChoice === "Rock" && computerChoice === "Scissors") ||
(playerChoice === "Scissors" && computerChoice === "Paper") ||
(playerChoice === "Paper" && computerChoice === "Rock")
);
}

View File

@@ -214,11 +214,11 @@ function getRandomComputerResult() {
return options[randomIndex];
}
function hasPlayerWonTheRound(player, computer) {
function hasPlayerWonTheRound(playerChoice, computerChoice) {
return (
(player === "Rock" && computer === "Scissors") ||
(player === "Scissors" && computer === "Paper") ||
(player === "Paper" && computer === "Rock")
(playerChoice === "Rock" && computerChoice === "Scissors") ||
(playerChoice === "Scissors" && computerChoice === "Paper") ||
(playerChoice === "Paper" && computerChoice === "Rock")
);
}

View File

@@ -259,11 +259,11 @@ function getRandomComputerResult() {
return options[randomIndex];
}
function hasPlayerWonTheRound(player, computer) {
function hasPlayerWonTheRound(playerChoice, computerChoice) {
return (
(player === "Rock" && computer === "Scissors") ||
(player === "Scissors" && computer === "Paper") ||
(player === "Paper" && computer === "Rock")
(playerChoice === "Rock" && computerChoice === "Scissors") ||
(playerChoice === "Scissors" && computerChoice === "Paper") ||
(playerChoice === "Paper" && computerChoice === "Rock")
);
}
@@ -491,11 +491,11 @@ function getRandomComputerResult() {
return options[randomIndex];
}
function hasPlayerWonTheRound(player, computer) {
function hasPlayerWonTheRound(playerChoice, computerChoice) {
return (
(player === "Rock" && computer === "Scissors") ||
(player === "Scissors" && computer === "Paper") ||
(player === "Paper" && computer === "Rock")
(playerChoice === "Rock" && computerChoice === "Scissors") ||
(playerChoice === "Scissors" && computerChoice === "Paper") ||
(playerChoice === "Paper" && computerChoice === "Rock")
);
}

View File

@@ -218,11 +218,11 @@ function getRandomComputerResult() {
return options[randomIndex];
}
function hasPlayerWonTheRound(player, computer) {
function hasPlayerWonTheRound(playerChoice, computerChoice) {
return (
(player === "Rock" && computer === "Scissors") ||
(player === "Scissors" && computer === "Paper") ||
(player === "Paper" && computer === "Rock")
(playerChoice === "Rock" && computerChoice === "Scissors") ||
(playerChoice === "Scissors" && computerChoice === "Paper") ||
(playerChoice === "Paper" && computerChoice === "Rock")
);
}

View File

@@ -218,11 +218,11 @@ function getRandomComputerResult() {
return options[randomIndex];
}
function hasPlayerWonTheRound(player, computer) {
function hasPlayerWonTheRound(playerChoice, computerChoice) {
return (
(player === "Rock" && computer === "Scissors") ||
(player === "Scissors" && computer === "Paper") ||
(player === "Paper" && computer === "Rock")
(playerChoice === "Rock" && computerChoice === "Scissors") ||
(playerChoice === "Scissors" && computerChoice === "Paper") ||
(playerChoice === "Paper" && computerChoice === "Rock")
);
}

View File

@@ -218,11 +218,11 @@ function getRandomComputerResult() {
return options[randomIndex];
}
function hasPlayerWonTheRound(player, computer) {
function hasPlayerWonTheRound(playerChoice, computerChoice) {
return (
(player === "Rock" && computer === "Scissors") ||
(player === "Scissors" && computer === "Paper") ||
(player === "Paper" && computer === "Rock")
(playerChoice === "Rock" && computerChoice === "Scissors") ||
(playerChoice === "Scissors" && computerChoice === "Paper") ||
(playerChoice === "Paper" && computerChoice === "Rock")
);
}

View File

@@ -231,11 +231,11 @@ function getRandomComputerResult() {
return options[randomIndex];
}
function hasPlayerWonTheRound(player, computer) {
function hasPlayerWonTheRound(playerChoice, computerChoice) {
return (
(player === "Rock" && computer === "Scissors") ||
(player === "Scissors" && computer === "Paper") ||
(player === "Paper" && computer === "Rock")
(playerChoice === "Rock" && computerChoice === "Scissors") ||
(playerChoice === "Scissors" && computerChoice === "Paper") ||
(playerChoice === "Paper" && computerChoice === "Rock")
);
}

View File

@@ -218,11 +218,11 @@ function getRandomComputerResult() {
return options[randomIndex];
}
function hasPlayerWonTheRound(player, computer) {
function hasPlayerWonTheRound(playerChoice, computerChoice) {
return (
(player === "Rock" && computer === "Scissors") ||
(player === "Scissors" && computer === "Paper") ||
(player === "Paper" && computer === "Rock")
(playerChoice === "Rock" && computerChoice === "Scissors") ||
(playerChoice === "Scissors" && computerChoice === "Paper") ||
(playerChoice === "Paper" && computerChoice === "Rock")
);
}

View File

@@ -195,11 +195,11 @@ function getRandomComputerResult() {
return options[randomIndex];
}
function hasPlayerWonTheRound(player, computer) {
function hasPlayerWonTheRound(playerChoice, computerChoice) {
return (
(player === "Rock" && computer === "Scissors") ||
(player === "Scissors" && computer === "Paper") ||
(player === "Paper" && computer === "Rock")
(playerChoice === "Rock" && computerChoice === "Scissors") ||
(playerChoice === "Scissors" && computerChoice === "Paper") ||
(playerChoice === "Paper" && computerChoice === "Rock")
);
}