From cbaa9f8fef7fa0c595a72d384ca9ae176e9bef4e Mon Sep 17 00:00:00 2001 From: Amyy Stephanie Alex-Okenwa <75863610+amyyalex@users.noreply.github.com> Date: Thu, 8 Aug 2024 22:27:17 +0100 Subject: [PATCH 1/2] Enhance readability in README file: Improve Sentence Structure for Clarity Removed extra space between words and added fluency and punctuation to a sentence from "After adding your funny algorithm share with us making a pull request so people can see how amazing is your algorithm." to "After adding your funny algorithm, share it with us by making a pull request so others can see how amazing your algorithm is" --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4a8c008d..78d9bdba 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ ## Funny Algorithms -_A repository with a bunch of funny algorithms, beginners friendly :sparkles:_ +_A repository with a bunch of funny algorithms, beginners friendly:sparkles:_ _Don't forget to read our [Contributing Guide](https://github.com/ReciHub/FunnyAlgorithms/blob/master/CONTRIBUTING.md) and our [Code of Conduct](https://github.com/ReciHub/FunnyAlgorithms/blob/master/CODE_OF_CONDUCT.md)_ @@ -29,7 +29,8 @@ It is always fun to check new algorithms or see how the same algorithms can be r ## Submit a pull request -After adding your funny algorithm share with us making a [pull request](https://github.com/ReciHub/FunnyAlgorithms/blob/master/CONTRIBUTING.md#submitting-a-pull-request) so people can see how amazing is your algorithm. +After adding your funny algorithm, share it with us by making a [pull request](https://github.com/ReciHub/FunnyAlgorithms/blob/master/CONTRIBUTING.md#submitting-a-pull-request) so others can see how amazing your algorithm is. + - To submit a pull request, write a `Title` , `Leave a Comment` and click the `Create Pull Request` button. That's all. - Make sure you add a good description in what you are adding and that each algorithm has a commit. From fbee59c459c9c8d51ceecea90a7763079184ba28 Mon Sep 17 00:00:00 2001 From: Amyy Stephanie Alex-Okenwa <75863610+amyyalex@users.noreply.github.com> Date: Sun, 18 Aug 2024 01:41:27 +0100 Subject: [PATCH 2/2] Add Snack Extortion algorithm in C Language --- Snack Extortion/Snack.c | 62 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 Snack Extortion/Snack.c diff --git a/Snack Extortion/Snack.c b/Snack Extortion/Snack.c new file mode 100644 index 00000000..acc68f91 --- /dev/null +++ b/Snack Extortion/Snack.c @@ -0,0 +1,62 @@ +#include +#include +#include + +// Simulating energy level +int EnergyLevel = 20; + +// Function to simulate waiting (procrastination) +void wait(int minutes) { + printf("Waiting for %d minutes...\n", minutes); + EnergyLevel -= minutes; // Procrastination drains energy +} + +// Function to find the nearest sibling (younger sibling) +int findNearestSibling() { + // Randomly decide if a younger sibling is nearby + srand(time(NULL)); + int found = rand() % 2; + return found; +} + +// Function to attempt a bribe +void attemptBribe(int sibling, const char* briberyItem) { + if (sibling) { + printf("Bribing younger sibling with %s...\n", briberyItem); + } else { + printf("No sibling found to bribe. Looks like you're out of luck!\n"); + } +} + +// Function to simulate snack acquisition +void getSnackWithoutMoving() { + // Step 1: Summon a sibling + int sibling = findNearestSibling(); + if (!sibling) { + printf("No snack for you. Time to starve.\n"); + return; + } + + // Step 2: Bribe the sibling + const char* briberyItems[] = {"Candy", "Allowance", "Extra TV Time", "A Compliment"}; + int randomIndex = rand() % 4; + attemptBribe(sibling, briberyItems[randomIndex]); + + // Step 3: Wait for snack delivery + printf("Waiting for snack delivery...\n"); + wait(5); + + // Randomly decide if the sibling returns with a snack + int snackReceived = rand() % 2; + if (!snackReceived) { + printf("You've lost a sibling. Maybe next time be nicer.\n"); + } else { + printf("Success! You've acquired a snack without moving.\n"); + printf("Snack satisfaction increased by 100%%!\n"); + } +} + +int main() { + getSnackWithoutMoving(); + return 0; +}