From ca06e9cff77107ee1a1b5167506a93ffd6519d3c Mon Sep 17 00:00:00 2001 From: Dequisa Date: Sun, 20 Dec 2020 18:04:01 -0500 Subject: [PATCH 01/11] starter --- .gitignore | 1 + package-lock.json | 19 ++++++++- textBasedAdventure.js | 94 +++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 110 insertions(+), 4 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..40b878d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules/ \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 4e5e2be..c047f7c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,8 +1,25 @@ { "name": "FSW-Text-Based-Adventure", "version": "1.0.0", - "lockfileVersion": 1, + "lockfileVersion": 2, "requires": true, + "packages": { + "": { + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "readline-sync": "^1.4.10" + } + }, + "node_modules/readline-sync": { + "version": "1.4.10", + "resolved": "https://registry.npmjs.org/readline-sync/-/readline-sync-1.4.10.tgz", + "integrity": "sha512-gNva8/6UAe8QYepIQH/jQ2qn91Qj0B9sYjMBBs3QOB8F2CXcKgLxQaJRP76sWVRQt+QU+8fAkCbCvjjMFu7Ycw==", + "engines": { + "node": ">= 0.8.0" + } + } + }, "dependencies": { "readline-sync": { "version": "1.4.10", diff --git a/textBasedAdventure.js b/textBasedAdventure.js index d392b19..0de729b 100644 --- a/textBasedAdventure.js +++ b/textBasedAdventure.js @@ -1,5 +1,93 @@ -const readline1 = require('readline-sync') + const readline = require('readline-sync') +// const { quitGame } = require('../Guessing-Game-cli-lab/game') +// let yourVariableHere = readline.question() +let nameInput = readline.question("And you're name dear?: ") +let restart = readline.question("would you like to play the game?") +//let nameInput = readline.question("Enter your name: ") -let nameInput = readline.question("Enter your name: ") +function investment(type, amount){} +function bidAmount +function randomNumber(number){ + return Math.floor(Math.random * 100) +} +function beginingDialogue (){ + console.log('Greetings. My name is Debonaire.') + let nameInput = readline.question("And you're name dear?: ") + console.log(`${nameInput}, ...${nameInput} I think I knew a ${nameInput} once.`) + console.log('Peculiar indivisual') + console.log("Anyway. I am your long lost cousin's brother's aunt. Three times removed. Or something of that sorts.") + console.log("My point is, you're family. And as family, I've been instructed to give you a portion of the family's wealth") + if(readline.keyInYN("Are you interested in a portion of our family's wealth?:") + {console.log("Of course you do. Who doens't love free money")} else { + console.log("That's okay, I have a proposition for you either way") + } + console.log(" I can't just hand over the money, my dear. At least not without knowing if you're responsible enought to handle it") + console.log("You'll have to prove yourself. ") + console.log("How do you prove yourself? I am glad you asks") + console.log(`I have a test for you, ${nameInput}. A game, if that suits you better`) + console.log(restart) + if(restart.toUpperCase === 'YES'){ + console.log("Wonderful darling. Let me explain the rules") + } else { + console.log("Well, riches aren't for everyone. Ill be on my way then. Goodbye, dear") + quitGame() + } +} -console.log(`Hello ${nameInput}! Welcome to my game.`) +function randomInvestingResponse(){} +function randonBankingResponse(){} +function bankAccount (money){ + return savedAmount + investment + console.log() +} +investments = ["Stocks", "Bonds", "Options", "Annuities", "Precious Metals", "Mutual Fund", "Real Estate"] + +// console.log(`Hello ${nameInput}! Welcome to my game.`) + + +// Lets the user choose an item from list: +// animals = ['Lion', 'Elephant', 'Crocodile', 'Giraffe', 'Hippo'], +// index = readlineSync.keyInSelect(animals, 'Which animal?'); +// console.log('Ok, ' + animals[index] + ' goes to your room.'); + + +//Produces a visual ranger a user can slide back and forth +// An UI like the Range Slider: +// (Press Z or X key to change a value, and Space Bar to exit) +// var readlineSync = require('readline-sync'), +// MAX = 200, MIN = 0, value = 30, key; +// console.log('\n\n' + (new Array(20)).join(' ') + +// '[Z] <- -> [X] FIX: [SPACE]\n'); +// while (true) { +// console.log('\x1B[1A\x1B[K|' + +// (new Array(value + 1)).join('-') + 'O' + +// (new Array(MAX - value + 1)).join('-') + '| ' + value); +// key = readlineSync.keyIn('', +// {hideEchoBack: true, mask: '', limit: 'zx '}); +// if (key === 'z') { if (value > MIN) { value--; } } +// else if (key === 'x') { if (value < MAX) { value++; } } +// else { break; } +// } +// console.log('\nA value the user requested: ' + value); + + +// prosperity-game name OR Bank or Bust + +// start game + +startGame = () =>{ +beginingDialogue() + + +} +//randomly generate number +// Math.floor(Math.random()* 100) +console.log(startGame()) +//end game +//const quitGame = () => {} + +//game loops +//const gameLoop = () => {} + +// start game +// const startGame = () =>{} \ No newline at end of file From 43aaf1a4f09dc1af03883a0ba683de845c5b9f5b Mon Sep 17 00:00:00 2001 From: Dequisa Date: Tue, 29 Dec 2020 11:12:06 -0500 Subject: [PATCH 02/11] Second Draft --- scrapPaper.js | 16 +++ textBasedAdventure.js | 220 +++++++++++++++++++++++++++++++++--------- 2 files changed, 191 insertions(+), 45 deletions(-) create mode 100644 scrapPaper.js diff --git a/scrapPaper.js b/scrapPaper.js new file mode 100644 index 0000000..d8799b4 --- /dev/null +++ b/scrapPaper.js @@ -0,0 +1,16 @@ +const readline = require('readline-sync') + +const introGameSequence = () => { + + let age = readline.questionInt + age('Verify your age: \n'); + if (age >= 18) { + console.log('Proceed with caution!'); + // loadingVisual() + } else { + console.log('You are too young for the underbelly of the silver web'); + process.exit() + } +} + + introGameSequence() \ No newline at end of file diff --git a/textBasedAdventure.js b/textBasedAdventure.js index 0de729b..ab5f836 100644 --- a/textBasedAdventure.js +++ b/textBasedAdventure.js @@ -1,54 +1,191 @@ - const readline = require('readline-sync') + const { Console } = require('console') +const { monitorEventLoopDelay } = require('perf_hooks') +const readline = require('readline-sync') +const { start } = require('repl') + const startGame = () => { + play() + } + const leaveGame = () => { + console.log("It's been a pleasure. Bye Bye!") + } + + // const { quitGame } = require('../Guessing-Game-cli-lab/game') // let yourVariableHere = readline.question() -let nameInput = readline.question("And you're name dear?: ") -let restart = readline.question("would you like to play the game?") +// let nameInput = readline.question("And your name dear?: ") //let nameInput = readline.question("Enter your name: ") -function investment(type, amount){} -function bidAmount -function randomNumber(number){ - return Math.floor(Math.random * 100) -} -function beginingDialogue (){ +// function investment(type, amount){} +// function bidAmount(){} +// function randomNumber(number){ +// return Math.floor(Math.random * 100) +// } + +// // let pause = setTimeout(function() { +// // alert('Hello, Mr. Universe!'); +// // }, 2000) + + + +// while (true) { +// input = readlineSync.prompt(); +// console.log('-- You said "' + input + '"'); +// if (input === 'bye') { +// break; +// } +// } + + + + // setTimeout(() => console.log(beginingDialogue), 1000) + + const introduction = () => { + console.log('Greetings. My name is Debonaire.') - let nameInput = readline.question("And you're name dear?: ") - console.log(`${nameInput}, ...${nameInput} I think I knew a ${nameInput} once.`) - console.log('Peculiar indivisual') + let nameInput = readline.question("And your name dear?: ") + console.log(`${nameInput}, ...${nameInput} I think I knew a ${nameInput} once.`,'Peculiar indivisual') console.log("Anyway. I am your long lost cousin's brother's aunt. Three times removed. Or something of that sorts.") console.log("My point is, you're family. And as family, I've been instructed to give you a portion of the family's wealth") - if(readline.keyInYN("Are you interested in a portion of our family's wealth?:") - {console.log("Of course you do. Who doens't love free money")} else { - console.log("That's okay, I have a proposition for you either way") + + let playGame = readline.question("Are you interested in a portion of our family's wealth?:") + console.log(playGame) + if(playGame = 'yes'){console.log("Of course you are. Who doesn't love free money")} else if (playGame = 'no') { + console.log("That's okay, I have a proposition for you either way") +} else { console.log(playgame)} + + +console.log("Unfortuantely, I can't just hand over the money, my dear. At least not without knowing if you're responsible enought to handle it") +console.log("You'll have to prove yourself. ") +console.log("How do you prove yourself? I am glad you asks") +console.log(`I have a test for you, ${nameInput}. A game, if that suits you better`) + +if(readline.keyInYN('Do you want to play?')){ + play() +} else{ + leaveGame() +} +} + + +const rules = () =>{ + console.log('Okay, here are the rules. You can choose to invest or save your money. You have 15 days to make $5000 or more.') + console.log("When you are ready to invest you can enter investment type plus amount. Example stocks 2 dollars. Or you can choose not to invest by typing the word 'bank'.") + console.log('Good Luck!') } - console.log(" I can't just hand over the money, my dear. At least not without knowing if you're responsible enought to handle it") - console.log("You'll have to prove yourself. ") - console.log("How do you prove yourself? I am glad you asks") - console.log(`I have a test for you, ${nameInput}. A game, if that suits you better`) - console.log(restart) - if(restart.toUpperCase === 'YES'){ - console.log("Wonderful darling. Let me explain the rules") + rulesInstructions() + rules() + + +const investmentsHelp = (bid)=>{ + switch(bid){ + case stocks: + console.log('Stock of a corporation is all of the shares into which ownership of the corporation is divided. A single share of the stock represents fractional ownership of the corporation in proportion to the total number of shares.') + break; + case bonds: + console.log('In finance, a bond is an instrument of indebtedness of the bond issuer to the holders. Bonds can be in mutual funds or can be in private investing where a person would give a loan to a company or the government.') + break; + case options: + console.log('In finance, an option is a contract which conveys its owner, the holder, the right, but not the obligation, to buy or sell an underlying asset or instrument at a specified strike price prior to or on a specified date, depending on the form of the option') + break; + case annuities: + console.log('An annuity is a financial product that pays out a fixed stream of payments to an individual, and these financial products are primarily used as an income stream for retirees.') + break; + case precious-metals-ira: + console.log('Precious metals IRA is an Individual Retirement Account in which physical gold or other approved precious metals are held in custody for the benefit of the IRA account owner. It functions the same as a regular IRA, only instead of holding paper assets, it holds physical bullion coins or bars.') + break; + case mutual-funds: + console.log('A mutual fund is an open-end professionally managed investment fund that pools money from many investors to purchase securities.') + break; + case reit: + console.log('A real estate investment trust is a company that owns, and in most cases operates, income-producing real estate.') + break; + case cryptocurrency: + console.log('A cryptocurrency is a digital or virtual currency that is secured by cryptography, which makes it nearly impossible to counterfeit or double-spend.') + break; + case forex: + console.log('Foreign Exchange (forex or FX) is the trading of one currency for another.') + break; + case ipo-stocks: + console.log('An initial public offering (IPO) refers to the process of offering shares of a private corporation to the public in a new stock issuance.') + break; + default:console.log('Please check your spelling and re-type in your investment choice in all lower case letters.') + investmentsHelp(bid) + } + play() + } + +introduction() + const play = () => { + rules() + morningGreeting() + + + + if(userInput = 'bank'){ + deposit = deposit + profit + + eveningGreeting() + } +} +function eveningGreeting(){ + console.log("You worked all day. It is now 3:59.") + let marketClosed = readline.question("What do you want to do with your money?") +} +function morningGreeting(){ + console.log("Its 9:29am. Markets open at 9:30am") + let marketOpen = readline.question("What will you invest in today?") +console.log('*The morning sunlight hits your eyes as Debornaire opens the curtains to yoru bedroom. \n Good Morning Sunshine. You didn\'t think I would abandon you on your journey to riches, did you? Of course not!') +const breakfast = () => { + breakfastFoods = ['Eggs', 'Cereal', 'Spinach'] + index = readlineSync.keyInSelect(breakfastFoods, "I've made breakfast for you! which breakfask would you like?:") + if(breakfastFoods === 'eggs'||breakfastFoods === 'Eggs' ){ + console.log('Delicious') + + } else if (breakfastFoods === 'Cereal' || breakfastFoods === 'cereal'){ + console.log('Buget food. Perhaps you can work on changing old habits') + // subtract 10 dollars from daily balance + + } else if (breakfastFoods === 'Spinach' || breakfastFoods === 'spinach'){ + Console.log('Great choice! The food of wealth.') + // Add 10 dollars to daily balance + } else { - console.log("Well, riches aren't for everyone. Ill be on my way then. Goodbye, dear") - quitGame() + command = readlineSync.prompt({ + limit: ['add', 'remove'], + limitMessage: 'Refused $ you requested. Please input another.' + }) } } +} -function randomInvestingResponse(){} -function randonBankingResponse(){} -function bankAccount (money){ - return savedAmount + investment - console.log() +function randomInvestingResponse(){ + } -investments = ["Stocks", "Bonds", "Options", "Annuities", "Precious Metals", "Mutual Fund", "Real Estate"] +// function randonBankingResponse(){} +// function bankAccount (money){ +// return savedAmount + investmentGains +// console.log() +// } + -// console.log(`Hello ${nameInput}! Welcome to my game.`) +function rulesInstructions(){ + console.log('So, Its simply. Ill give you $500.\n You can bank it or you can invest it. Either way, you have 15 days to turn that $500 into $5000 or more.') + console.log('Each day you will be given a chance to choose what you want to invest in for that day and how much money you want to invest. Remeber, you dont have to invest') + console.log('I should warn you; Investment can be tricky. You can earn money or lose it. Different investment options have differnt perks, payouts times and consequences. So invest wisely.') + console.log("If by the end of day 15 you have $5000 dollars or more, You will recieve your share of the familie's wealth.") + console.log('However, make $4999 or less and....well....lets say youll win the right to grind the 9-5 like all the other saps') + console.log("Again, choose wisely. You can get a brief explaination of each investment type by entering '?' and the type of investment. Example ?Stocks") + console.log("When you are ready to invest you can enter investment type plus amount. Example stocks 2 dollars. Or you can choose not to invest by typing the word 'bank'.") + console.log("You can also type in 'rules' to get a reminder of the rules") + console.log(" Well, thats all. Happy Investings!") + +} +// var readlineSync = require('readline-sync'), +// investments = ["Stocks", "Bonds", "Options", "Annuities", "Precious-Metals", "Mutual-Fund", "Real-Estate", "REIT", "Cryptocurrency", "Forex", "IPO stocks"], +// index = readlineSync.keyInSelect(investments, 'Which invesetment type'); +// console.log('okay, ' + investments[index] + ' is your investment of choice!') -// Lets the user choose an item from list: -// animals = ['Lion', 'Elephant', 'Crocodile', 'Giraffe', 'Hippo'], -// index = readlineSync.keyInSelect(animals, 'Which animal?'); -// console.log('Ok, ' + animals[index] + ' goes to your room.'); //Produces a visual ranger a user can slide back and forth @@ -73,21 +210,14 @@ investments = ["Stocks", "Bonds", "Options", "Annuities", "Precious Metals", "Mu // prosperity-game name OR Bank or Bust -// start game - -startGame = () =>{ -beginingDialogue() - -} //randomly generate number // Math.floor(Math.random()* 100) -console.log(startGame()) -//end game -//const quitGame = () => {} +// console.log(startGame()) +// end game +const quitGame = () => {} //game loops //const gameLoop = () => {} // start game -// const startGame = () =>{} \ No newline at end of file From 097844544cbac8367b11b044454bcf93d046b2ff Mon Sep 17 00:00:00 2001 From: Dequisa Date: Sat, 2 Jan 2021 15:21:07 -0500 Subject: [PATCH 03/11] Third Update --- package-lock.json | 184 +++++++++++++ package.json | 4 + textBasedAdventure.js | 588 ++++++++++++++++++++++++++++++------------ 3 files changed, 604 insertions(+), 172 deletions(-) diff --git a/package-lock.json b/package-lock.json index c047f7c..ba58dfc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,9 +8,102 @@ "version": "1.0.0", "license": "ISC", "dependencies": { + "chalk": "^4.1.0", + "colors": "^1.4.0", + "each-async": "^1.1.1", + "indent-string": "^4.0.0", "readline-sync": "^1.4.10" } }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/chalk": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", + "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "node_modules/colors": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz", + "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==", + "engines": { + "node": ">=0.1.90" + } + }, + "node_modules/each-async": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/each-async/-/each-async-1.1.1.tgz", + "integrity": "sha1-3uUim98KtrogEqOV4bhpq/iBNHM=", + "dependencies": { + "onetime": "^1.0.0", + "set-immediate-shim": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/indent-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", + "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", + "engines": { + "node": ">=8" + } + }, + "node_modules/onetime": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-1.1.0.tgz", + "integrity": "sha1-ofeDj4MUxRbwXs78vEzP4EtO14k=", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/readline-sync": { "version": "1.4.10", "resolved": "https://registry.npmjs.org/readline-sync/-/readline-sync-1.4.10.tgz", @@ -18,13 +111,104 @@ "engines": { "node": ">= 0.8.0" } + }, + "node_modules/set-immediate-shim": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz", + "integrity": "sha1-SysbJ+uAip+NzEgaWOXlb1mfP2E=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } } }, "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", + "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "colors": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz", + "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==" + }, + "each-async": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/each-async/-/each-async-1.1.1.tgz", + "integrity": "sha1-3uUim98KtrogEqOV4bhpq/iBNHM=", + "requires": { + "onetime": "^1.0.0", + "set-immediate-shim": "^1.0.0" + } + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" + }, + "indent-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", + "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==" + }, + "onetime": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-1.1.0.tgz", + "integrity": "sha1-ofeDj4MUxRbwXs78vEzP4EtO14k=" + }, "readline-sync": { "version": "1.4.10", "resolved": "https://registry.npmjs.org/readline-sync/-/readline-sync-1.4.10.tgz", "integrity": "sha512-gNva8/6UAe8QYepIQH/jQ2qn91Qj0B9sYjMBBs3QOB8F2CXcKgLxQaJRP76sWVRQt+QU+8fAkCbCvjjMFu7Ycw==" + }, + "set-immediate-shim": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz", + "integrity": "sha1-SysbJ+uAip+NzEgaWOXlb1mfP2E=" + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "requires": { + "has-flag": "^4.0.0" + } } } } diff --git a/package.json b/package.json index 8e8b06f..cec94d3 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,10 @@ }, "homepage": "https://github.com/joinpursuit/FSW-Text-Based-Adventure#readme", "dependencies": { + "chalk": "^4.1.0", + "colors": "^1.4.0", + "each-async": "^1.1.1", + "indent-string": "^4.0.0", "readline-sync": "^1.4.10" } } diff --git a/textBasedAdventure.js b/textBasedAdventure.js index ab5f836..b48219d 100644 --- a/textBasedAdventure.js +++ b/textBasedAdventure.js @@ -2,222 +2,466 @@ const { monitorEventLoopDelay } = require('perf_hooks') const readline = require('readline-sync') const { start } = require('repl') +const colors = require('colors'); +const chalk = require("chalk"); +const { read } = require('fs'); +const { kStringMaxLength } = require('buffer'); + + +const stringOne = 'This is a plain string.'; +const stringTwo = 'This string is red.'.red; +const stringThree = 'This string is blue.'.blue; +const today = new Date().toLocaleDateString(); // returns today's date in mm/dd/yyyy format + +console.log(stringOne.black.bgMagenta); +console.log(stringOne.yellow.bgRed.bold); +console.log(`Today is: ${today}`.black.bgGreen); + +console.log(stringTwo); +console.log(stringThree); + +console.log(stringTwo.magenta); +console.log(stringThree.grey.bold); + + + + +// const fruitFunction = () => { +// array = ['Eggs', 'Cereal', 'Spinach','Bacon'] +// console.log("What is your favorite fruit?") +// fruitChoice = readline.keyInSelect(array) +// // fruitChoice === array[fruitChoice] +// if(fruitChoice === 1){ +// console.log(chalk.greenBright('Delicious')) +// } else{ +// console.log(chalk.green('Buget food. Perhaps you can work on changing old habits')) +// // subtract 10 dollars from daily balance + +// } +// } +// fruitFunction () + + +const investmentsHelp = (bid)=>{ + switch(bid){ + case stocks: + console.log('Stock of a corporation is all of the shares into which ownership of the corporation is divided. A single share of the stock represents fractional ownership of the corporation in proportion to the total number of shares.') + return 100 + break; + case bonds: + console.log('In finance, a bond is an instrument of indebtedness of the bond issuer to the holders. Bonds can be in mutual funds or can be in private investing where a person would give a loan to a company or the government.') + return -500 + break; + case options: + console.log('In finance, an option is a contract which conveys its owner, the holder, the right, but not the obligation, to buy or sell an underlying asset or instrument at a specified strike price prior to or on a specified date, depending on the form of the option') + return -200 + break; + case annuities: + console.log('An annuity is a financial product that pays out a fixed stream of payments to an individual, and these financial products are primarily used as an income stream for retirees.') + return 50 + break; + case precious-metals-ira: + console.log('Precious metals IRA is an Individual Retirement Account in which physical gold or other approved precious metals are held in custody for the benefit of the IRA account owner. It functions the same as a regular IRA, only instead of holding paper assets, it holds physical bullion coins or bars.') + return 300 + break; + case mutual-funds: + console.log('A mutual fund is an open-end professionally managed investment fund that pools money from many investors to purchase securities.') + return -100 + break; + case reit: + console.log('A real estate investment trust is a company that owns, and in most cases operates, income-producing real estate.') + return -100 + break; + case cryptocurrency: + console.log('A cryptocurrency is a digital or virtual currency that is secured by cryptography, which makes it nearly impossible to counterfeit or double-spend.') + return 500 + break; + case forex: + console.log('Foreign Exchange (forex or FX) is the trading of one currency for another.') + return 500 + break; + case ipo-stocks: + console.log('An initial public offering (IPO) refers to the process of offering shares of a private corporation to the public in a new stock issuance.') + return 1000 + break; + default:console.log('Please check your spelling and re-type in your investment choice in all lower case letters.') + investmentsHelp(bid) + } + play() + } + +say = '...says the stranger.' + + + +let balance = 2000 + + const startGame = () => { - play() +play() } const leaveGame = () => { console.log("It's been a pleasure. Bye Bye!") + process.exit() } + const quitGame = () => { + leaveGame() + } + - -// const { quitGame } = require('../Guessing-Game-cli-lab/game') -// let yourVariableHere = readline.question() -// let nameInput = readline.question("And your name dear?: ") -//let nameInput = readline.question("Enter your name: ") - -// function investment(type, amount){} -// function bidAmount(){} -// function randomNumber(number){ -// return Math.floor(Math.random * 100) -// } + const gameLoop = () => { -// // let pause = setTimeout(function() { -// // alert('Hello, Mr. Universe!'); -// // }, 2000) + } +let amount = '' + const investmentTypes = () => { + investments = ["Stocks", "Bonds", "Options", "Annuities", "Precious-Metals", "Mutual-Fund", "Real-Estate", "REIT", "Cryptocurrency", "Forex", "IPO stocks"], + index = readline.keyInSelect(investments, 'Which invesetment type'); + console.log('Nice! ' + investments[index] + ' is your investment of choice!') + return investments[index] + } +let day = 1 + const today2 =(day)=>{ + day = 1 + let message = '' + while(day <= 1){ + let randomNum = Math.floor(Math.random()* 100) + if(randomNum % 10 === 0){ + message = "Rule number one: Don't lose money" + } else if(randomNum % 5 === 0){ + message = '"The stock market is filled with individuals who know the price of everything, but the value of nothing."' + } else if(randomNum % 2 === 0 && randomNum < 30){ + message = '"An investment in knowledge pays the best interest."' + } else if (randomNum % 2 !== 0 && randomNum < 50) { + message = '"Know what you own, and know why you own it."' + } else if (randomNum % 2 !== 0 && randomNum > 50){ + message = '"Derivatives are financial weapons of mass destruction."' + } else if (randomNum % 3 !== 0){ + message = 'Use the day wisely' + } else{ + message ='"Everyone has the brainpower to make money in stocks. Not everyone has the stomach.”' + } + + console.log(`Good Morning, Today is day ${day}. \n ${message}.`) + morningGreeting() + onTheJob() + lunchBreak() + endOfDay() -// while (true) { -// input = readlineSync.prompt(); -// console.log('-- You said "' + input + '"'); -// if (input === 'bye') { -// break; -// } -// } + day = day + 1 + } + return message + } + + + + const breakfast = () => { + breakfastFoods = ['Eggs', 'Cereal', 'Spinach','Bacon'] + let index = readline.keyInSelect(breakfastFoods, "I've made breakfast for you! which breakfask would you like?:") + if(index === 0){ + console.log(chalk.greenBright('Delicious')) + } else if (index === 1){ + console.log(chalk.green('Buget food. Perhaps you can work on changing old habits')) + // subtract 10 dollars from daily balance + + } else if (index === 2){ + console.log(chalk.greenBright('Great choice! The food of wealth.')) + // Add 10 dollars to daily balance + + } else if(index === 3){ + console.log(chalk.green('Mmmm..Bring home the bacon!')) + }else { + command = readline.prompt({ + limit: ['eggs', 'cereal', 'spinach', 'bacon'], + limitMessage: `I can not accept ${index} . Please input another.` + }) + } + } + + const morningGreeting = ()=>{ + let balance = 1800 + morning = 'The morning sunlight of a new day hits your eyes as Debornaire opens the curtains to your bedroom, waking you up.' + readline.keyInPause(morning.italic) + console.log(chalk.greenBright("Good Morning Sunshine. You didn't think I would abandon you on your journey to riches, did you? Of course not!")) + // console.log(chalk.greenBright('Today is ${day}: ${today2}')) + + breakfast() + + + watch = 'Debonaire checks her watch' + readline.keyInPause(watch.italic); + console.log(chalk.greenBright(`It's 9:29am. Markets open at 9:30am. Your current balance is ` + mathFun(balance))) + let moolah =readline.question(chalk.greenBright('Would you like to bank your money?')) + if(moolah === 'yes'){ + console.log(chalk.greenBright('Okay, Your money will survive long enough to fight another day')) + console.log(mathFun(balance)) + } else{ + readline.keyInPause(chalk.green("Okay, What will you invest in today?")) + + let holdMessage = readline.question(chalk.green(`And how much money do you want to invest in ${investmentTypes()}? `)) + console.log(chalk.greenBright(`So you want to invest ${holdMessage} dollars in ${investmentTypes(index)}?`)) + + // balance = 500 + // balance = balance - holdMessage + readline.keyInPause(chalk.greenBright(`You now have ${balance} dollars left after purchasing ${holdMessage} dollars worth of ${investmentTypes(index)}.`)) + } + +} + - // setTimeout(() => console.log(beginingDialogue), 1000) +let mathFun = (balance)=>{ + if(balance > 1800){ + balance = balance + 200 + return balance} + else { + return balance + } +} + + + const rulesInstructions =()=>{ + console.log(chalk.greenBright('So, Its simple. I will test your skills as a day trader. A day trader is someone who buys and sells all their shares in a single day. Ill give you $500 to start.\n You can bank all your money, invest all of it or invest any amount from $1 up to your current balance. Reguadless of what you do, you have 7 days to turn that $500 into $5000 or more.')) + readline.keyInPause(); + console.log(chalk.greenBright('Each day you will be given a chance to choose what you want to invest in for that day and how much money you want to invest. Remeber, you dont have to invest')) + readline.keyInPause(); + console.log(chalk.greenBright('I should warn you; Investment can be tricky. You can lose all your money just as easy as you can gain it. Different investment options have differnt perks, payouts times and consequences. So invest wisely.')) + readline.keyInPause(); + console.log(chalk.greenBright("If by the end of day 7 you have $5000 dollars or more, You will recieve your share of the familie's wealth. And win the game.")) + console.log(chalk.greenBright('However, make $4999 or less and....well....lets say youll win the right to grind the 9-5 like all the other saps')) + readline.keyInPause(); + console.log(chalk.greenBright("Again, choose wisely. You can get a brief explaination of each investment type by typing the investment name. Example, typing the word 'stocks' and you will be given a description of what stocks are")) + readline.keyInPause(); + console.log(chalk.greenBright("When you are ready to invest you can enter investment type then amount. Or you can choose not to invest by typing the word 'bank'.")) + readline.keyInPause(); + console.log(chalk.greenBright("You can also type in 'rules' to get a reminder of the rules")) + console.log(chalk.greenBright(" Well, thats all. Happy Investings!")) + readline.keyInPause() + // morningGreeting() + + } + + + + let currentDay = 1 - const introduction = () => { - console.log('Greetings. My name is Debonaire.') - let nameInput = readline.question("And your name dear?: ") - console.log(`${nameInput}, ...${nameInput} I think I knew a ${nameInput} once.`,'Peculiar indivisual') - console.log("Anyway. I am your long lost cousin's brother's aunt. Three times removed. Or something of that sorts.") - console.log("My point is, you're family. And as family, I've been instructed to give you a portion of the family's wealth") - let playGame = readline.question("Are you interested in a portion of our family's wealth?:") - console.log(playGame) - if(playGame = 'yes'){console.log("Of course you are. Who doesn't love free money")} else if (playGame = 'no') { - console.log("That's okay, I have a proposition for you either way") -} else { console.log(playgame)} -console.log("Unfortuantely, I can't just hand over the money, my dear. At least not without knowing if you're responsible enought to handle it") -console.log("You'll have to prove yourself. ") -console.log("How do you prove yourself? I am glad you asks") -console.log(`I have a test for you, ${nameInput}. A game, if that suits you better`) +secret = readline.question(`A stranger approaches you on....today..You check your phone... your phone tells you that today is ${today}. `, { + hideEchoBack: true, + + }); + + +const introduction = () => { + scratch = 'Debonaire scratches her head as she ponders your name \n' + sus = "That\'s not suspicous at all \n" + money = 'ooh, money! \n' + plaOrNay = 'Do you want to play?' + nah = 'Thats too bad. I was looking forward to watching you play' + say = 'Says the lady who randomly approached YOU. \n' + + console.log(chalk.green('Greetings!') + say.italic + chalk.green( ' My name is Debonaire')) + let nameInput = readline.question(chalk.green("And your name dear?: ")) + console.log(chalk.green(`${nameInput}, ...${nameInput} I think I knew a ${nameInput} once.`,'Peculiar indivisual \n')) + readline.keyInPause(scratch.italic); + console.log('') + console.log(chalk.green("Anyway. I am your long lost cousin's brother's aunt. Three times removed. Or something of that sorts. \n")) + readline.keyInPause(sus.italic); + console.log('') + console.log(chalk.green("My point is, you're family. And as family, I've been instructed to give you a portion of the family's wealth \n")) + readline.keyInPause(money.italic) + console.log('') + let playGame = readline.question(chalk.green("Are you interested in a portion of our family's wealth?:")) + console.log('') + if(playGame = 'yes'){console.log(chalk.green("Of course you are. Who doesn't love free money"))} else if (playGame = 'no') { + console.log(chalk.green("That's okay, I have a proposition for you either way")) + } else { + command = readline.prompt({limitMessage:'$ is not avaiable'}) + } + console.log('') + console.log(chalk.green("Unfortuantely, I can't just hand over the money, my dear. At least not without knowing if you're responsible enought to handle it \n")) + console.log(chalk.green("You'll have to prove yourself. ")) + readline.keyInPause('Says the lady who randomly approached YOU. \n') + console.log(chalk.green("How do you prove yourself? I am glad you asks \n")) + console.log(chalk.green(`I have a test for you, ${nameInput}. A game, if that suits you better \n`)) + + answer = readline.keyInYN(plaOrNay.italic) + if (1){ + console.log(chalk.green('Great! Let me explain the rules')) + // rulesInstructions() + } else{ + console.log(nah.italic) + leaveGame() + } +} + -if(readline.keyInYN('Do you want to play?')){ - play() -} else{ - leaveGame() +const rules = () =>{ + console.log('Okay, here are the rules. You can choose to invest or save your money. You have 7 days to make $5000 or more.') + readline.keyInPause() + console.log("When you are ready to invest you can enter investment type plus amount. Example stocks 2 dollars. Or you can choose not to invest by typing the word 'bank'.") + readline.keyInPause() + console.log('Good Luck!') } + +let drive = ()=> { + console.log(chalk.greenBright("Well that was fun! But let's not forget about work")) + let car = 'A plesant 15 minuet ride later' + readline.keyInPause(car.italic) } + + +const onTheJob = ()=>{ + drive() + +const jobAM = () => { + jobTask = ['Work', 'Read', 'Chat','Dance'] + index = readline.keyInSelect(jobTask, chalk.greenBright(chalk.greenBright("So this is what you call work? Now that we are here, what will you do?"))) +if(index === 0||jobTask === 'word' ){ + console.log(chalk.greenBright("*Yawn* Wake me up when you're done.")) + } else if (index === 1){ + let news = 'According to webnews.aw, Walmart will use fully driverless trucks to make deliveries in 2021' + console.log(chalk.green(news.italic)) + + } else if (index=== 2){ + console.log(chalk.greenBright('Oh, you rather chat with someone other than me...okay')) + } else if(index === 3){ + console.log(chalk.green('Dancing always bring up my spirits!')) + }else { + command = readline.prompt({ + limit: ['Work', 'Read', 'Chat','leave-early', 'Check-Stock'], + limitMessage: 'I can not accept $ . Please input another.' + }) + +} +} + jobAM() + readline.keyInPause() +} -const rules = () =>{ - console.log('Okay, here are the rules. You can choose to invest or save your money. You have 15 days to make $5000 or more.') - console.log("When you are ready to invest you can enter investment type plus amount. Example stocks 2 dollars. Or you can choose not to invest by typing the word 'bank'.") - console.log('Good Luck!') - } - rulesInstructions() - rules() - -const investmentsHelp = (bid)=>{ - switch(bid){ - case stocks: - console.log('Stock of a corporation is all of the shares into which ownership of the corporation is divided. A single share of the stock represents fractional ownership of the corporation in proportion to the total number of shares.') - break; - case bonds: - console.log('In finance, a bond is an instrument of indebtedness of the bond issuer to the holders. Bonds can be in mutual funds or can be in private investing where a person would give a loan to a company or the government.') - break; - case options: - console.log('In finance, an option is a contract which conveys its owner, the holder, the right, but not the obligation, to buy or sell an underlying asset or instrument at a specified strike price prior to or on a specified date, depending on the form of the option') - break; - case annuities: - console.log('An annuity is a financial product that pays out a fixed stream of payments to an individual, and these financial products are primarily used as an income stream for retirees.') - break; - case precious-metals-ira: - console.log('Precious metals IRA is an Individual Retirement Account in which physical gold or other approved precious metals are held in custody for the benefit of the IRA account owner. It functions the same as a regular IRA, only instead of holding paper assets, it holds physical bullion coins or bars.') - break; - case mutual-funds: - console.log('A mutual fund is an open-end professionally managed investment fund that pools money from many investors to purchase securities.') - break; - case reit: - console.log('A real estate investment trust is a company that owns, and in most cases operates, income-producing real estate.') - break; - case cryptocurrency: - console.log('A cryptocurrency is a digital or virtual currency that is secured by cryptography, which makes it nearly impossible to counterfeit or double-spend.') - break; - case forex: - console.log('Foreign Exchange (forex or FX) is the trading of one currency for another.') - break; - case ipo-stocks: - console.log('An initial public offering (IPO) refers to the process of offering shares of a private corporation to the public in a new stock issuance.') - break; - default:console.log('Please check your spelling and re-type in your investment choice in all lower case letters.') - investmentsHelp(bid) - } - play() - } -introduction() - const play = () => { - rules() - morningGreeting() - - if(userInput = 'bank'){ - deposit = deposit + profit +const lunchBreak = ()=>{ - eveningGreeting() - } + readline.keyInPause('After 4 hours of eye strain its now time for lunch!') + +const midDay = () => { + array = ['Kiss up to superiors', 'Have Lunch', 'Charm coworker', 'Work Through Lunch'] + index = readline.keyInSelect(array, chalk.greenBright(chalk.greenBright("Glad that whole work thing is over. What? This is only a lunch break? What do you do on your lunch break?"))) +if(index === 0 ){ + console.log(chalk.greenBright("Nice, Now you're only 1999 kisses away from an actual raise!")) + } else if (index === 1){ + console.log(chalk.green(chalk.greenBright("Remmeber when you asked me what that smell was in the car? Well, it's your lunch! I made you a tuna sandwhich with onion and eggs! Enjoy!"))) + + + } else if (index === 2){ + console.log(chalk.greenBright("Aren't you the charmer")) + + + } else if(index === 3){ + console.log(chalk.green("well, at least you'll have a job to return to if this investment plan doesn't work out for you.")) + }else { + command = readline.prompt({ + limit: ['Kiss up to superiors', 'Have Lunch', 'Charm coworker','Sleep', 'Work Through Lunch'], + limitMessage: 'I can not accept $ . Please input another.' + }) + } -function eveningGreeting(){ - console.log("You worked all day. It is now 3:59.") - let marketClosed = readline.question("What do you want to do with your money?") } -function morningGreeting(){ - console.log("Its 9:29am. Markets open at 9:30am") - let marketOpen = readline.question("What will you invest in today?") -console.log('*The morning sunlight hits your eyes as Debornaire opens the curtains to yoru bedroom. \n Good Morning Sunshine. You didn\'t think I would abandon you on your journey to riches, did you? Of course not!') -const breakfast = () => { - breakfastFoods = ['Eggs', 'Cereal', 'Spinach'] - index = readlineSync.keyInSelect(breakfastFoods, "I've made breakfast for you! which breakfask would you like?:") - if(breakfastFoods === 'eggs'||breakfastFoods === 'Eggs' ){ - console.log('Delicious') - - } else if (breakfastFoods === 'Cereal' || breakfastFoods === 'cereal'){ - console.log('Buget food. Perhaps you can work on changing old habits') - // subtract 10 dollars from daily balance +midDay() +} - } else if (breakfastFoods === 'Spinach' || breakfastFoods === 'spinach'){ - Console.log('Great choice! The food of wealth.') - // Add 10 dollars to daily balance - } else { - command = readlineSync.prompt({ - limit: ['add', 'remove'], - limitMessage: 'Refused $ you requested. Please input another.' - }) - } -} + + + + + const endOfDay = ()=>{ + morning = 'The sun began to set, signalling the end of your workday ' + readline.keyInPause(morning.italic) + console.log(chalk.greenBright("I took the liberty to sell all your shares")) + + watch = 'Debonaire checks her watch' + readline.keyInPause(watch.italic); + balance = + console.log(chalk.greenBright(`It's 3:59am. Markets close at 4pm. After selling your shares, your current balance is ` + mathFun(balance))) + + + readline.keyInPause(chalk.greenBright(`You should head home and get some sleep. Tomorrow will be a new day of investing.`)) } + + + -function randomInvestingResponse(){ +const bankAccount =(balance)=>{ + if(balance <= 0){ + console.log(chalk.greenBright('Oh, sorry dear, looks like you ran out of money. Unfortunately You do not inherit any wealth')) + gameLoop() + } else if(balance >= 2800){ + console.log(chalk.greenBright('Celebrate good times, comeon!! Congratulations you made it to $5000. You get to live it up with the filthy rich')) + readline.keyInPause() + console.log(chalk.greenBright("Those who are filthy rich in knowledge, that is! Here is our family secret, An investment in knowledge pays the best interest.” -Benjamin Franklin- \n By playing my game you learned the first steps in a life long skill of investment. You know more now than you did before we met and therefor can build on what you've learned. Congratulations!! You are now wealthy in mind.")) + readline.keyInPause() + console.log(chalk.greenBright('That was so much fun that I want to play again')) + fun() + } + return balance } -// function randonBankingResponse(){} -// function bankAccount (money){ -// return savedAmount + investmentGains -// console.log() -// } -function rulesInstructions(){ - console.log('So, Its simply. Ill give you $500.\n You can bank it or you can invest it. Either way, you have 15 days to turn that $500 into $5000 or more.') - console.log('Each day you will be given a chance to choose what you want to invest in for that day and how much money you want to invest. Remeber, you dont have to invest') - console.log('I should warn you; Investment can be tricky. You can earn money or lose it. Different investment options have differnt perks, payouts times and consequences. So invest wisely.') - console.log("If by the end of day 15 you have $5000 dollars or more, You will recieve your share of the familie's wealth.") - console.log('However, make $4999 or less and....well....lets say youll win the right to grind the 9-5 like all the other saps') - console.log("Again, choose wisely. You can get a brief explaination of each investment type by entering '?' and the type of investment. Example ?Stocks") - console.log("When you are ready to invest you can enter investment type plus amount. Example stocks 2 dollars. Or you can choose not to invest by typing the word 'bank'.") - console.log("You can also type in 'rules' to get a reminder of the rules") - console.log(" Well, thats all. Happy Investings!") + + + +// prosperity-game name OR Bank or Bust +let fun = ()=> { + plaOrNay = 'Do you want to play?' + nah = 'Thats too bad. I was looking forward to watching you play' + answer = readline.keyInYN(plaOrNay.italic) + if (answer){ + let yey = "Yey! Let's do it again!" + console.log(yey.italic) + play() + }else {console.log(nah.italic) + quitGame() + } } -// var readlineSync = require('readline-sync'), -// investments = ["Stocks", "Bonds", "Options", "Annuities", "Precious-Metals", "Mutual-Fund", "Real-Estate", "REIT", "Cryptocurrency", "Forex", "IPO stocks"], -// index = readlineSync.keyInSelect(investments, 'Which invesetment type'); -// console.log('okay, ' + investments[index] + ' is your investment of choice!') - - - - -//Produces a visual ranger a user can slide back and forth -// An UI like the Range Slider: -// (Press Z or X key to change a value, and Space Bar to exit) -// var readlineSync = require('readline-sync'), -// MAX = 200, MIN = 0, value = 30, key; -// console.log('\n\n' + (new Array(20)).join(' ') + -// '[Z] <- -> [X] FIX: [SPACE]\n'); -// while (true) { -// console.log('\x1B[1A\x1B[K|' + -// (new Array(value + 1)).join('-') + 'O' + -// (new Array(MAX - value + 1)).join('-') + '| ' + value); -// key = readlineSync.keyIn('', -// {hideEchoBack: true, mask: '', limit: 'zx '}); -// if (key === 'z') { if (value > MIN) { value--; } } -// else if (key === 'x') { if (value < MAX) { value++; } } -// else { break; } + +const play = () => { + introduction() + rulesInstructions() + today2() + bankAccount(2800) + + + +// let response; +// while (1) { +// response = readline.question(">"); +// if ('?' === response) { +// rules(); +// } else if ( 'quit' === response) { +// leaveGame(); +// // } .... more else if ... { +// // } +// } + + // } -// console.log('\nA value the user requested: ' + value); +} +startGame() -// prosperity-game name OR Bank or Bust -//randomly generate number -// Math.floor(Math.random()* 100) -// console.log(startGame()) -// end game -const quitGame = () => {} -//game loops -//const gameLoop = () => {} -// start game From cf2a8f014f15cc940b673391e3d956e9786b9c82 Mon Sep 17 00:00:00 2001 From: Dequisa Date: Sat, 2 Jan 2021 17:56:04 -0500 Subject: [PATCH 04/11] Fourth Draft --- package-lock.json | 1117 +++++++++++++++++++++++++++++++++++++++++ package.json | 1 + textBasedAdventure.js | 285 +++++------ 3 files changed, 1252 insertions(+), 151 deletions(-) diff --git a/package-lock.json b/package-lock.json index ba58dfc..cdf3fc1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,12 +9,18 @@ "license": "ISC", "dependencies": { "chalk": "^4.1.0", + "chalk-animation": "^1.6.0", "colors": "^1.4.0", "each-async": "^1.1.1", "indent-string": "^4.0.0", "readline-sync": "^1.4.10" } }, + "node_modules/@types/tinycolor2": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@types/tinycolor2/-/tinycolor2-1.4.2.tgz", + "integrity": "sha512-PeHg/AtdW6aaIO2a+98Xj7rWY4KC1E6yOy7AFknJQ7VXUGNrMlyxDFxJo7HqLtjQms/ZhhQX52mLVW/EX3JGOw==" + }, "node_modules/ansi-styles": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", @@ -29,6 +35,43 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, + "node_modules/array-find-index": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz", + "integrity": "sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/arrify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", + "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/camelcase": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", + "engines": { + "node": ">=4" + } + }, + "node_modules/camelcase-keys": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-4.2.0.tgz", + "integrity": "sha1-oqpfsa9oh1glnDLBQUJteJI7m3c=", + "dependencies": { + "camelcase": "^4.1.0", + "map-obj": "^2.0.0", + "quick-lru": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/chalk": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", @@ -44,6 +87,78 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, + "node_modules/chalk-animation": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/chalk-animation/-/chalk-animation-1.6.0.tgz", + "integrity": "sha512-Q8vVq6eD5IOhWI0s9WdUawDzMRjNrR4rOCiu409eZRTIHID5OjoTTEkpGZngL/BPQnL7yYmBhlXXpPJ9SYuARw==", + "dependencies": { + "chalk": "^2.3.2", + "gradient-string": "^1.1.0", + "meow": "^4.0.0" + }, + "bin": { + "chalk-animation": "cli.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/chalk-animation/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/chalk-animation/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/chalk-animation/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/chalk-animation/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" + }, + "node_modules/chalk-animation/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "engines": { + "node": ">=4" + } + }, + "node_modules/chalk-animation/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", @@ -68,6 +183,45 @@ "node": ">=0.1.90" } }, + "node_modules/currently-unhandled": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz", + "integrity": "sha1-mI3zP+qxke95mmE2nddsF635V+o=", + "dependencies": { + "array-find-index": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/decamelize-keys": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/decamelize-keys/-/decamelize-keys-1.1.0.tgz", + "integrity": "sha1-0XGoeTMlKAfrPLYdwcFEXQeN8tk=", + "dependencies": { + "decamelize": "^1.1.0", + "map-obj": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/decamelize-keys/node_modules/map-obj": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", + "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/each-async": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/each-async/-/each-async-1.1.1.tgz", @@ -80,6 +234,122 @@ "node": ">=0.10.0" } }, + "node_modules/error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dependencies": { + "is-arrayish": "^0.2.1" + } + }, + "node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "dependencies": { + "locate-path": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + }, + "node_modules/graceful-fs": { + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz", + "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==" + }, + "node_modules/gradient-string": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gradient-string/-/gradient-string-1.2.0.tgz", + "integrity": "sha512-Lxog7IDMMWNjwo4O0KbdBvSewk4vW6kQe5XaLuuPCyCE65AGQ1P8YqKJa5dq8TYf/Ge31F+KjWzPR5mAJvjlAg==", + "dependencies": { + "chalk": "^2.4.1", + "tinygradient": "^0.4.1" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/gradient-string/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/gradient-string/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/gradient-string/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/gradient-string/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" + }, + "node_modules/gradient-string/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "engines": { + "node": ">=4" + } + }, + "node_modules/gradient-string/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dependencies": { + "function-bind": "^1.1.1" + }, + "engines": { + "node": ">= 0.4.0" + } + }, "node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -88,6 +358,11 @@ "node": ">=8" } }, + "node_modules/hosted-git-info": { + "version": "2.8.8", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.8.tgz", + "integrity": "sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg==" + }, "node_modules/indent-string": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", @@ -96,6 +371,128 @@ "node": ">=8" } }, + "node_modules/is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=" + }, + "node_modules/is-core-module": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.2.0.tgz", + "integrity": "sha512-XRAfAdyyY5F5cOXn7hYQDqh2Xmii+DEfIcQGxK/uNwMHhIkPWO0g8msXcbzLe+MpGoR951MlqM/2iIlU4vKDdQ==", + "dependencies": { + "has": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-plain-obj": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", + "integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/json-parse-better-errors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", + "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==" + }, + "node_modules/load-json-file": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", + "integrity": "sha1-L19Fq5HjMhYjT9U62rZo607AmTs=", + "dependencies": { + "graceful-fs": "^4.1.2", + "parse-json": "^4.0.0", + "pify": "^3.0.0", + "strip-bom": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", + "dependencies": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/loud-rejection": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/loud-rejection/-/loud-rejection-1.6.0.tgz", + "integrity": "sha1-W0b4AUft7leIcPCG0Eghz5mOVR8=", + "dependencies": { + "currently-unhandled": "^0.4.1", + "signal-exit": "^3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/map-obj": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-2.0.0.tgz", + "integrity": "sha1-plzSkIepJZi4eRJXpSPgISIqwfk=", + "engines": { + "node": ">=4" + } + }, + "node_modules/meow": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/meow/-/meow-4.0.1.tgz", + "integrity": "sha512-xcSBHD5Z86zaOc+781KrupuHAzeGXSLtiAOmBsiLDiPSaYSB6hdew2ng9EBAnZ62jagG9MHAOdxpDi/lWBFJ/A==", + "dependencies": { + "camelcase-keys": "^4.0.0", + "decamelize-keys": "^1.0.0", + "loud-rejection": "^1.0.0", + "minimist": "^1.1.3", + "minimist-options": "^3.0.1", + "normalize-package-data": "^2.3.4", + "read-pkg-up": "^3.0.0", + "redent": "^2.0.0", + "trim-newlines": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" + }, + "node_modules/minimist-options": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/minimist-options/-/minimist-options-3.0.2.tgz", + "integrity": "sha512-FyBrT/d0d4+uiZRbqznPXqw3IpZZG3gl3wKWiX784FycUKVwBt0uLBFkQrtE4tZOrgo78nZp2jnKz3L65T5LdQ==", + "dependencies": { + "arrify": "^1.0.1", + "is-plain-obj": "^1.1.0" + }, + "engines": { + "node": ">= 4" + } + }, + "node_modules/normalize-package-data": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", + "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", + "dependencies": { + "hosted-git-info": "^2.1.4", + "resolve": "^1.10.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + } + }, "node_modules/onetime": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/onetime/-/onetime-1.1.0.tgz", @@ -104,6 +501,113 @@ "node": ">=0.10.0" } }, + "node_modules/p-limit": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "dependencies": { + "p-try": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", + "dependencies": { + "p-limit": "^1.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/p-try": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", + "engines": { + "node": ">=4" + } + }, + "node_modules/parse-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", + "dependencies": { + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "engines": { + "node": ">=4" + } + }, + "node_modules/path-parse": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", + "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==" + }, + "node_modules/path-type": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", + "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", + "dependencies": { + "pify": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "engines": { + "node": ">=4" + } + }, + "node_modules/quick-lru": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-1.1.0.tgz", + "integrity": "sha1-Q2CxfGETatOAeDl/8RQW4Ybc+7g=", + "engines": { + "node": ">=4" + } + }, + "node_modules/read-pkg": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz", + "integrity": "sha1-nLxoaXj+5l0WwA4rGcI3/Pbjg4k=", + "dependencies": { + "load-json-file": "^4.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/read-pkg-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-3.0.0.tgz", + "integrity": "sha1-PtSWaF26D4/hGNBpHcUfSh/5bwc=", + "dependencies": { + "find-up": "^2.0.0", + "read-pkg": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/readline-sync": { "version": "1.4.10", "resolved": "https://registry.npmjs.org/readline-sync/-/readline-sync-1.4.10.tgz", @@ -112,6 +616,46 @@ "node": ">= 0.8.0" } }, + "node_modules/redent": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/redent/-/redent-2.0.0.tgz", + "integrity": "sha1-wbIAe0LVfrE4kHmzyDM2OdXhzKo=", + "dependencies": { + "indent-string": "^3.0.0", + "strip-indent": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/redent/node_modules/indent-string": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-3.2.0.tgz", + "integrity": "sha1-Sl/W0nzDMvN+VBmlBNu4NxBckok=", + "engines": { + "node": ">=4" + } + }, + "node_modules/resolve": { + "version": "1.19.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.19.0.tgz", + "integrity": "sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg==", + "dependencies": { + "is-core-module": "^2.1.0", + "path-parse": "^1.0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "bin": { + "semver": "bin/semver" + } + }, "node_modules/set-immediate-shim": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz", @@ -120,6 +664,55 @@ "node": ">=0.10.0" } }, + "node_modules/signal-exit": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", + "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==" + }, + "node_modules/spdx-correct": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz", + "integrity": "sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==", + "dependencies": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/spdx-exceptions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz", + "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==" + }, + "node_modules/spdx-expression-parse": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", + "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", + "dependencies": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/spdx-license-ids": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.7.tgz", + "integrity": "sha512-U+MTEOO0AiDzxwFvoa4JVnMV6mZlJKk2sBLt90s7G0Gd0Mlknc7kxEn3nuDPNZRta7O2uy8oLcZLVT+4sqNZHQ==" + }, + "node_modules/strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "engines": { + "node": ">=4" + } + }, + "node_modules/strip-indent": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-2.0.0.tgz", + "integrity": "sha1-XvjbKV0B5u1sv3qrlpmNeCJSe2g=", + "engines": { + "node": ">=4" + } + }, "node_modules/supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", @@ -130,9 +723,48 @@ "engines": { "node": ">=8" } + }, + "node_modules/tinycolor2": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/tinycolor2/-/tinycolor2-1.4.2.tgz", + "integrity": "sha512-vJhccZPs965sV/L2sU4oRQVAos0pQXwsvTLkWYdqJ+a8Q5kPFzJTuOFwy7UniPli44NKQGAglksjvOcpo95aZA==", + "engines": { + "node": "*" + } + }, + "node_modules/tinygradient": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/tinygradient/-/tinygradient-0.4.3.tgz", + "integrity": "sha512-tBPYQSs6eWukzzAITBSmqcOwZCKACvRa/XjPPh1mj4mnx4G3Drm51HxyCTU/TKnY8kG4hmTe5QlOh9O82aNtJQ==", + "dependencies": { + "@types/tinycolor2": "^1.4.0", + "tinycolor2": "^1.0.0" + } + }, + "node_modules/trim-newlines": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-2.0.0.tgz", + "integrity": "sha1-tAPQuRvlDDMd/EuC7s6yLD3hbSA=", + "engines": { + "node": ">=4" + } + }, + "node_modules/validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "dependencies": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } } }, "dependencies": { + "@types/tinycolor2": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@types/tinycolor2/-/tinycolor2-1.4.2.tgz", + "integrity": "sha512-PeHg/AtdW6aaIO2a+98Xj7rWY4KC1E6yOy7AFknJQ7VXUGNrMlyxDFxJo7HqLtjQms/ZhhQX52mLVW/EX3JGOw==" + }, "ansi-styles": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", @@ -141,6 +773,31 @@ "color-convert": "^2.0.1" } }, + "array-find-index": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz", + "integrity": "sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=" + }, + "arrify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", + "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=" + }, + "camelcase": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=" + }, + "camelcase-keys": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-4.2.0.tgz", + "integrity": "sha1-oqpfsa9oh1glnDLBQUJteJI7m3c=", + "requires": { + "camelcase": "^4.1.0", + "map-obj": "^2.0.0", + "quick-lru": "^1.0.0" + } + }, "chalk": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", @@ -150,6 +807,62 @@ "supports-color": "^7.1.0" } }, + "chalk-animation": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/chalk-animation/-/chalk-animation-1.6.0.tgz", + "integrity": "sha512-Q8vVq6eD5IOhWI0s9WdUawDzMRjNrR4rOCiu409eZRTIHID5OjoTTEkpGZngL/BPQnL7yYmBhlXXpPJ9SYuARw==", + "requires": { + "chalk": "^2.3.2", + "gradient-string": "^1.1.0", + "meow": "^4.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, "color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", @@ -168,6 +881,35 @@ "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz", "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==" }, + "currently-unhandled": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz", + "integrity": "sha1-mI3zP+qxke95mmE2nddsF635V+o=", + "requires": { + "array-find-index": "^1.0.1" + } + }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=" + }, + "decamelize-keys": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/decamelize-keys/-/decamelize-keys-1.1.0.tgz", + "integrity": "sha1-0XGoeTMlKAfrPLYdwcFEXQeN8tk=", + "requires": { + "decamelize": "^1.1.0", + "map-obj": "^1.0.0" + }, + "dependencies": { + "map-obj": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", + "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=" + } + } + }, "each-async": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/each-async/-/each-async-1.1.1.tgz", @@ -177,31 +919,378 @@ "set-immediate-shim": "^1.0.0" } }, + "error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "requires": { + "is-arrayish": "^0.2.1" + } + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" + }, + "find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "requires": { + "locate-path": "^2.0.0" + } + }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + }, + "graceful-fs": { + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz", + "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==" + }, + "gradient-string": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gradient-string/-/gradient-string-1.2.0.tgz", + "integrity": "sha512-Lxog7IDMMWNjwo4O0KbdBvSewk4vW6kQe5XaLuuPCyCE65AGQ1P8YqKJa5dq8TYf/Ge31F+KjWzPR5mAJvjlAg==", + "requires": { + "chalk": "^2.4.1", + "tinygradient": "^0.4.1" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "requires": { + "function-bind": "^1.1.1" + } + }, "has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" }, + "hosted-git-info": { + "version": "2.8.8", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.8.tgz", + "integrity": "sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg==" + }, "indent-string": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==" }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=" + }, + "is-core-module": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.2.0.tgz", + "integrity": "sha512-XRAfAdyyY5F5cOXn7hYQDqh2Xmii+DEfIcQGxK/uNwMHhIkPWO0g8msXcbzLe+MpGoR951MlqM/2iIlU4vKDdQ==", + "requires": { + "has": "^1.0.3" + } + }, + "is-plain-obj": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", + "integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4=" + }, + "json-parse-better-errors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", + "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==" + }, + "load-json-file": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", + "integrity": "sha1-L19Fq5HjMhYjT9U62rZo607AmTs=", + "requires": { + "graceful-fs": "^4.1.2", + "parse-json": "^4.0.0", + "pify": "^3.0.0", + "strip-bom": "^3.0.0" + } + }, + "locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", + "requires": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + } + }, + "loud-rejection": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/loud-rejection/-/loud-rejection-1.6.0.tgz", + "integrity": "sha1-W0b4AUft7leIcPCG0Eghz5mOVR8=", + "requires": { + "currently-unhandled": "^0.4.1", + "signal-exit": "^3.0.0" + } + }, + "map-obj": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-2.0.0.tgz", + "integrity": "sha1-plzSkIepJZi4eRJXpSPgISIqwfk=" + }, + "meow": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/meow/-/meow-4.0.1.tgz", + "integrity": "sha512-xcSBHD5Z86zaOc+781KrupuHAzeGXSLtiAOmBsiLDiPSaYSB6hdew2ng9EBAnZ62jagG9MHAOdxpDi/lWBFJ/A==", + "requires": { + "camelcase-keys": "^4.0.0", + "decamelize-keys": "^1.0.0", + "loud-rejection": "^1.0.0", + "minimist": "^1.1.3", + "minimist-options": "^3.0.1", + "normalize-package-data": "^2.3.4", + "read-pkg-up": "^3.0.0", + "redent": "^2.0.0", + "trim-newlines": "^2.0.0" + } + }, + "minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" + }, + "minimist-options": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/minimist-options/-/minimist-options-3.0.2.tgz", + "integrity": "sha512-FyBrT/d0d4+uiZRbqznPXqw3IpZZG3gl3wKWiX784FycUKVwBt0uLBFkQrtE4tZOrgo78nZp2jnKz3L65T5LdQ==", + "requires": { + "arrify": "^1.0.1", + "is-plain-obj": "^1.1.0" + } + }, + "normalize-package-data": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", + "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", + "requires": { + "hosted-git-info": "^2.1.4", + "resolve": "^1.10.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + } + }, "onetime": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/onetime/-/onetime-1.1.0.tgz", "integrity": "sha1-ofeDj4MUxRbwXs78vEzP4EtO14k=" }, + "p-limit": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "requires": { + "p-try": "^1.0.0" + } + }, + "p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", + "requires": { + "p-limit": "^1.1.0" + } + }, + "p-try": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=" + }, + "parse-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", + "requires": { + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1" + } + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=" + }, + "path-parse": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", + "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==" + }, + "path-type": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", + "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", + "requires": { + "pify": "^3.0.0" + } + }, + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=" + }, + "quick-lru": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-1.1.0.tgz", + "integrity": "sha1-Q2CxfGETatOAeDl/8RQW4Ybc+7g=" + }, + "read-pkg": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz", + "integrity": "sha1-nLxoaXj+5l0WwA4rGcI3/Pbjg4k=", + "requires": { + "load-json-file": "^4.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^3.0.0" + } + }, + "read-pkg-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-3.0.0.tgz", + "integrity": "sha1-PtSWaF26D4/hGNBpHcUfSh/5bwc=", + "requires": { + "find-up": "^2.0.0", + "read-pkg": "^3.0.0" + } + }, "readline-sync": { "version": "1.4.10", "resolved": "https://registry.npmjs.org/readline-sync/-/readline-sync-1.4.10.tgz", "integrity": "sha512-gNva8/6UAe8QYepIQH/jQ2qn91Qj0B9sYjMBBs3QOB8F2CXcKgLxQaJRP76sWVRQt+QU+8fAkCbCvjjMFu7Ycw==" }, + "redent": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/redent/-/redent-2.0.0.tgz", + "integrity": "sha1-wbIAe0LVfrE4kHmzyDM2OdXhzKo=", + "requires": { + "indent-string": "^3.0.0", + "strip-indent": "^2.0.0" + }, + "dependencies": { + "indent-string": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-3.2.0.tgz", + "integrity": "sha1-Sl/W0nzDMvN+VBmlBNu4NxBckok=" + } + } + }, + "resolve": { + "version": "1.19.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.19.0.tgz", + "integrity": "sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg==", + "requires": { + "is-core-module": "^2.1.0", + "path-parse": "^1.0.6" + } + }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" + }, "set-immediate-shim": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz", "integrity": "sha1-SysbJ+uAip+NzEgaWOXlb1mfP2E=" }, + "signal-exit": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", + "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==" + }, + "spdx-correct": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz", + "integrity": "sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==", + "requires": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-exceptions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz", + "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==" + }, + "spdx-expression-parse": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", + "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", + "requires": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-license-ids": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.7.tgz", + "integrity": "sha512-U+MTEOO0AiDzxwFvoa4JVnMV6mZlJKk2sBLt90s7G0Gd0Mlknc7kxEn3nuDPNZRta7O2uy8oLcZLVT+4sqNZHQ==" + }, + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=" + }, + "strip-indent": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-2.0.0.tgz", + "integrity": "sha1-XvjbKV0B5u1sv3qrlpmNeCJSe2g=" + }, "supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", @@ -209,6 +1298,34 @@ "requires": { "has-flag": "^4.0.0" } + }, + "tinycolor2": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/tinycolor2/-/tinycolor2-1.4.2.tgz", + "integrity": "sha512-vJhccZPs965sV/L2sU4oRQVAos0pQXwsvTLkWYdqJ+a8Q5kPFzJTuOFwy7UniPli44NKQGAglksjvOcpo95aZA==" + }, + "tinygradient": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/tinygradient/-/tinygradient-0.4.3.tgz", + "integrity": "sha512-tBPYQSs6eWukzzAITBSmqcOwZCKACvRa/XjPPh1mj4mnx4G3Drm51HxyCTU/TKnY8kG4hmTe5QlOh9O82aNtJQ==", + "requires": { + "@types/tinycolor2": "^1.4.0", + "tinycolor2": "^1.0.0" + } + }, + "trim-newlines": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-2.0.0.tgz", + "integrity": "sha1-tAPQuRvlDDMd/EuC7s6yLD3hbSA=" + }, + "validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "requires": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } } } } diff --git a/package.json b/package.json index cec94d3..4edb91a 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "homepage": "https://github.com/joinpursuit/FSW-Text-Based-Adventure#readme", "dependencies": { "chalk": "^4.1.0", + "chalk-animation": "^1.6.0", "colors": "^1.4.0", "each-async": "^1.1.1", "indent-string": "^4.0.0", diff --git a/textBasedAdventure.js b/textBasedAdventure.js index b48219d..e587851 100644 --- a/textBasedAdventure.js +++ b/textBasedAdventure.js @@ -8,87 +8,49 @@ const { read } = require('fs'); const { kStringMaxLength } = require('buffer'); -const stringOne = 'This is a plain string.'; -const stringTwo = 'This string is red.'.red; -const stringThree = 'This string is blue.'.blue; -const today = new Date().toLocaleDateString(); // returns today's date in mm/dd/yyyy format +const today = new Date().toLocaleDateString(); -console.log(stringOne.black.bgMagenta); -console.log(stringOne.yellow.bgRed.bold); -console.log(`Today is: ${today}`.black.bgGreen); -console.log(stringTwo); -console.log(stringThree); - -console.log(stringTwo.magenta); -console.log(stringThree.grey.bold); - - - - -// const fruitFunction = () => { -// array = ['Eggs', 'Cereal', 'Spinach','Bacon'] -// console.log("What is your favorite fruit?") -// fruitChoice = readline.keyInSelect(array) -// // fruitChoice === array[fruitChoice] -// if(fruitChoice === 1){ -// console.log(chalk.greenBright('Delicious')) -// } else{ -// console.log(chalk.green('Buget food. Perhaps you can work on changing old habits')) -// // subtract 10 dollars from daily balance - -// } -// } -// fruitFunction () - - -const investmentsHelp = (bid)=>{ +const investmentsHelp = bid=>{ switch(bid){ - case stocks: + case 'stocks': console.log('Stock of a corporation is all of the shares into which ownership of the corporation is divided. A single share of the stock represents fractional ownership of the corporation in proportion to the total number of shares.') - return 100 break; - case bonds: + case 'bonds': console.log('In finance, a bond is an instrument of indebtedness of the bond issuer to the holders. Bonds can be in mutual funds or can be in private investing where a person would give a loan to a company or the government.') - return -500 break; - case options: + case 'options': console.log('In finance, an option is a contract which conveys its owner, the holder, the right, but not the obligation, to buy or sell an underlying asset or instrument at a specified strike price prior to or on a specified date, depending on the form of the option') - return -200 break; - case annuities: + case 'annuities': console.log('An annuity is a financial product that pays out a fixed stream of payments to an individual, and these financial products are primarily used as an income stream for retirees.') - return 50 break; - case precious-metals-ira: + case 'precious-metals-ira': console.log('Precious metals IRA is an Individual Retirement Account in which physical gold or other approved precious metals are held in custody for the benefit of the IRA account owner. It functions the same as a regular IRA, only instead of holding paper assets, it holds physical bullion coins or bars.') - return 300 break; - case mutual-funds: + case 'mutual-funds': console.log('A mutual fund is an open-end professionally managed investment fund that pools money from many investors to purchase securities.') - return -100 break; - case reit: + case 'reit': console.log('A real estate investment trust is a company that owns, and in most cases operates, income-producing real estate.') - return -100 break; - case cryptocurrency: + case 'cryptocurrency': console.log('A cryptocurrency is a digital or virtual currency that is secured by cryptography, which makes it nearly impossible to counterfeit or double-spend.') - return 500 break; - case forex: + case 'forex': console.log('Foreign Exchange (forex or FX) is the trading of one currency for another.') - return 500 break; - case ipo-stocks: + case 'ipo-stocks': console.log('An initial public offering (IPO) refers to the process of offering shares of a private corporation to the public in a new stock issuance.') - return 1000 break; - default:console.log('Please check your spelling and re-type in your investment choice in all lower case letters.') - investmentsHelp(bid) - } - play() - } + default: + command = readline.prompt({ + limit: ["Stocks", "Bonds", "Options", "Annuities", "Precious-Metals", "Mutual-Fund", "Real-Estate", "REIT", "Cryptocurrency", "Forex", "IPO stocks"], + limitMessage: `I can not accept $ . Please input another.` + + }) +} +} say = '...says the stranger.' @@ -112,38 +74,39 @@ play() const gameLoop = () => { } -let amount = '' + const investmentTypes = () => { investments = ["Stocks", "Bonds", "Options", "Annuities", "Precious-Metals", "Mutual-Fund", "Real-Estate", "REIT", "Cryptocurrency", "Forex", "IPO stocks"], - index = readline.keyInSelect(investments, 'Which invesetment type'); + index = readline.keyInSelect(investments, 'Which invesetment type'); console.log('Nice! ' + investments[index] + ' is your investment of choice!') return investments[index] - } +} + -let day = 1 - const today2 =(day)=>{ +const today2 =(day)=>{ day = 1 let message = '' - while(day <= 1){ + + while(day <= 4){ let randomNum = Math.floor(Math.random()* 100) - if(randomNum % 10 === 0){ + if(randomNum % 10 === 0){ message = "Rule number one: Don't lose money" - } else if(randomNum % 5 === 0){ + } else if(randomNum % 5 === 0){ message = '"The stock market is filled with individuals who know the price of everything, but the value of nothing."' - } else if(randomNum % 2 === 0 && randomNum < 30){ + } else if(randomNum % 2 === 0 && randomNum < 30){ message = '"An investment in knowledge pays the best interest."' - } else if (randomNum % 2 !== 0 && randomNum < 50) { + } else if (randomNum % 2 !== 0 && randomNum < 50) { message = '"Know what you own, and know why you own it."' - } else if (randomNum % 2 !== 0 && randomNum > 50){ + } else if (randomNum % 2 !== 0 && randomNum > 50){ message = '"Derivatives are financial weapons of mass destruction."' - } else if (randomNum % 3 !== 0){ + } else if (randomNum % 3 !== 0){ message = 'Use the day wisely' - } else{ - message ='"Everyone has the brainpower to make money in stocks. Not everyone has the stomach.”' + } else{ + message ='"Everyone has the brainpower to make money in stocks. Not everyone has the stomach.”' } - console.log(`Good Morning, Today is day ${day}. \n ${message}.`) + console.log(chalk.cyan(`Good Morning, Today is day ${day}. \n ${message}.`)) morningGreeting() onTheJob() lunchBreak() @@ -152,11 +115,11 @@ let day = 1 day = day + 1 } return message - } +} - const breakfast = () => { +const breakfast = () => { breakfastFoods = ['Eggs', 'Cereal', 'Spinach','Bacon'] let index = readline.keyInSelect(breakfastFoods, "I've made breakfast for you! which breakfask would you like?:") if(index === 0){ @@ -178,35 +141,75 @@ let day = 1 }) } - } +} - const morningGreeting = ()=>{ - let balance = 1800 +const morningGreeting = ()=>{ + morning = 'The morning sunlight of a new day hits your eyes as Debornaire opens the curtains to your bedroom, waking you up.' readline.keyInPause(morning.italic) console.log(chalk.greenBright("Good Morning Sunshine. You didn't think I would abandon you on your journey to riches, did you? Of course not!")) - // console.log(chalk.greenBright('Today is ${day}: ${today2}')) breakfast() watch = 'Debonaire checks her watch' readline.keyInPause(watch.italic); - console.log(chalk.greenBright(`It's 9:29am. Markets open at 9:30am. Your current balance is ` + mathFun(balance))) + console.log(chalk.greenBright(`It's 9:29am. Markets open at 9:30am. Your current balance is ` + mathFun())) + let invest =()=>{ let moolah =readline.question(chalk.greenBright('Would you like to bank your money?')) + if(moolah === 'yes'){ console.log(chalk.greenBright('Okay, Your money will survive long enough to fight another day')) - console.log(mathFun(balance)) - } else{ + + let note = 'Your current balance is ' + console.log(note.italic + mathFun(balance)) + } else if (moolah === 'stocks'){ + investmentsHelp('stocks') + invest() + } else if (moolah === '?'){ + rules() + invest() + } else if (moolah === 'bonds'){ + investmentsHelp('bonds') + invest() + } else if (moolah === 'options'){ + investmentsHelp('stocks') + invest() + } else if (moolah === 'annuities'){ + investmentsHelp('annuities') + invest() + } else if (moolah === 'precious-metals-ira'){ + investmentsHelp('precious-metals-ira') + invest() + } else if (moolah === 'mutual-funds'){ + investmentsHelp('mutual-funds') + invest() + } else if (moolah === 'reit'){ + investmentsHelp('reit') + invest() + } else if (moolah === 'cryptocurrency'){ + investmentsHelp('cryptocurrency') + invest() + } else if (moolah === 'forex'){ + investmentsHelp('forex') + invest() + }else if (moolah === 'ipo-stocks'){ + investmentsHelp('ipo-stocks') + invest() + }else { readline.keyInPause(chalk.green("Okay, What will you invest in today?")) let holdMessage = readline.question(chalk.green(`And how much money do you want to invest in ${investmentTypes()}? `)) console.log(chalk.greenBright(`So you want to invest ${holdMessage} dollars in ${investmentTypes(index)}?`)) - // balance = 500 - // balance = balance - holdMessage + + balance = balance - holdMessage readline.keyInPause(chalk.greenBright(`You now have ${balance} dollars left after purchasing ${holdMessage} dollars worth of ${investmentTypes(index)}.`)) - } + } + + } + invest() + return balance } @@ -222,30 +225,26 @@ let mathFun = (balance)=>{ } - const rulesInstructions =()=>{ - console.log(chalk.greenBright('So, Its simple. I will test your skills as a day trader. A day trader is someone who buys and sells all their shares in a single day. Ill give you $500 to start.\n You can bank all your money, invest all of it or invest any amount from $1 up to your current balance. Reguadless of what you do, you have 7 days to turn that $500 into $5000 or more.')) +const rulesInstructions =()=>{ + console.log(chalk.greenBright('So, Its simple. I will test your skills as a day trader. A day trader is someone who buys and sells all their shares in a single day. Ill give you $2000 to start.\n You can bank all your money, invest all of it or invest any amount from $1 up to your current balance. Reguadless of what you do, you have 4 days to turn that $2000 into $3000 or more.')) readline.keyInPause(); console.log(chalk.greenBright('Each day you will be given a chance to choose what you want to invest in for that day and how much money you want to invest. Remeber, you dont have to invest')) readline.keyInPause(); console.log(chalk.greenBright('I should warn you; Investment can be tricky. You can lose all your money just as easy as you can gain it. Different investment options have differnt perks, payouts times and consequences. So invest wisely.')) readline.keyInPause(); - console.log(chalk.greenBright("If by the end of day 7 you have $5000 dollars or more, You will recieve your share of the familie's wealth. And win the game.")) - console.log(chalk.greenBright('However, make $4999 or less and....well....lets say youll win the right to grind the 9-5 like all the other saps')) + console.log(chalk.greenBright("If by the end of day 4 you have $3000 dollars or more, You will recieve your share of the familie's wealth. And win the game.")) + console.log(chalk.greenBright('However, make $2999 or less and....well....lets say youll win the right to grind the 9-5 like all the other saps')) readline.keyInPause(); - console.log(chalk.greenBright("Again, choose wisely. You can get a brief explaination of each investment type by typing the investment name. Example, typing the word 'stocks' and you will be given a description of what stocks are")) + console.log(chalk.greenBright("Again, choose wisely. You can get a brief explaination of each investment type by typing the investment name when you are asked if you want to bank. Example, type the word 'stocks' and you will be given a description of what stocks are")) readline.keyInPause(); - console.log(chalk.greenBright("When you are ready to invest you can enter investment type then amount. Or you can choose not to invest by typing the word 'bank'.")) + console.log(chalk.greenBright("When you are ready to invest you can enter investment type then amount. Or you can choose not to invest by answering yes when you are asked if you want to bank' Once you chose an investment type, you can no longer chose to bank your money")) readline.keyInPause(); - console.log(chalk.greenBright("You can also type in 'rules' to get a reminder of the rules")) + console.log(chalk.greenBright("You can also type in '?' to get a reminder of the rules")) console.log(chalk.greenBright(" Well, thats all. Happy Investings!")) readline.keyInPause() - // morningGreeting() + - } - - - - let currentDay = 1 +} @@ -268,33 +267,30 @@ const introduction = () => { console.log(chalk.green('Greetings!') + say.italic + chalk.green( ' My name is Debonaire')) let nameInput = readline.question(chalk.green("And your name dear?: ")) console.log(chalk.green(`${nameInput}, ...${nameInput} I think I knew a ${nameInput} once.`,'Peculiar indivisual \n')) - readline.keyInPause(scratch.italic); - console.log('') - console.log(chalk.green("Anyway. I am your long lost cousin's brother's aunt. Three times removed. Or something of that sorts. \n")) - readline.keyInPause(sus.italic); - console.log('') + readline.keyInPause(scratch.italic); + console.log('') + console.log(chalk.green("Anyway. I am your long lost cousin's brother's aunt. Three times removed. Or something of that sorts. \n")) + readline.keyInPause(sus.italic); + console.log('') console.log(chalk.green("My point is, you're family. And as family, I've been instructed to give you a portion of the family's wealth \n")) - readline.keyInPause(money.italic) - console.log('') + readline.keyInPause(money.italic) + console.log('') let playGame = readline.question(chalk.green("Are you interested in a portion of our family's wealth?:")) - console.log('') - if(playGame = 'yes'){console.log(chalk.green("Of course you are. Who doesn't love free money"))} else if (playGame = 'no') { + console.log('') + if(playGame){console.log(chalk.green("Of course you are. Who doesn't love free money"))} else{ console.log(chalk.green("That's okay, I have a proposition for you either way")) - } else { - command = readline.prompt({limitMessage:'$ is not avaiable'}) - } - console.log('') + } + console.log('') console.log(chalk.green("Unfortuantely, I can't just hand over the money, my dear. At least not without knowing if you're responsible enought to handle it \n")) console.log(chalk.green("You'll have to prove yourself. ")) readline.keyInPause('Says the lady who randomly approached YOU. \n') console.log(chalk.green("How do you prove yourself? I am glad you asks \n")) console.log(chalk.green(`I have a test for you, ${nameInput}. A game, if that suits you better \n`)) - answer = readline.keyInYN(plaOrNay.italic) - if (1){ + answer = readline.keyInYN(plaOrNay.italic) + if ('y'){ console.log(chalk.green('Great! Let me explain the rules')) - // rulesInstructions() - } else{ + }else{ console.log(nah.italic) leaveGame() } @@ -319,22 +315,22 @@ let drive = ()=> { const onTheJob = ()=>{ drive() -const jobAM = () => { - jobTask = ['Work', 'Read', 'Chat','Dance'] - index = readline.keyInSelect(jobTask, chalk.greenBright(chalk.greenBright("So this is what you call work? Now that we are here, what will you do?"))) -if(index === 0||jobTask === 'word' ){ - console.log(chalk.greenBright("*Yawn* Wake me up when you're done.")) + const jobAM = () => { + jobTask = ['Work', 'Read', 'Chat','Dance'] + index = readline.keyInSelect(jobTask, chalk.greenBright(chalk.greenBright("So this is what you call work? Now that we are here, what will you do?"))) + if(index === 0||jobTask === 'word' ){ + console.log(chalk.greenBright("*Yawn* Wake me up when you're done.")) } else if (index === 1){ let news = 'According to webnews.aw, Walmart will use fully driverless trucks to make deliveries in 2021' - console.log(chalk.green(news.italic)) + console.log(chalk.green(news.italic)) } else if (index=== 2){ - console.log(chalk.greenBright('Oh, you rather chat with someone other than me...okay')) + console.log(chalk.greenBright('Oh, you rather chat with someone other than me...okay')) } else if(index === 3){ console.log(chalk.green('Dancing always bring up my spirits!')) }else { - command = readline.prompt({ + command = readline.prompt({ limit: ['Work', 'Read', 'Chat','leave-early', 'Check-Stock'], limitMessage: 'I can not accept $ . Please input another.' }) @@ -353,30 +349,30 @@ const lunchBreak = ()=>{ readline.keyInPause('After 4 hours of eye strain its now time for lunch!') -const midDay = () => { - array = ['Kiss up to superiors', 'Have Lunch', 'Charm coworker', 'Work Through Lunch'] - index = readline.keyInSelect(array, chalk.greenBright(chalk.greenBright("Glad that whole work thing is over. What? This is only a lunch break? What do you do on your lunch break?"))) -if(index === 0 ){ - console.log(chalk.greenBright("Nice, Now you're only 1999 kisses away from an actual raise!")) + const midDay = () => { + array = ['Kiss up to superiors', 'Have Lunch', 'Charm coworker', 'Work Through Lunch'] + index = readline.keyInSelect(array, chalk.greenBright(chalk.greenBright("Glad that whole work thing is over. What? This is only a lunch break? What do you do on your lunch break?"))) + if(index === 0 ){ + console.log(chalk.greenBright("Nice, Now you're only 1999 kisses away from an actual raise!")) } else if (index === 1){ - console.log(chalk.green(chalk.greenBright("Remmeber when you asked me what that smell was in the car? Well, it's your lunch! I made you a tuna sandwhich with onion and eggs! Enjoy!"))) + console.log(chalk.green(chalk.greenBright("Remmeber when you asked me what that smell was in the car? Well, it's your lunch! I made you a tuna sandwhich with onion and eggs! Enjoy!"))) } else if (index === 2){ - console.log(chalk.greenBright("Aren't you the charmer")) + console.log(chalk.greenBright("Aren't you the charmer")) } else if(index === 3){ console.log(chalk.green("well, at least you'll have a job to return to if this investment plan doesn't work out for you.")) }else { - command = readline.prompt({ + command = readline.prompt({ limit: ['Kiss up to superiors', 'Have Lunch', 'Charm coworker','Sleep', 'Work Through Lunch'], limitMessage: 'I can not accept $ . Please input another.' }) } } -midDay() + midDay() } @@ -384,16 +380,14 @@ midDay() - const endOfDay = ()=>{ +const endOfDay = ()=>{ morning = 'The sun began to set, signalling the end of your workday ' readline.keyInPause(morning.italic) console.log(chalk.greenBright("I took the liberty to sell all your shares")) watch = 'Debonaire checks her watch' readline.keyInPause(watch.italic); - balance = console.log(chalk.greenBright(`It's 3:59am. Markets close at 4pm. After selling your shares, your current balance is ` + mathFun(balance))) - readline.keyInPause(chalk.greenBright(`You should head home and get some sleep. Tomorrow will be a new day of investing.`)) } @@ -404,10 +398,10 @@ midDay() const bankAccount =(balance)=>{ if(balance <= 0){ - console.log(chalk.greenBright('Oh, sorry dear, looks like you ran out of money. Unfortunately You do not inherit any wealth')) + console.log(chalk.bgMagentaBright('Oh, sorry dear, looks like you ran out of money. Unfortunately You do not inherit any wealth')) gameLoop() - } else if(balance >= 2800){ - console.log(chalk.greenBright('Celebrate good times, comeon!! Congratulations you made it to $5000. You get to live it up with the filthy rich')) + } else if(balance >= 3800){ + console.log(chalk.bgMagentaBright('Celebrate good times, comeon!! Congratulations you made it to $4000. You get to live it up with the filthy rich')) readline.keyInPause() console.log(chalk.greenBright("Those who are filthy rich in knowledge, that is! Here is our family secret, An investment in knowledge pays the best interest.” -Benjamin Franklin- \n By playing my game you learned the first steps in a life long skill of investment. You know more now than you did before we met and therefor can build on what you've learned. Congratulations!! You are now wealthy in mind.")) readline.keyInPause() @@ -422,6 +416,7 @@ const bankAccount =(balance)=>{ + // prosperity-game name OR Bank or Bust let fun = ()=> { plaOrNay = 'Do you want to play?' @@ -444,19 +439,7 @@ const play = () => { -// let response; -// while (1) { -// response = readline.question(">"); -// if ('?' === response) { -// rules(); -// } else if ( 'quit' === response) { -// leaveGame(); -// // } .... more else if ... { -// // } -// } - - -// } + } startGame() From 64b7bd118b4f0d2678ee3ac2795346084babf705 Mon Sep 17 00:00:00 2001 From: Dequisa Date: Tue, 5 Jan 2021 14:47:52 -0500 Subject: [PATCH 05/11] Latest changes --- textBasedAdventure.js => prosperity.js | 53 +++++++++++++++++--------- 1 file changed, 34 insertions(+), 19 deletions(-) rename textBasedAdventure.js => prosperity.js (94%) diff --git a/textBasedAdventure.js b/prosperity.js similarity index 94% rename from textBasedAdventure.js rename to prosperity.js index e587851..e3efcd9 100644 --- a/textBasedAdventure.js +++ b/prosperity.js @@ -71,9 +71,7 @@ play() } - const gameLoop = () => { - } const investmentTypes = () => { @@ -196,7 +194,7 @@ const morningGreeting = ()=>{ }else if (moolah === 'ipo-stocks'){ investmentsHelp('ipo-stocks') invest() - }else { + }else if(moolah ==='no'){ readline.keyInPause(chalk.green("Okay, What will you invest in today?")) let holdMessage = readline.question(chalk.green(`And how much money do you want to invest in ${investmentTypes()}? `)) @@ -205,6 +203,8 @@ const morningGreeting = ()=>{ balance = balance - holdMessage readline.keyInPause(chalk.greenBright(`You now have ${balance} dollars left after purchasing ${holdMessage} dollars worth of ${investmentTypes(index)}.`)) + } else { + invest() } } @@ -216,7 +216,7 @@ const morningGreeting = ()=>{ let mathFun = (balance)=>{ - if(balance > 1800){ + if(balance > 100){ balance = balance + 200 return balance} else { @@ -237,7 +237,7 @@ const rulesInstructions =()=>{ readline.keyInPause(); console.log(chalk.greenBright("Again, choose wisely. You can get a brief explaination of each investment type by typing the investment name when you are asked if you want to bank. Example, type the word 'stocks' and you will be given a description of what stocks are")) readline.keyInPause(); - console.log(chalk.greenBright("When you are ready to invest you can enter investment type then amount. Or you can choose not to invest by answering yes when you are asked if you want to bank' Once you chose an investment type, you can no longer chose to bank your money")) + console.log(chalk.greenBright("When you are ready to invest you can enter investment type then amount(Numbers ONLY) example 200 dollars should be ented as onlyy 200. Or you can choose not to invest by answering yes when you are asked if you want to bank' Once you chose an investment type, you can no longer chose to bank your money")) readline.keyInPause(); console.log(chalk.greenBright("You can also type in '?' to get a reminder of the rules")) console.log(chalk.greenBright(" Well, thats all. Happy Investings!")) @@ -249,14 +249,15 @@ const rulesInstructions =()=>{ - +const beginingMessage = ()=> { secret = readline.question(`A stranger approaches you on....today..You check your phone... your phone tells you that today is ${today}. `, { hideEchoBack: true, }); - +} const introduction = () => { + beginingMessage() scratch = 'Debonaire scratches her head as she ponders your name \n' sus = "That\'s not suspicous at all \n" money = 'ooh, money! \n' @@ -276,7 +277,6 @@ const introduction = () => { readline.keyInPause(money.italic) console.log('') let playGame = readline.question(chalk.green("Are you interested in a portion of our family's wealth?:")) - console.log('') if(playGame){console.log(chalk.green("Of course you are. Who doesn't love free money"))} else{ console.log(chalk.green("That's okay, I have a proposition for you either way")) } @@ -288,7 +288,7 @@ const introduction = () => { console.log(chalk.green(`I have a test for you, ${nameInput}. A game, if that suits you better \n`)) answer = readline.keyInYN(plaOrNay.italic) - if ('y'){ + if (answer){ console.log(chalk.green('Great! Let me explain the rules')) }else{ console.log(nah.italic) @@ -397,10 +397,10 @@ const endOfDay = ()=>{ const bankAccount =(balance)=>{ - if(balance <= 0){ - console.log(chalk.bgMagentaBright('Oh, sorry dear, looks like you ran out of money. Unfortunately You do not inherit any wealth')) - gameLoop() - } else if(balance >= 3800){ + if(balance <= 3000){ + console.log(chalk.bgBlueBright('Oh, sorry dear, looks like you ran out of money. Unfortunately You do not inherit any wealth')) + fun() + } else if(balance >= 3001){ console.log(chalk.bgMagentaBright('Celebrate good times, comeon!! Congratulations you made it to $4000. You get to live it up with the filthy rich')) readline.keyInPause() console.log(chalk.greenBright("Those who are filthy rich in knowledge, that is! Here is our family secret, An investment in knowledge pays the best interest.” -Benjamin Franklin- \n By playing my game you learned the first steps in a life long skill of investment. You know more now than you did before we met and therefor can build on what you've learned. Congratulations!! You are now wealthy in mind.")) @@ -416,6 +416,21 @@ const bankAccount =(balance)=>{ +const gameLoop = () => { + while(true){ + let play = readline.keyInYN('Welcome to the game Prosperity. Would you like to play?') + if(play === true){ + startGame() + } else { + quitGame() + } + } + +} + + + + // prosperity-game name OR Bank or Bust let fun = ()=> { @@ -425,7 +440,7 @@ let fun = ()=> { if (answer){ let yey = "Yey! Let's do it again!" console.log(yey.italic) - play() + gameLoop() }else {console.log(nah.italic) quitGame() } @@ -435,13 +450,13 @@ const play = () => { introduction() rulesInstructions() today2() - bankAccount(2800) - - - + bankAccount(2000) } -startGame() +gameLoop() + + +// startGame() From c2c4c6f76c88069993b33588bcd16347ebf315a6 Mon Sep 17 00:00:00 2001 From: Dequisa Date: Tue, 5 Jan 2021 20:38:25 -0500 Subject: [PATCH 06/11] Final --- prosperity.js | 215 +++++++++++++++++++++++++++++++++++--------------- 1 file changed, 152 insertions(+), 63 deletions(-) diff --git a/prosperity.js b/prosperity.js index e3efcd9..8ef70a6 100644 --- a/prosperity.js +++ b/prosperity.js @@ -8,8 +8,22 @@ const { read } = require('fs'); const { kStringMaxLength } = require('buffer'); -const today = new Date().toLocaleDateString(); +const today = new Date().toLocaleDateString(); +say = '...says the stranger.' +let balance = 2000 +const optionArray = (arr)=>{ + if(arr == 0){ + balance += 50 + }else if (arr === 1){ + balance -= 100 + }else if (arr === 2){ + balance += 100 + + }else if (arr === 3){ + balance -= 50 + }else{} +} const investmentsHelp = bid=>{ switch(bid){ @@ -52,11 +66,9 @@ const investmentsHelp = bid=>{ } } -say = '...says the stranger.' -let balance = 2000 const startGame = () => { @@ -72,13 +84,53 @@ play() - +index = '' const investmentTypes = () => { - investments = ["Stocks", "Bonds", "Options", "Annuities", "Precious-Metals", "Mutual-Fund", "Real-Estate", "REIT", "Cryptocurrency", "Forex", "IPO stocks"], - index = readline.keyInSelect(investments, 'Which invesetment type'); - console.log('Nice! ' + investments[index] + ' is your investment of choice!') - return investments[index] + investments = ["Stocks", "Bonds", "Options", "Annuities", "Precious-Metals", "Mutual-Fund", "Real-Estate", "REIT", "Cryptocurrency", "Forex", "IPO stocks"] + + for(i=0;i { breakfastFoods = ['Eggs', 'Cereal', 'Spinach','Bacon'] let index = readline.keyInSelect(breakfastFoods, "I've made breakfast for you! which breakfask would you like?:") if(index === 0){ - console.log(chalk.greenBright('Delicious')) - } else if (index === 1){ - console.log(chalk.green('Buget food. Perhaps you can work on changing old habits')) - // subtract 10 dollars from daily balance + console.log(chalk.greenBright('Delicious! You gained $50')) + } else if (index === -1){ + console.log(chalk.greenBright("Did I ever tell you 'The Avatar' was my favorite childhood cartoon?")) + } else if(index === 1){ + console.log(chalk.green('Buget food. \n Perhaps you can work on changing old habits. You lost $100')) + } else if (index === 2){ - console.log(chalk.greenBright('Great choice! The food of wealth.')) - // Add 10 dollars to daily balance + console.log(chalk.greenBright('Great choice! The food of wealth. \n You gained $100')) + } else if(index === 3){ - console.log(chalk.green('Mmmm..Bring home the bacon!')) + console.log(chalk.green('Mmmm..Bring home the bacon! \n Actual bacon not metaphorically. You lost $50')) }else { command = readline.prompt({ limit: ['eggs', 'cereal', 'spinach', 'bacon'], limitMessage: `I can not accept ${index} . Please input another.` }) } + optionArray(index) } @@ -152,7 +207,7 @@ const morningGreeting = ()=>{ watch = 'Debonaire checks her watch' readline.keyInPause(watch.italic); - console.log(chalk.greenBright(`It's 9:29am. Markets open at 9:30am. Your current balance is ` + mathFun())) + console.log(chalk.greenBright(`It's 9:29am. Markets open at 9:30am. Your current balance is ${balance}`)) let invest =()=>{ let moolah =readline.question(chalk.greenBright('Would you like to bank your money?')) @@ -160,7 +215,7 @@ const morningGreeting = ()=>{ console.log(chalk.greenBright('Okay, Your money will survive long enough to fight another day')) let note = 'Your current balance is ' - console.log(note.italic + mathFun(balance)) + console.log(note.italic + mathFun()) } else if (moolah === 'stocks'){ investmentsHelp('stocks') invest() @@ -195,38 +250,45 @@ const morningGreeting = ()=>{ investmentsHelp('ipo-stocks') invest() }else if(moolah ==='no'){ - readline.keyInPause(chalk.green("Okay, What will you invest in today?")) + readline.keyInPause(chalk.green()) - let holdMessage = readline.question(chalk.green(`And how much money do you want to invest in ${investmentTypes()}? `)) - console.log(chalk.greenBright(`So you want to invest ${holdMessage} dollars in ${investmentTypes(index)}?`)) + let holdMessage = readline.question(chalk.green(`And how much money do you want to invest? `)) + investmentTypes() + console.log(chalk.greenBright(`So you want to invest ${holdMessage} dollars in ${index}?`)) balance = balance - holdMessage - readline.keyInPause(chalk.greenBright(`You now have ${balance} dollars left after purchasing ${holdMessage} dollars worth of ${investmentTypes(index)}.`)) + readline.keyInPause(chalk.greenBright(`Your Account has been reduced by ${holdMessage} dollars after you invested ${holdMessage} dollars in `+ index)) } else { invest() } } invest() - return balance + } -let mathFun = (balance)=>{ - if(balance > 100){ - balance = balance + 200 - return balance} - else { - return balance - } + + +let mathFun = (num1,num2)=>{ + if(num1 === typeof Number){ + balance = balance + num1 + return balance + } + if (num1 && num2 === typeof Number){ + balance = balance + num1 + num2 + return balance + } + + } const rulesInstructions =()=>{ - console.log(chalk.greenBright('So, Its simple. I will test your skills as a day trader. A day trader is someone who buys and sells all their shares in a single day. Ill give you $2000 to start.\n You can bank all your money, invest all of it or invest any amount from $1 up to your current balance. Reguadless of what you do, you have 4 days to turn that $2000 into $3000 or more.')) + console.log(chalk.greenBright('So, Its simple. I will test your skills as a day trader. A day trader is someone who buys and sells shares of an an investment, such as stocks, in a single day. Ill give you $2000 to start.\n You can bank all your money, invest all of it or invest any amount from $1 up to your current balance. Reguadless of what you do, you have 4 days to turn that $2000 into $4000 or more.')) readline.keyInPause(); console.log(chalk.greenBright('Each day you will be given a chance to choose what you want to invest in for that day and how much money you want to invest. Remeber, you dont have to invest')) readline.keyInPause(); @@ -237,7 +299,7 @@ const rulesInstructions =()=>{ readline.keyInPause(); console.log(chalk.greenBright("Again, choose wisely. You can get a brief explaination of each investment type by typing the investment name when you are asked if you want to bank. Example, type the word 'stocks' and you will be given a description of what stocks are")) readline.keyInPause(); - console.log(chalk.greenBright("When you are ready to invest you can enter investment type then amount(Numbers ONLY) example 200 dollars should be ented as onlyy 200. Or you can choose not to invest by answering yes when you are asked if you want to bank' Once you chose an investment type, you can no longer chose to bank your money")) + console.log(chalk.greenBright("When you are ready to invest you can enter investment type then amount(Numbers ONLY) example 200 dollars should be ented as only 200. Or you can choose not to invest by answering yes when you are asked if you want to bank' Once you chose an investment type, you can no longer chose to bank your money")) readline.keyInPause(); console.log(chalk.greenBright("You can also type in '?' to get a reminder of the rules")) console.log(chalk.greenBright(" Well, thats all. Happy Investings!")) @@ -265,7 +327,7 @@ const introduction = () => { nah = 'Thats too bad. I was looking forward to watching you play' say = 'Says the lady who randomly approached YOU. \n' - console.log(chalk.green('Greetings!') + say.italic + chalk.green( ' My name is Debonaire')) + console.log(chalk.green('Greetings!') + chalk.green( ' My name is Debonaire')) let nameInput = readline.question(chalk.green("And your name dear?: ")) console.log(chalk.green(`${nameInput}, ...${nameInput} I think I knew a ${nameInput} once.`,'Peculiar indivisual \n')) readline.keyInPause(scratch.italic); @@ -276,24 +338,28 @@ const introduction = () => { console.log(chalk.green("My point is, you're family. And as family, I've been instructed to give you a portion of the family's wealth \n")) readline.keyInPause(money.italic) console.log('') - let playGame = readline.question(chalk.green("Are you interested in a portion of our family's wealth?:")) - if(playGame){console.log(chalk.green("Of course you are. Who doesn't love free money"))} else{ + let playGame = readline.question(chalk.green("Are you interested in a portion of our family's wealth? Please answer Yes or No?:")) + if(playGame === "Yes"|| playGame === "yes" || playGame ==="YES"){console.log(chalk.green("Of course you are. Who doesn't love free money"))} else if (playGame === 'NO'|| playGame === "no"|| playGame ==="No"){ console.log(chalk.green("That's okay, I have a proposition for you either way")) - } + } else{ + console.log(chalk.green(`${playGame}..You're funny. Humor runs in the family. Now let's get back to the subject of our family's wealth!`)) + } console.log('') console.log(chalk.green("Unfortuantely, I can't just hand over the money, my dear. At least not without knowing if you're responsible enought to handle it \n")) console.log(chalk.green("You'll have to prove yourself. ")) readline.keyInPause('Says the lady who randomly approached YOU. \n') - console.log(chalk.green("How do you prove yourself? I am glad you asks \n")) + console.log(chalk.green("How do you prove yourself? I am glad you asked \n")) console.log(chalk.green(`I have a test for you, ${nameInput}. A game, if that suits you better \n`)) answer = readline.keyInYN(plaOrNay.italic) - if (answer){ + if (answer === true){ console.log(chalk.green('Great! Let me explain the rules')) - }else{ + }else if (answer === false){ console.log(nah.italic) leaveGame() - } + } else if (answer === ''){ + console.log('Ill accept that as a yes!') + } else {} } @@ -319,16 +385,18 @@ const onTheJob = ()=>{ jobTask = ['Work', 'Read', 'Chat','Dance'] index = readline.keyInSelect(jobTask, chalk.greenBright(chalk.greenBright("So this is what you call work? Now that we are here, what will you do?"))) if(index === 0||jobTask === 'word' ){ - console.log(chalk.greenBright("*Yawn* Wake me up when you're done.")) + console.log(chalk.greenBright("*Yawn* Wake me up when you're done. \n Gained $50 from working")) + } else if(index === -1){ + console.log(chalk.greenBright(" My favorite character in 'The Avatar was Uncle")) } else if (index === 1){ - let news = 'According to webnews.aw, Walmart will use fully driverless trucks to make deliveries in 2021' + let news = 'According to webnews.aw, Walmart will use fully driverless trucks to make deliveries in 2021. \n Unfortunately that was unproductive. You lose $100' console.log(chalk.green(news.italic)) } else if (index=== 2){ - console.log(chalk.greenBright('Oh, you rather chat with someone other than me...okay')) + console.log(chalk.greenBright('Oh, you rather chat with someone other than me...okay. \n Turns out, speaking to new people caused you to learn new things. You earned $100')) } else if(index === 3){ - console.log(chalk.green('Dancing always bring up my spirits!')) + console.log(chalk.green("Dancing always bring up my spirits! \n Unfortunately you weren't dancing for money so you lost $50")) }else { command = readline.prompt({ limit: ['Work', 'Read', 'Chat','leave-early', 'Check-Stock'], @@ -336,8 +404,9 @@ const onTheJob = ()=>{ }) } + optionArray(index) } - jobAM() + jobAM() readline.keyInPause() } @@ -353,17 +422,19 @@ const lunchBreak = ()=>{ array = ['Kiss up to superiors', 'Have Lunch', 'Charm coworker', 'Work Through Lunch'] index = readline.keyInSelect(array, chalk.greenBright(chalk.greenBright("Glad that whole work thing is over. What? This is only a lunch break? What do you do on your lunch break?"))) if(index === 0 ){ - console.log(chalk.greenBright("Nice, Now you're only 1999 kisses away from an actual raise!")) + console.log(chalk.greenBright("Nice, Now you're only 1999 kisses away from an actual raise! \n You gained $50 out of pity")) } else if (index === 1){ - console.log(chalk.green(chalk.greenBright("Remmeber when you asked me what that smell was in the car? Well, it's your lunch! I made you a tuna sandwhich with onion and eggs! Enjoy!"))) + console.log(chalk.green(chalk.greenBright("Remmeber when you asked me what that smell was in the car? Well, it's your lunch! I made you a tuna sandwhich with onion and eggs! Enjoy! \n You'll regret eating that later. You lose $100"))) - } else if (index === 2){ - console.log(chalk.greenBright("Aren't you the charmer")) + } else if (index === -1){ + console.log(chalk.greenBright(" Uncle was apart of an ancient secret society called 'The Order of the white lotus' Which he gained access to by saying 'white lotus'")) + }else if(index === 2){ + console.log(chalk.greenBright("Aren't you the charmer. Having charisma gets you everything. You gained $100 ")) } else if(index === 3){ - console.log(chalk.green("well, at least you'll have a job to return to if this investment plan doesn't work out for you.")) + console.log(chalk.green("well, at least you'll have a job to return to if this investment plan doesn't work out for you. \n You lost $50 becuase...who works through lunch!")) }else { command = readline.prompt({ limit: ['Kiss up to superiors', 'Have Lunch', 'Charm coworker','Sleep', 'Work Through Lunch'], @@ -371,6 +442,7 @@ const lunchBreak = ()=>{ }) } +optionArray(array) } midDay() } @@ -387,23 +459,31 @@ const endOfDay = ()=>{ watch = 'Debonaire checks her watch' readline.keyInPause(watch.italic); - console.log(chalk.greenBright(`It's 3:59am. Markets close at 4pm. After selling your shares, your current balance is ` + mathFun(balance))) - - readline.keyInPause(chalk.greenBright(`You should head home and get some sleep. Tomorrow will be a new day of investing.`)) + console.log(chalk.greenBright(`It's 3:59am. Markets close at 4pm. \n After selling all your shares, your current balance is ${balance}`)) + + readline.keyInPause(chalk.greenBright('Phew, what a day')) + let feelings = readline.question(chalk.green("How did you do in the market today? Great or Okay:")) + feelings.toLocaleLowerCase + if (feelings === 'great'){ + console.log(chalk.greenBright('I knew you would be good at this')) + } else if (feelings === 'okay'){ + console.log(chalk.greenBright("Just okay? Perhaps a joke will cheer you up.\n If you boil a funny bone it becomes a laughing stock. \n That's pretty humerus.")) + } else {console.log(chalk.greenBright(`*in robot voice* Does not compute .."${feelings}" hehe again with your humor`))} + console.log(chalk.greenBright(`You should head home and get some sleep. Tomorrow will be a new day of investing.`)) } -const bankAccount =(balance)=>{ +const bankAccount =()=>{ - if(balance <= 3000){ + if(balance <= 4000){ console.log(chalk.bgBlueBright('Oh, sorry dear, looks like you ran out of money. Unfortunately You do not inherit any wealth')) fun() - } else if(balance >= 3001){ - console.log(chalk.bgMagentaBright('Celebrate good times, comeon!! Congratulations you made it to $4000. You get to live it up with the filthy rich')) + } else if(balance >= 4001){ + console.log(chalk.bgMagentaBright("Cel-e-brate good times, C'mon!! Congratulations you made it to $4000. You get to live it up with the filthy rich")) readline.keyInPause() - console.log(chalk.greenBright("Those who are filthy rich in knowledge, that is! Here is our family secret, An investment in knowledge pays the best interest.” -Benjamin Franklin- \n By playing my game you learned the first steps in a life long skill of investment. You know more now than you did before we met and therefor can build on what you've learned. Congratulations!! You are now wealthy in mind.")) + console.log(chalk.greenBright("Those who are filthy rich in knowledge, that is! \n Here is our family secret, An investment in knowledge pays the best interest.” -Benjamin Franklin- \n By playing my game you learned the first steps in a life long skill of investment. You know more now than you did before we met and therefor can build on what you've learned. Congratulations!! You are now wealthy in mind.")) readline.keyInPause() console.log(chalk.greenBright('That was so much fun that I want to play again')) fun() @@ -432,17 +512,19 @@ const gameLoop = () => { -// prosperity-game name OR Bank or Bust + let fun = ()=> { plaOrNay = 'Do you want to play?' nah = 'Thats too bad. I was looking forward to watching you play' answer = readline.keyInYN(plaOrNay.italic) - if (answer){ + if (answer === true){ let yey = "Yey! Let's do it again!" console.log(yey.italic) gameLoop() - }else {console.log(nah.italic) + }else if (answer === false ){console.log(nah.italic) quitGame() + } else if (answer === ''){ + fun() } } @@ -450,13 +532,20 @@ const play = () => { introduction() rulesInstructions() today2() - bankAccount(2000) + bankAccount() } -gameLoop() +password = readline.question("Interested in a game of Pai Sho?", {hideEchoBack: true}); +password.toLocaleLowerCase +if(password === 'white lotus'){ + console.log(chalk.greenBright('Welcome to the Order of the White Lotus. \n You are a member of the elite. You automatically win the game!')) + balance += 5000 + bankAccount() +} else{ +gameLoop() +} -// startGame() From 22ad7dab42b2e9b7f7260d22c3f3b392bfa68732 Mon Sep 17 00:00:00 2001 From: Dequisa Date: Wed, 6 Jan 2021 08:39:57 -0500 Subject: [PATCH 07/11] Edits made to clean code&formatting --- prosperity.js | 277 ++++++++++++++++++-------------------------------- 1 file changed, 97 insertions(+), 180 deletions(-) diff --git a/prosperity.js b/prosperity.js index 8ef70a6..fe2f721 100644 --- a/prosperity.js +++ b/prosperity.js @@ -1,4 +1,4 @@ - const { Console } = require('console') +const { Console } = require('console') const { monitorEventLoopDelay } = require('perf_hooks') const readline = require('readline-sync') const { start } = require('repl') @@ -6,9 +6,6 @@ const colors = require('colors'); const chalk = require("chalk"); const { read } = require('fs'); const { kStringMaxLength } = require('buffer'); - - - const today = new Date().toLocaleDateString(); say = '...says the stranger.' let balance = 2000 @@ -63,36 +60,21 @@ const investmentsHelp = bid=>{ limitMessage: `I can not accept $ . Please input another.` }) + } } -} - - - - - - - const startGame = () => { -play() - } - const leaveGame = () => { - console.log("It's been a pleasure. Bye Bye!") - process.exit() - } - const quitGame = () => { - leaveGame() - } - - - +const startGame = () => {play()} +const leaveGame = () => {console.log("It's been a pleasure. Bye Bye!") + process.exit()} +const quitGame = () => { + leaveGame()} index = '' - - const investmentTypes = () => { - investments = ["Stocks", "Bonds", "Options", "Annuities", "Precious-Metals", "Mutual-Fund", "Real-Estate", "REIT", "Cryptocurrency", "Forex", "IPO stocks"] +const investmentTypes = () => { + investments = ["Stocks", "Bonds", "Options", "Annuities", "Precious-Metals", "Mutual-Fund", "Real-Estate", "REIT", "Cryptocurrency", "Forex"] for(i=0;i{ day = 1 let message = '' @@ -166,26 +146,23 @@ const today2 =(day)=>{ } return message } - - - const breakfast = () => { breakfastFoods = ['Eggs', 'Cereal', 'Spinach','Bacon'] let index = readline.keyInSelect(breakfastFoods, "I've made breakfast for you! which breakfask would you like?:") if(index === 0){ - console.log(chalk.greenBright('Delicious! You gained $50')) + console.log(chalk.greenBright('Delicious! You gained $50\n\n')) } else if (index === -1){ console.log(chalk.greenBright("Did I ever tell you 'The Avatar' was my favorite childhood cartoon?")) } else if(index === 1){ - console.log(chalk.green('Buget food. \n Perhaps you can work on changing old habits. You lost $100')) + console.log(chalk.green('Buget food. \n Perhaps you can work on changing old habits. You lost $100\n\n')) } else if (index === 2){ - console.log(chalk.greenBright('Great choice! The food of wealth. \n You gained $100')) + console.log(chalk.greenBright('Great choice! The food of wealth. \n You gained $100\n\n')) } else if(index === 3){ - console.log(chalk.green('Mmmm..Bring home the bacon! \n Actual bacon not metaphorically. You lost $50')) + console.log(chalk.green('Mmmm..Bring home the bacon! \n Actual bacon not metaphorically. You lost $50\n\n')) }else { command = readline.prompt({ limit: ['eggs', 'cereal', 'spinach', 'bacon'], @@ -194,8 +171,7 @@ const breakfast = () => { } optionArray(index) -} - +} const morningGreeting = ()=>{ morning = 'The morning sunlight of a new day hits your eyes as Debornaire opens the curtains to your bedroom, waking you up.' @@ -207,15 +183,15 @@ const morningGreeting = ()=>{ watch = 'Debonaire checks her watch' readline.keyInPause(watch.italic); - console.log(chalk.greenBright(`It's 9:29am. Markets open at 9:30am. Your current balance is ${balance}`)) + console.log(chalk.greenBright(`It's 9:29am. Markets open at 9:30am. Your current balance is ${balance}\n`)) let invest =()=>{ let moolah =readline.question(chalk.greenBright('Would you like to bank your money?')) if(moolah === 'yes'){ - console.log(chalk.greenBright('Okay, Your money will survive long enough to fight another day')) + console.log(chalk.greenBright('Okay, Your money will survive long enough to fight another day\n\n')) - let note = 'Your current balance is ' - console.log(note.italic + mathFun()) + let note = `Your balance after banking is ${balance} ` + console.log(note.italic) } else if (moolah === 'stocks'){ investmentsHelp('stocks') invest() @@ -253,8 +229,9 @@ const morningGreeting = ()=>{ readline.keyInPause(chalk.green()) let holdMessage = readline.question(chalk.green(`And how much money do you want to invest? `)) + console.log('\n\n') investmentTypes() - console.log(chalk.greenBright(`So you want to invest ${holdMessage} dollars in ${index}?`)) + console.log(chalk.greenBright(`So you want to invest ${holdMessage} dollars in ${index}?\n`)) balance = balance - holdMessage @@ -267,57 +244,32 @@ const morningGreeting = ()=>{ invest() -} - - - - - -let mathFun = (num1,num2)=>{ - if(num1 === typeof Number){ - balance = balance + num1 - return balance - } - if (num1 && num2 === typeof Number){ - balance = balance + num1 + num2 - return balance - } - - -} - - +} const rulesInstructions =()=>{ - console.log(chalk.greenBright('So, Its simple. I will test your skills as a day trader. A day trader is someone who buys and sells shares of an an investment, such as stocks, in a single day. Ill give you $2000 to start.\n You can bank all your money, invest all of it or invest any amount from $1 up to your current balance. Reguadless of what you do, you have 4 days to turn that $2000 into $4000 or more.')) + console.log(chalk.greenBright('So, Its simple. I will test your skills as a day trader. A day trader is someone who buys and sells shares of an an investment, such as stocks, in a single day. Ill give you $2000 to start.\n \n You can either bank all your money, invest all of it or invest a portion of you money. You have 4 days to turn that $2000 into $4000 or more.\n \n')) readline.keyInPause(); - console.log(chalk.greenBright('Each day you will be given a chance to choose what you want to invest in for that day and how much money you want to invest. Remeber, you dont have to invest')) + console.log(chalk.greenBright('Each day you will be given a chance to invest or bank. Remeber, you dont have to invest. \n \n')) readline.keyInPause(); - console.log(chalk.greenBright('I should warn you; Investment can be tricky. You can lose all your money just as easy as you can gain it. Different investment options have differnt perks, payouts times and consequences. So invest wisely.')) + console.log(chalk.greenBright('I should warn you; Investment can be tricky. You can lose all your money just as easy as you can gain it. So invest wisely.\n \n')) readline.keyInPause(); - console.log(chalk.greenBright("If by the end of day 4 you have $3000 dollars or more, You will recieve your share of the familie's wealth. And win the game.")) - console.log(chalk.greenBright('However, make $2999 or less and....well....lets say youll win the right to grind the 9-5 like all the other saps')) + console.log(chalk.greenBright("If by the end of day 4 you have $4000 dollars or more, You win the game. \n \n")) + console.log(chalk.greenBright('However, make $3999 or less and....well....lets say youll win the right to grind the 9-5 with all the other saps \n \n')) readline.keyInPause(); - console.log(chalk.greenBright("Again, choose wisely. You can get a brief explaination of each investment type by typing the investment name when you are asked if you want to bank. Example, type the word 'stocks' and you will be given a description of what stocks are")) + console.log(chalk.greenBright("You can get a brief explaination of each investment type by typing the investment name when you are asked if you want to bank. Example, type the word 'stocks' and you will be given a description of what stocks are. \n\n")) readline.keyInPause(); - console.log(chalk.greenBright("When you are ready to invest you can enter investment type then amount(Numbers ONLY) example 200 dollars should be ented as only 200. Or you can choose not to invest by answering yes when you are asked if you want to bank' Once you chose an investment type, you can no longer chose to bank your money")) + console.log(chalk.greenBright("When entering the amount you want to invest; Only enter the numerical value (Numbers ONLY) Example 200 dollars should be enteredd as only 200. You have one opportunity to bank your money per day \n\n")) readline.keyInPause(); - console.log(chalk.greenBright("You can also type in '?' to get a reminder of the rules")) + console.log(chalk.greenBright("You can also type in '?' to get a reminder of the rules\n\n")) console.log(chalk.greenBright(" Well, thats all. Happy Investings!")) - readline.keyInPause() + readline.keyInPause('\n') + console.log('\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n') + } - - - - -const beginingMessage = ()=> { -secret = readline.question(`A stranger approaches you on....today..You check your phone... your phone tells you that today is ${today}. `, { - hideEchoBack: true, - - }); -} - + const beginingMessage = ()=> { +secret = readline.question(`A stranger approaches you on....today..You check your phone... your phone tells you that today is ${today}. \n\n`, { + hideEchoBack: true,});} const introduction = () => { beginingMessage() scratch = 'Debonaire scratches her head as she ponders your name \n' @@ -328,7 +280,7 @@ const introduction = () => { say = 'Says the lady who randomly approached YOU. \n' console.log(chalk.green('Greetings!') + chalk.green( ' My name is Debonaire')) - let nameInput = readline.question(chalk.green("And your name dear?: ")) + let nameInput = readline.question(chalk.green("And your name dear?: \n\n")) console.log(chalk.green(`${nameInput}, ...${nameInput} I think I knew a ${nameInput} once.`,'Peculiar indivisual \n')) readline.keyInPause(scratch.italic); console.log('') @@ -361,160 +313,127 @@ const introduction = () => { console.log('Ill accept that as a yes!') } else {} } - - -const rules = () =>{ - console.log('Okay, here are the rules. You can choose to invest or save your money. You have 7 days to make $5000 or more.') + const rules = () =>{ + console.log('Okay, here are the rules. You can choose to invest or save your money. You have 4 days to make $4000 or more.') + readline.keyInPause() + console.log("When you are ready to invest you can enter investment type plus amount. Example stocks 2 dollars. Or you can choose not to invest by typing the word 'bank'.") readline.keyInPause() - console.log("When you are ready to invest you can enter investment type plus amount. Example stocks 2 dollars. Or you can choose not to invest by typing the word 'bank'.") - readline.keyInPause() console.log('Good Luck!') } - -let drive = ()=> { +const onTheJob = ()=>{ + console.log(chalk.greenBright("Well that was fun! But let's not forget about work")) let car = 'A plesant 15 minuet ride later' readline.keyInPause(car.italic) -} + console.log('\n\n') - -const onTheJob = ()=>{ - drive() - const jobAM = () => { jobTask = ['Work', 'Read', 'Chat','Dance'] - index = readline.keyInSelect(jobTask, chalk.greenBright(chalk.greenBright("So this is what you call work? Now that we are here, what will you do?"))) + index = readline.keyInSelect(jobTask, chalk.greenBright(chalk.greenBright("So this is what you call work? Now that we are here, what will you do?\n\n"))) if(index === 0||jobTask === 'word' ){ - console.log(chalk.greenBright("*Yawn* Wake me up when you're done. \n Gained $50 from working")) + console.log(chalk.greenBright("*Yawn* Wake me up when you're done. \n Gained $50 from working\n\n")) } else if(index === -1){ - console.log(chalk.greenBright(" My favorite character in 'The Avatar was Uncle")) + console.log(chalk.greenBright(" My favorite character in 'The Avatar was Uncle\n")) } else if (index === 1){ - let news = 'According to webnews.aw, Walmart will use fully driverless trucks to make deliveries in 2021. \n Unfortunately that was unproductive. You lose $100' + let news = 'According to webnews.aw, Walmart will use fully driverless trucks to make deliveries in 2021. \n Unfortunately that was unproductive. You lose $100\n\n' console.log(chalk.green(news.italic)) } else if (index=== 2){ - console.log(chalk.greenBright('Oh, you rather chat with someone other than me...okay. \n Turns out, speaking to new people caused you to learn new things. You earned $100')) + console.log(chalk.greenBright('Oh, you rather chat with someone other than me...okay. \n Turns out, speaking to new people caused you to learn new things. You earned $100\n\n')) } else if(index === 3){ - console.log(chalk.green("Dancing always bring up my spirits! \n Unfortunately you weren't dancing for money so you lost $50")) + console.log(chalk.green("Dancing always bring up my spirits! \n Unfortunately you weren't dancing for money so you lost $50\n\n")) }else { command = readline.prompt({ limit: ['Work', 'Read', 'Chat','leave-early', 'Check-Stock'], limitMessage: 'I can not accept $ . Please input another.' - }) - -} + }) + } optionArray(index) -} + } jobAM() - readline.keyInPause() + readline.keyInPause() } - - - - - const lunchBreak = ()=>{ readline.keyInPause('After 4 hours of eye strain its now time for lunch!') const midDay = () => { array = ['Kiss up to superiors', 'Have Lunch', 'Charm coworker', 'Work Through Lunch'] - index = readline.keyInSelect(array, chalk.greenBright(chalk.greenBright("Glad that whole work thing is over. What? This is only a lunch break? What do you do on your lunch break?"))) + index = readline.keyInSelect(array, chalk.greenBright(chalk.greenBright("Glad that whole work thing is over. What? This is only a lunch break? What do you do on your lunch break?\n\n"))) if(index === 0 ){ - console.log(chalk.greenBright("Nice, Now you're only 1999 kisses away from an actual raise! \n You gained $50 out of pity")) + console.log(chalk.greenBright("Nice, Now you're only 1999 kisses away from an actual raise! \n You gained $50 out of pity\n\n")) } else if (index === 1){ - console.log(chalk.green(chalk.greenBright("Remmeber when you asked me what that smell was in the car? Well, it's your lunch! I made you a tuna sandwhich with onion and eggs! Enjoy! \n You'll regret eating that later. You lose $100"))) - - + console.log(chalk.green(chalk.greenBright("Remmeber when you asked me what that smell was in the car? Well, it's your lunch! I made you a tuna sandwhich with onion and eggs! Enjoy! \n You'll regret eating that later. You lose $100\n\n"))) } else if (index === -1){ - console.log(chalk.greenBright(" Uncle was apart of an ancient secret society called 'The Order of the white lotus' Which he gained access to by saying 'white lotus'")) + console.log(chalk.greenBright(" Uncle was apart of an ancient secret society called 'The Order of the white lotus' Which he gained access to by saying 'white lotus'\n")) }else if(index === 2){ - console.log(chalk.greenBright("Aren't you the charmer. Having charisma gets you everything. You gained $100 ")) + console.log(chalk.greenBright("Aren't you the charmer. Having charisma gets you everything. You gained $100 \n\n")) } else if(index === 3){ - console.log(chalk.green("well, at least you'll have a job to return to if this investment plan doesn't work out for you. \n You lost $50 becuase...who works through lunch!")) + console.log(chalk.green("well, at least you'll have a job to return to if this investment plan doesn't work out for you. \n You lost $50 becuase...who works through lunch!\n\n")) }else { command = readline.prompt({ limit: ['Kiss up to superiors', 'Have Lunch', 'Charm coworker','Sleep', 'Work Through Lunch'], limitMessage: 'I can not accept $ . Please input another.' - }) - -} -optionArray(array) -} + }) + } + optionArray(array) + } midDay() + console.log('\n\n') } - - - - - - const endOfDay = ()=>{ - morning = 'The sun began to set, signalling the end of your workday ' + morning = 'The sun began to set, signalling the end of your workday. ' readline.keyInPause(morning.italic) - console.log(chalk.greenBright("I took the liberty to sell all your shares")) + console.log(chalk.greenBright("I took the liberty to sell all your shares\n")) watch = 'Debonaire checks her watch' readline.keyInPause(watch.italic); - console.log(chalk.greenBright(`It's 3:59am. Markets close at 4pm. \n After selling all your shares, your current balance is ${balance}`)) + console.log(chalk.greenBright(`It's 3:59am. Markets close at 4pm. \n After selling all your shares, your current balance is ${balance}\n\n`)) readline.keyInPause(chalk.greenBright('Phew, what a day')) - let feelings = readline.question(chalk.green("How did you do in the market today? Great or Okay:")) + let feelings = readline.question(chalk.green("How did you do in the market today? Great or Okay:\n")) feelings.toLocaleLowerCase if (feelings === 'great'){ console.log(chalk.greenBright('I knew you would be good at this')) } else if (feelings === 'okay'){ - console.log(chalk.greenBright("Just okay? Perhaps a joke will cheer you up.\n If you boil a funny bone it becomes a laughing stock. \n That's pretty humerus.")) - } else {console.log(chalk.greenBright(`*in robot voice* Does not compute .."${feelings}" hehe again with your humor`))} + console.log(chalk.greenBright("Just okay? Perhaps a joke will cheer you up.\n\n If you boil a funny bone it becomes a laughing stock. \n That's pretty humerus.")) + } else {console.log(chalk.greenBright(`*in robot voice* Does not compute .."${feelings}" hehe again with your humor \n\n`))} + readline.keyInPause(' ') console.log(chalk.greenBright(`You should head home and get some sleep. Tomorrow will be a new day of investing.`)) + readline.keyInPause(' ') + console.log('\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n') } - - - - -const bankAccount =()=>{ + const bankAccount =()=>{ if(balance <= 4000){ - console.log(chalk.bgBlueBright('Oh, sorry dear, looks like you ran out of money. Unfortunately You do not inherit any wealth')) + console.log(chalk.bgBlueBright('Oh, sorry dear, looks like you ran out of money. Unfortunately You do not inherit any wealth\n\n')) fun() } else if(balance >= 4001){ - console.log(chalk.bgMagentaBright("Cel-e-brate good times, C'mon!! Congratulations you made it to $4000. You get to live it up with the filthy rich")) + console.log(chalk.bgMagentaBright("Cel-e-brate good times, C'mon!! Congratulations you made it to $4000. You get to live it up with the filthy rich\n\n")) readline.keyInPause() - console.log(chalk.greenBright("Those who are filthy rich in knowledge, that is! \n Here is our family secret, An investment in knowledge pays the best interest.” -Benjamin Franklin- \n By playing my game you learned the first steps in a life long skill of investment. You know more now than you did before we met and therefor can build on what you've learned. Congratulations!! You are now wealthy in mind.")) + console.log(chalk.greenBright("Those who are filthy rich in knowledge, that is! \n Here is our family secret, An investment in knowledge pays the best interest.” -Benjamin Franklin- \n By playing my game you learned the first steps in a life long skill of investment.\n\n You know more now than you did before we met and therefor can build on what you've learned. Congratulations!! You are now wealthy in mind.\n\n\n")) readline.keyInPause() console.log(chalk.greenBright('That was so much fun that I want to play again')) fun() } return balance } - - - - - - const gameLoop = () => { while(true){ - let play = readline.keyInYN('Welcome to the game Prosperity. Would you like to play?') + let play = readline.keyInYN('Welcome to the game Prosperity. Would you like to play?') if(play === true){ startGame() - } else { + } else { quitGame() - } + } } } - - - - - - let fun = ()=> { - plaOrNay = 'Do you want to play?' + plaOrNay = 'Do you want to play? \n \n' nah = 'Thats too bad. I was looking forward to watching you play' answer = readline.keyInYN(plaOrNay.italic) if (answer === true){ @@ -523,11 +442,9 @@ let fun = ()=> { gameLoop() }else if (answer === false ){console.log(nah.italic) quitGame() - } else if (answer === ''){ - fun() - } + } else if (answer === ''){ + fun()} } - const play = () => { introduction() rulesInstructions() @@ -536,14 +453,14 @@ const play = () => { } -password = readline.question("Interested in a game of Pai Sho?", {hideEchoBack: true}); +password = readline.question("Interested in a game of Pai Sho? \n \n \n", {hideEchoBack: true}); password.toLocaleLowerCase if(password === 'white lotus'){ console.log(chalk.greenBright('Welcome to the Order of the White Lotus. \n You are a member of the elite. You automatically win the game!')) balance += 5000 bankAccount() -} else{ -gameLoop() + } else{ + gameLoop() } From 49b4d318266f4ea246aa0cfbcd7eda7ba3de4f97 Mon Sep 17 00:00:00 2001 From: Dequisa Date: Wed, 6 Jan 2021 08:44:27 -0500 Subject: [PATCH 08/11] modified game loop --- prosperity.js | 1 + 1 file changed, 1 insertion(+) diff --git a/prosperity.js b/prosperity.js index fe2f721..ea71ffe 100644 --- a/prosperity.js +++ b/prosperity.js @@ -439,6 +439,7 @@ let fun = ()=> { if (answer === true){ let yey = "Yey! Let's do it again!" console.log(yey.italic) + console.clear() gameLoop() }else if (answer === false ){console.log(nah.italic) quitGame() From 3be0760b8d978dd5bb5526d28b337ea79529880f Mon Sep 17 00:00:00 2001 From: Dequisa Hines <75263251+Dequisa@users.noreply.github.com> Date: Fri, 19 Mar 2021 13:54:12 -0400 Subject: [PATCH 09/11] Update README.md --- README.md | 69 +++++-------------------------------------------------- 1 file changed, 6 insertions(+), 63 deletions(-) diff --git a/README.md b/README.md index f0a4dd4..31b09cf 100644 --- a/README.md +++ b/README.md @@ -2,76 +2,19 @@ ## Introduction -This project will build on the skills that you've learned after your first couple weeks of programming in JavaScript! You will build a command line application that plays a text-based adventure game. +A text-based adventure game that tests your skills at Money Mangement. -### Examples +A fun easter egg is to Google search: Avatar The last Airbender. -Look [here](https://classicreload.com/zork-i.html) and [here](http://www.bbc.co.uk/programmes/articles/1g84m0sXpnNCv84GpN2PLZG/the-hitchhikers-guide-to-the-galaxy-game-30th-anniversary-edition) for a couple examples of the genre. Be creative! -A fun Google easter egg is to Google search `text adventure`. From the results page right click on the page and inspect the console. You should find a game by Google. -### Reading input +## Player Story -This project imports an npm module called `readline-sync` that allows the user to enter input to the terminal. The line at the top: `const readline = require('readline-sync')` gives you access to this functionality +### As a player, You can begin a game -Use the following line to get user input: +### As a player, You can make decisions during the game -```js -let yourVariableHere = readline.question("Enter your name: ") -``` +### As a player, You can restart a game -## Setup Instructions -1. Fork this repo -1. Clone the forked repo to your machine -1. `cd` to the cloned folder and type `npm install` in the terminal. -1. Create a file called `.gitignore`. -1. Inside of .gitignore write `node_modules/` - -## Submission Instructions - -1. Complete the project -1. Commit and Push your changes to your fork -1. Submit a Pull Request back to the assignment repo -1. Paste a link to your Pull Request (not your fork!) on Canvas and submit - - -## User Stories - -### As a user, I want to be able to begin a game - -#### Acceptance criteria - -- Cloning your project, running `npm install` and `YOURPROJECTNAMEHERE.js` will start a game -- No errors are logged to the console -- The game displays initial instructions about how to play and a welcome message - -### As a user, I want to be able to make decisions during the game - -#### Acceptance criteria - -- Invalid entires are re-prompted -- There are at least 10 opportunities to make a decision -- The user must enter a string to make a decision -- The user must enter a number to make a decision - -### As a user, I want to be able to restart a game - -#### Acceptance criteria - -- The user is prompted to restart the game and can enter yes or no -- Entering no causes the program to terminate -- Entering yes begins the game again, wiping the previous state - -## Trello Board - -Replace the link below with the link to your Trello project: - -[Trello](https://trello.com/b/vbKtMOKj/text-based-adventure-project-plan) - - -## Rubric - -![outcomesRubric.png](./outcomesRubric.png) -![acRubric.png](./acRubric.png) From 4bb1ce97d3ee0f88979c8adc4abc1255db0f2619 Mon Sep 17 00:00:00 2001 From: Dequisa Hines <75263251+Dequisa@users.noreply.github.com> Date: Fri, 19 Mar 2021 13:54:55 -0400 Subject: [PATCH 10/11] Change font size --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 31b09cf..8c22270 100644 --- a/README.md +++ b/README.md @@ -10,11 +10,11 @@ A fun easter egg is to Google search: Avatar The last Airbender. ## Player Story -### As a player, You can begin a game +# As a player, You can begin a game -### As a player, You can make decisions during the game +# As a player, You can make decisions during the game -### As a player, You can restart a game +# As a player, You can restart a game From 620ad5c192875e6ae3e8de0a66781caf17582885 Mon Sep 17 00:00:00 2001 From: Dequisa Hines <75263251+Dequisa@users.noreply.github.com> Date: Fri, 19 Mar 2021 13:55:26 -0400 Subject: [PATCH 11/11] Update README.md --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 8c22270..bc9be67 100644 --- a/README.md +++ b/README.md @@ -8,13 +8,13 @@ A fun easter egg is to Google search: Avatar The last Airbender. -## Player Story +# Player Story -# As a player, You can begin a game + As a player, You can begin a game -# As a player, You can make decisions during the game + As a player, You can make decisions during the game -# As a player, You can restart a game + As a player, You can restart a game