From d8010bac5667b67464687efb6313ea09125d0d5e Mon Sep 17 00:00:00 2001 From: "MR.NOBODY" <126796695+TacticalReader@users.noreply.github.com> Date: Mon, 22 Sep 2025 17:59:52 +0530 Subject: [PATCH 01/15] Update money_memory_game.py --- money_memory_game.py | 174 ++++++++++++++++++++++++++++--------------- 1 file changed, 116 insertions(+), 58 deletions(-) diff --git a/money_memory_game.py b/money_memory_game.py index 54fa31924..1ed48c501 100644 --- a/money_memory_game.py +++ b/money_memory_game.py @@ -2,61 +2,119 @@ import tkinter as tk from tkinter import messagebox -# Initialize the main window -window = tk.Tk() -window.title("Money Memory Game") -window.geometry("400x400") - -# List of card values (numbers for simplicity) -cards = list(range(1, 9)) * 2 -random.shuffle(cards) - -# Variables to track the game state -first_card = None -first_button = None -matches_found = 0 -attempts = 0 - -# Function to check for matches between two selected cards -def check_match(btn, idx): - global first_card, first_button, matches_found, attempts - - # Disable the button and show the card value - btn.config(text=str(cards[idx]), state="disabled") - - # First card selection - if first_card is None: - first_card = cards[idx] - first_button = btn - else: - # Second card selection - if first_card == cards[idx]: # If cards match - matches_found += 1 - first_card = None - first_button = None - - # Check if all matches are found - if matches_found == 8: - messagebox.showinfo("Game Over", f"Congratulations! You won in {attempts} attempts!") - else: # If cards don't match - window.after(1000, hide_cards, btn, first_button) - first_card = None - first_button = None - - attempts += 1 - -# Function to hide cards if they don't match -def hide_cards(btn1, btn2): - btn1.config(text="?", state="normal") - btn2.config(text="?", state="normal") - -# Create the buttons for the game board (4x4 grid) -buttons = [] -for i in range(16): - btn = tk.Button(window, text="?", width=10, height=3, - command=lambda i=i: check_match(buttons[i], i)) - btn.grid(row=i // 4, column=i % 4) - buttons.append(btn) - -# Start the game -window.mainloop() +# ------------------------ +# Enhanced Money Memory Game +# ------------------------ + +class MemoryGame: + def __init__(self, master): + self.master = master + master.title("Money Memory Game") + master.geometry("460x500") + master.resizable(False, False) + + self.score = 0 + self.attempts = 0 + self.matches_found = 0 + self.first_card_idx = None + self.locked = False + + # Main frame for padding and flexibility + self.frame = tk.Frame(master, pady=20) + self.frame.pack() + + # Status bar + self.status = tk.Label(master, text='', font=('Arial', 14), fg='green') + self.status.pack(pady=10) + self.update_status() + + # Restart button + restart_btn = tk.Button(master, text="Restart", command=self.restart_game, bg='#ffd700', font=('Arial', 12)) + restart_btn.pack(pady=5) + + # Game board initialization + self.create_board() + + def create_board(self): + self.cards = list(range(1, 9)) * 2 # Money values + random.shuffle(self.cards) + self.button_refs = [] + + # Draw grid + for widget in self.frame.winfo_children(): + widget.destroy() + for i in range(16): + btn = tk.Button(self.frame, text="?", font=('Arial', 18, 'bold'), width=6, height=3, + bg="#336699", fg="white", relief="raised", + command=lambda i=i: self.reveal_card(i)) + btn.grid(row=i // 4, column=i % 4, padx=5, pady=5) + self.button_refs.append(btn) + + def update_status(self): + accuracy = f"{(self.matches_found / self.attempts * 100):.1f}%" if self.attempts else "0%" + self.status.config(text=f"Attempts: {self.attempts} | Matches: {self.matches_found}/8 | Accuracy: {accuracy}") + + def reveal_card(self, idx): + if self.locked or self.button_refs[idx]["state"] == "disabled": + return + + btn = self.button_refs[idx] + btn.config(text=f"₹{self.cards[idx]}", bg="#9ACD32", fg="black", relief="sunken") + btn.update() + + if self.first_card_idx is None: + self.first_card_idx = idx + else: + self.locked = True + self.attempts += 1 + first_btn = self.button_refs[self.first_card_idx] + second_btn = btn + if self.cards[self.first_card_idx] == self.cards[idx]: + # Match + self.matches_found += 1 + first_btn.config(bg="#ffd700", fg="darkgreen", relief="flat") + second_btn.config(bg="#ffd700", fg="darkgreen", relief="flat") + first_btn.config(state="disabled") + second_btn.config(state="disabled") + self.master.after(400, self.after_match) + else: + # No match, flip back after delay + self.master.after(1100, self.hide_cards, self.first_card_idx, idx) + self.first_card_idx = None + self.update_status() + + def hide_cards(self, idx1, idx2): + for idx in [idx1, idx2]: + self.button_refs[idx].config(text="?", bg="#336699", fg="white", relief="raised", state="normal") + self.locked = False + + def after_match(self): + self.locked = False + if self.matches_found == 8: + self.update_status() + messagebox.showinfo("🎉 Game Over", f"Congratulations! You found all matches in {self.attempts} attempts!") + self.play_sound_win() + + def restart_game(self): + self.score = 0 + self.attempts = 0 + self.matches_found = 0 + self.first_card_idx = None + self.locked = False + self.button_refs = [] + self.create_board() + self.update_status() + + def play_sound_win(self): + # Simple sound feedback for successful completion + try: + import winsound + winsound.Beep(600, 250) + winsound.Beep(800, 450) + except Exception: + pass # skip if unsupported (Linux/macOS or no winsound) + +if __name__ == "__main__": + root = tk.Tk() + game = MemoryGame(root) + root.mainloop() From a5d9c60b93a722010f06b7cce55a4b09b577bbff Mon Sep 17 00:00:00 2001 From: "MR.NOBODY" <126796695+TacticalReader@users.noreply.github.com> Date: Thu, 25 Sep 2025 16:43:49 +0530 Subject: [PATCH 02/15] Update money_memory_game.py --- money_memory_game.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/money_memory_game.py b/money_memory_game.py index 1ed48c501..bcf514d32 100644 --- a/money_memory_game.py +++ b/money_memory_game.py @@ -108,11 +108,14 @@ def restart_game(self): def play_sound_win(self): # Simple sound feedback for successful completion try: - import winsound - winsound.Beep(600, 250) - winsound.Beep(800, 450) - except Exception: - pass # skip if unsupported (Linux/macOS or no winsound) + try: + import winsound + winsound.Beep(600, 250) + winsound.Beep(800, 450) +except (ImportError, RuntimeError, AttributeError): + # winsound not available, skip sound + pass + if __name__ == "__main__": root = tk.Tk() From e91f30280a346d8ed02c718a84e5de947e0656d4 Mon Sep 17 00:00:00 2001 From: "MR.NOBODY" <126796695+TacticalReader@users.noreply.github.com> Date: Fri, 26 Sep 2025 15:27:30 +0530 Subject: [PATCH 03/15] Update index.html add fontawesome icons to enhance user experiences --- Basic Contact Form/index.html | 86 +++++++++++++++++++++-------------- 1 file changed, 53 insertions(+), 33 deletions(-) diff --git a/Basic Contact Form/index.html b/Basic Contact Form/index.html index c8e85a124..09bf4de4e 100644 --- a/Basic Contact Form/index.html +++ b/Basic Contact Form/index.html @@ -1,40 +1,60 @@ -
- - - - -