Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <time.h>
- // define the kind of structure for the puzzle piece.
- typedef struct {
- int id;
- char shape[20];
- } PuzzlePiece;
- // define the enum for achievements.
- typedef enum {
- ACHIEVEMENT_LEVEL1,
- ACHIEVEMENT_LEVEL2,
- ACHIEVEMENT_LEVEL3
- } Achievement;
- // function for solving a puzzle piece.
- void solvePuzzlePiece(PuzzlePiece piece, bool isConnected) {
- printf("Solving piece %d with shape: %s\n", piece.id, piece.shape);
- if (isConnected) {
- printf("Piece %d is connected to the puzzle!\n", piece.id);
- } else {
- printf("Piece %d is not connected yet.\n", piece.id);
- }
- }
- // function for tracking achievements.
- void trackAchievement(Achievement achievement) {
- switch (achievement) {
- case ACHIEVEMENT_LEVEL1:
- printf("Unlocked Level 1 achievement!\n");
- break;
- case ACHIEVEMENT_LEVEL2:
- printf("Unlocked Level 2 achievement!\n");
- break;
- case ACHIEVEMENT_LEVEL3:
- printf("Unlocked Level 3 achievement!\n");
- break;
- default:
- printf("Unknown achievement!\n");
- }
- }
- // function to unlock an achievement.
- void unlockAchievement(const char* achievementName) {
- if (!unlockedAchievements[achievement]) {
- unlockedAchievements[achievement] = true;
- printf("Unlocked achievement: ");
- switch (achievement) {
- case ACHIEVEMENT_LEVEL1:
- printf("Level 1\n");
- break;
- case ACHIEVEMENT_LEVEL2:
- printf("Level 2\n");
- break;
- case ACHIEVEMENT_LEVEL3:
- printf("Level 3\n");
- break;
- default:
- printf("Unknown achievement!\n");
- }
- } else {
- printf("Achievement already unlocked!\n");
- }
- }
- // function for rolling a dice.
- int rollDice() {
- srand(time(NULL)); // seeding a random number generator.
- return rand() % 6 + 1; // Roll a 6-sided dice
- }
- // Bible verses (KJV)
- const char* bibleVerses[] = {
- "For God so loved the world, that he gave his only begotten Son, that whosoever believeth in him should not perish, but have everlasting life. - John 3:16",
- "The Lord is my shepherd; I shall not want. - Psalm 23:1",
- "In the Begining was the word, and the word was with God, and the word was God. - John 1:1".
- };
- // function that generates a random Bible Verse.
- const char* getRandomBibleVerse() {
- srand(time(NULL)); // seeding the random number generator.
- int numVerses = sizeof(bibleVerses) / sizeof(bibleVerses[0]);
- int randomIndex = rand() % numVerses;
- return bibleVerses[randomIndex];
- }
- // main function:
- int main() {
- PuzzlePiece piece1 = {1, "Corner"};
- solvePuzzlePiece(piece1);
- trackAchievement(ACHIEVEMENT_LEVEL2);
- unlockAchievement("Master of Puzzles");
- printf("Rolled: %d\n", rollDice());
- printf("Random Bible verse: %s\n", getRandomBibleVerse());
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement