Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance readability in README file: Improve Sentence Structure for Clarity #1339

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)_

Expand All @@ -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.

Expand Down
62 changes: 62 additions & 0 deletions Snack Extortion/Snack.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

// 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;
}