From e6a9643b2aee2479990b51bf9403498722c4625e Mon Sep 17 00:00:00 2001 From: Joel Jolly <128782382+withinJoel@users.noreply.github.com> Date: Sat, 1 Jun 2024 08:53:28 +0530 Subject: [PATCH] Update --- Documentation/Syntax.md | 2 ++ Modules/Commands.js | 6 +++++ Modules/Modules.js | 2 ++ Modules/Packages/BFF Test.js | 29 +++++++++++++++++++++++ Modules/Packages/Compatibility Test.js | 32 ++++++++++++++++++++++++++ 5 files changed, 71 insertions(+) create mode 100644 Modules/Packages/BFF Test.js create mode 100644 Modules/Packages/Compatibility Test.js diff --git a/Documentation/Syntax.md b/Documentation/Syntax.md index 6a24b94..845dffa 100644 --- a/Documentation/Syntax.md +++ b/Documentation/Syntax.md @@ -264,6 +264,8 @@ * `truthordare` - To play the truth or dare game. * `headsortails` - To return heads or tails. * `rolldice` - To roll a dice. +* `compatibilitytest:` - To take a compatiablity test with you partner. example: `compatibilitytest:joel,sana` +* `bfftest:` - To play the truth or dare game. example: `bfftest:joel,james` # Text * `open:txt:` - To open a text file. example: `open:txt:hello.txt` (Note only txts that are present in the C:/Program files(x86)/Elsa/Bin/Documents/) diff --git a/Modules/Commands.js b/Modules/Commands.js index a2566c7..dc88f8b 100644 --- a/Modules/Commands.js +++ b/Modules/Commands.js @@ -246,6 +246,12 @@ function runCmd(command, inMemory, fromInput) { } else if (commandName.includes("mash:")) { let data = commandName.trim().replace(/^mash:\s*/i, ''); mash(data); + } else if (commandName.includes("bfftest:")) { + let data = commandName.trim().replace(/^bfftest:\s*/i, ''); + bffTest(data); + } else if (commandName.includes("compatibilitytest:")) { + let data = commandName.trim().replace(/^compatibilitytest:\s*/i, ''); + compatibilityTest(data); } else if (commandName.includes("flames:")) { let data = commandName.trim().replace(/^flames:\s*/i, ''); flames(data); diff --git a/Modules/Modules.js b/Modules/Modules.js index 217106a..9eda20a 100644 --- a/Modules/Modules.js +++ b/Modules/Modules.js @@ -55,6 +55,8 @@ loadScript('Modules/Packages/Detect Nudity.js'); loadScript('Modules/Packages/Encoding Decoding.js'); loadScript('Modules/Packages/Flames.js'); loadScript('Modules/Packages/Mash.js'); +loadScript('Modules/Packages/compatibility Test.js'); +loadScript('Modules/Packages/BFF Test.js'); loadScript('Modules/Packages/Games.js'); loadScript('Modules/Packages/Guess.js'); loadScript('Modules/Packages/Love Calculator.js'); diff --git a/Modules/Packages/BFF Test.js b/Modules/Packages/BFF Test.js new file mode 100644 index 0000000..e04f628 --- /dev/null +++ b/Modules/Packages/BFF Test.js @@ -0,0 +1,29 @@ +function bffTest(input) { + const [name1, name2] = input.split(','); + const cleanName1 = name1.replace(/\s+/g, '').toLowerCase(); + const cleanName2 = name2.replace(/\s+/g, '').toLowerCase(); + + let commonLetters = 0; + const letters = {}; + + for (let i = 0; i < cleanName1.length; i++) { + letters[cleanName1[i]] = true; + } + + for (let i = 0; i < cleanName2.length; i++) { + if (letters[cleanName2[i]]) { + commonLetters++; + } + } + + const capitalizeFirstLetter = (string) => string.charAt(0).toUpperCase() + string.slice(1); + + const formattedName1 = capitalizeFirstLetter(name1.trim()); + const formattedName2 = capitalizeFirstLetter(name2.trim()); + + if (commonLetters > 3) { + echo (`${formattedName1} and ${formattedName2} are BFFs!`); + } else { + echo (`${formattedName1} and ${formattedName2} are not BFFs.`); + } +} \ No newline at end of file diff --git a/Modules/Packages/Compatibility Test.js b/Modules/Packages/Compatibility Test.js new file mode 100644 index 0000000..b95cad9 --- /dev/null +++ b/Modules/Packages/Compatibility Test.js @@ -0,0 +1,32 @@ +function compatibilityTest(input) { + const [name1, name2] = input.split(','); + + const cleanName1 = name1.replace(/\s+/g, '').toLowerCase(); + const cleanName2 = name2.replace(/\s+/g, '').toLowerCase(); + + let score = 0; + for (let i = 0; i < cleanName1.length; i++) { + score += cleanName1.charCodeAt(i); + } + for (let i = 0; i < cleanName2.length; i++) { + score += cleanName2.charCodeAt(i); + } + + score = score % 100; // Ensure score is between 0 and 100 + + let compatibility; + if (score > 75) { + compatibility = 'High'; + } else if (score > 50) { + compatibility = 'Medium'; + } else { + compatibility = 'Low'; + } + + const capitalizeFirstLetter = (string) => string.charAt(0).toUpperCase() + string.slice(1); + + const formattedName1 = capitalizeFirstLetter(name1.trim()); + const formattedName2 = capitalizeFirstLetter(name2.trim()); + + echo(`${formattedName1} and ${formattedName2} have ${compatibility} compatibility with a score of ${score}`); +} \ No newline at end of file