From cccc85918efe70f18f002661a6864df7f75f3474 Mon Sep 17 00:00:00 2001 From: Chaadrack B Date: Tue, 20 Dec 2022 02:27:17 +0200 Subject: [PATCH] added new file --- 2-js-basics/1-data-types/app.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 2-js-basics/1-data-types/app.js diff --git a/2-js-basics/1-data-types/app.js b/2-js-basics/1-data-types/app.js new file mode 100644 index 00000000..eb102fae --- /dev/null +++ b/2-js-basics/1-data-types/app.js @@ -0,0 +1,24 @@ +const STARTING_POKER_CHIPS = 100; // points +const PLAYERS = 3; +const NO_OF_STARTER_CARDS = 2; +let gameHasEnded = false; + +let playerOneName = "Chloe"; +let playerTwoName = "Jasmine"; +let playerThreeName = "Jen"; + +console.log(`Welcome to Texas Hold'em. The championship title will be awarded to one of these three players: ${playerOneName}, ${playerTwoName}, and ${playerThreeName}. Each player has ${STARTING_POKER_CHIPS} in their pot. We have an exciting game ahead of us. May the best player win!`); + +let playerOnePoints = STARTING_POKER_CHIPS; +let playerTwoPoints = STARTING_POKER_CHIPS; +let playerThreePoints = STARTING_POKER_CHIPS; + +playerOnePoints -= 50; +playerTwoPoints -= 25; +playerThreePoints += 75; + +gameHasEnded = ((playerOnePoints + playerTwoPoints) == 0) || // three has one + ((playerTwoPoints + playerThreePoints) == 0) || // one has won + ((playerOnePoints + playerThreePoints) == 0); // two has won + +console.log("Game has ended: ", gameHasEnded); \ No newline at end of file