Skip to content

Instantly share code, notes, and snippets.

@woodcockjosh
Last active February 17, 2022 08:15
Show Gist options
  • Save woodcockjosh/99add0c599f7165cb882fc0ac4d8d017 to your computer and use it in GitHub Desktop.
Save woodcockjosh/99add0c599f7165cb882fc0ac4d8d017 to your computer and use it in GitHub Desktop.
#!/usr/bin/env node
const readline = require('readline');
const rl = readline.createInterface({input: process.stdin, output: process.stdout});
const prompt = (query) => new Promise((resolve) => rl.question(query, resolve));
//usage inside aync function do not need closure demo only*
(async () => {
try {
await prompt(`This program will help you know how effective the love you show your partner is. Press enter to continue`)
const firstLoveLanguage = await prompt(`Whats your partners first highest love language?
1=acts of service
2=physical touch
3=quality time
4=gifts
5=words of affirmation
`
)
const secondLoveLanguage = await prompt(`Whats your partners 2nd highest love language?
1=acts of service
2=physical touch
3=quality time
4=gifts
5=words of affirmation
`
)
const loveShownLanguage = await prompt(`Which category does the love you are showing primarily fall in?
1=acts of service
2=physical touch
3=quality time
4=gifts
5=words of affirmation
`
)
const tookInitiative = await prompt(`Did you initiate / come up with the idea for showing this love or did your partner ask you to do it?
1=It was my idea
2=They asked me to do it
`
)
const actuallyDidIt = await prompt(`Did you actually do it?
1=Yes
2=No
`
)
const numberOfTimesDoneBefore = await prompt(`How many times have you done this exact thing in exactly the same way before?`)
let effectiveMultiplier = .001
if(loveShownLanguage === firstLoveLanguage){
effectiveMultiplier = 1;
}
if(loveShownLanguage === secondLoveLanguage){
effectiveMultiplier = .7;
}
let valueMultiplier = .01;
if(tookInitiative == 1){
valueMultiplier = 1;
}
if(tookInitiative == 1 && actuallyDidIt == 2){
console.log(`Your partner frequently gets angry and upset about silly things because deep inside they feel they are not valued`)
rl.close();
return;
}
if(tookInitiative == 2 && actuallyDidIt == 2){
console.log(`Your partner feels they are not worth being loved at all`)
rl.close();
return;
}
const score = effectiveMultiplier * valueMultiplier - .01 * numberOfTimesDoneBefore;
if(score >= 1){
console.log(`Your partner is absolutely thrilled by the love you show them. They feel valued deep inside`)
} else if(score >= .5){
console.log(`Your partner is very happy about the love you show them. They feel valued because of your love`)
}else if(score >= 0.01){
console.log(`Your partner is barely surviving on your love and frequently gets angry and upset about silly things because deep inside they feel they are barely valued`)
}else {
console.log(`Your partner is desperate to feel valued and might appreciate what you do deep inside they do not feel like they are not really valued`)
}
rl.close()
} catch (e) {
console.errror("unable to prompt", e)
}
})()
rl.on('close', () => process.exit(0))
@woodcockjosh
Copy link
Author

To use download the file then run with node love.js on your command line

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment