Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
withinJoel committed Jun 1, 2024
1 parent 0bb9d15 commit e6a9643
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Documentation/Syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/)
Expand Down
6 changes: 6 additions & 0 deletions Modules/Commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions Modules/Modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
29 changes: 29 additions & 0 deletions Modules/Packages/BFF Test.js
Original file line number Diff line number Diff line change
@@ -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.`);
}
}
32 changes: 32 additions & 0 deletions Modules/Packages/Compatibility Test.js
Original file line number Diff line number Diff line change
@@ -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}`);
}

0 comments on commit e6a9643

Please sign in to comment.