Skip to content
Closed
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
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
85 changes: 85 additions & 0 deletions games/chill/ice_cream_generator/game.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
import random

AUTHOR = "Divija2612"

def run():
print(f"🍦 Welcome to Ice Cream Machine by {AUTHOR}!")
print("Fulfill customer orders by choosing the correct ingredients.\n")

ingredients = [
"Chocolate",
"Vanilla",
"Banana",
"Cookie",
"Strawberry",
"Caramel",
"Mint",
"Mango"
]

orders = {
"I'm craving a tropical fruit combo.": ["Banana", "Mango"],
"Give me the classic chocolate and vanilla flavor.": ["Chocolate", "Vanilla"],
"I want something cool with mint and vanilla.": ["Mint", "Vanilla"],
"Can I get a cookie caramel dessert?": ["Cookie", "Caramel"],
"I'd love a strawberry vanilla favorite.": ["Strawberry", "Vanilla"],
"Make me a rich chocolate cookie delight.": ["Chocolate", "Cookie"],
"I'm in the mood for a fruity strawberry mango blend.": ["Mango", "Strawberry"],
"Give me a refreshing mint chocolate flavor.": ["Chocolate", "Mint"]
}

score = 0
rounds_played = 0

while True:
rounds_played += 1

description, correct_ingredients = random.choice(
list(orders.items())
)

print(f"\n--- Round {rounds_played} ---")
print("\n🧑 Customer says:")
print(f'"{description}!"')

print("\nAvailable ingredients:")
for ingredient in ingredients:
print(f"- {ingredient}")

choice1 = input("\nChoose ingredient 1: ").strip().title()
choice2 = input("Choose ingredient 2: ").strip().title()

player_choice = {choice1, choice2}
correct_choice = set(correct_ingredients)

if player_choice == correct_choice:
print("✅ Perfect order! Customer is happy!")
score += 1
else:
print("❌ That's not what the customer wanted.")
print(
f"Correct ingredients were: "
f"{correct_ingredients[0]} + {correct_ingredients[1]}"
)

print(f"⭐ Score: {score}/{rounds_played}")

play_again = input(
"\nWould you like to serve another customer? (y/n): "
).strip().lower()

if play_again != "y":
break

print("\n🏆 Game Over!")
print(f"Final Score: {score}/{rounds_played}")

if rounds_played > 0:
success_rate = (score / rounds_played) * 100

if success_rate == 100:
print("🌟 Master Ice Cream Maker!")
elif success_rate >= 60:
print("😄 Great job serving customers!")
else:
print("🍦 Keep practicing your flavor combinations!")
Binary file not shown.
Binary file added games/chill/timer/__pycache__/game.cpython-313.pyc
Binary file not shown.
Binary file not shown.
107 changes: 107 additions & 0 deletions games/logic/glitch_machine/game.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
"""
Glitch Machine
A corrupted word flashes on screen, replacing some of its letters with
random symbols (e.g. TERMINAL -> T#RM!N@L). The player must type the
original, uncorrupted word before the glitch overtakes the system.

Play multiple rounds and rack up points - score increases with word
length and decreases the longer you take to answer.
"""

import random
import string
import time

WORDS = [
"TERMINAL", "PYTHON", "KEYBOARD", "COMPILER", "FUNCTION",
"VARIABLE", "ALGORITHM", "DEBUGGER", "ARCADE", "GLITCH",
"PROGRAM", "CONSOLE", "SCRIPT", "BINARY", "NETWORK",
"PROCESS", "MACHINE", "SIGNAL", "MEMORY", "MODULE",
]

GLITCH_SYMBOLS = "#!@$%&*?^~"

ROUNDS_PER_GAME = 5


def corrupt_word(word, difficulty=0.4):
"""Replace a portion of the word's letters with random glitch symbols.

At least one letter is always corrupted so the puzzle is never trivial,
and at least one letter is always left visible as a hint.
"""
word_chars = list(word)
length = len(word_chars)

num_to_corrupt = max(1, round(length * difficulty))
num_to_corrupt = min(num_to_corrupt, length - 1) if length > 1 else 0

indices = list(range(length))
random.shuffle(indices)
corrupt_indices = set(indices[:num_to_corrupt])

corrupted_chars = [
random.choice(GLITCH_SYMBOLS) if i in corrupt_indices else ch
for i, ch in enumerate(word_chars)
]
return "".join(corrupted_chars)


def print_banner():
print("=" * 40)
print(" G L I T C H M A C H I N E")
print("=" * 40)
print("A corrupted string flickers across the terminal.")
print("Type the original word before the system glitches out!")
print("-" * 40)


def play_round(round_num, used_words):
available = [w for w in WORDS if w not in used_words]
if not available:
available = WORDS
used_words.clear()

word = random.choice(available)
used_words.add(word)

corrupted = corrupt_word(word)

print(f"\nRound {round_num}/{ROUNDS_PER_GAME}")
print(f"Corrupted signal: {corrupted}")

start_time = time.time()
guess = input("Decode it > ").strip().upper()
elapsed = time.time() - start_time

if guess == word:
base_points = len(word) * 10
time_penalty = int(elapsed) * 2
points = max(5, base_points - time_penalty)
print(f"Signal restored! It was {word}. (+{points} points)")
return points
else:
print(f"Decryption failed. The word was {word}.")
return 0


def run():
print_banner()

score = 0
used_words = set()

for round_num in range(1, ROUNDS_PER_GAME + 1):
score += play_round(round_num, used_words)
print(f"Current score: {score}")

print("\n" + "=" * 40)
print(f"GAME OVER - Final Score: {score}")
if score >= 200:
print("Signal integrity: EXCELLENT")
elif score >= 100:
print("Signal integrity: STABLE")
else:
print("Signal integrity: CRITICAL")
print("=" * 40)

Binary file added games/logic/quiz/__pycache__/game.cpython-313.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading