mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-21 23:00:43 -08:00
Removed last of the single-letter variables
This commit is contained in:
@@ -134,12 +134,12 @@ async function main() {
|
|||||||
let shouldContinuePlaying = true;
|
let shouldContinuePlaying = true;
|
||||||
|
|
||||||
while (deck.length > 0 && shouldContinuePlaying) {
|
while (deck.length > 0 && shouldContinuePlaying) {
|
||||||
const m1 = deck.shift(); // Take a card
|
const playerCard = deck.shift(); // Take a card
|
||||||
const m2 = deck.shift(); // Take a card
|
const computerCard = deck.shift(); // Take a card
|
||||||
printCards(cards[m1], cards[m2]);
|
printCards(cards[playerCard], cards[computerCard]);
|
||||||
|
|
||||||
const playerCardValue = computeCardValue(m1);
|
const playerCardValue = computeCardValue(playerCard);
|
||||||
const computerCardValue = computeCardValue(m2);
|
const computerCardValue = computeCardValue(computerCard);
|
||||||
if (playerCardValue < computerCardValue) {
|
if (playerCardValue < computerCardValue) {
|
||||||
computerScore++;
|
computerScore++;
|
||||||
print("THE COMPUTER WINS!!! YOU HAVE " + playerScore + " AND THE COMPUTER HAS " + computerScore + "\n");
|
print("THE COMPUTER WINS!!! YOU HAVE " + playerScore + " AND THE COMPUTER HAS " + computerScore + "\n");
|
||||||
|
|||||||
Reference in New Issue
Block a user