Compare commits

...

5 Commits

Author SHA1 Message Date
mdecker6
b8836fb5f3 I finished!!!!!!! 2025-11-30 18:06:11 -05:00
mdecker6
653bf62cce trying 2025-11-20 09:42:49 -05:00
mdecker6
43b056c7b0 I change how the game would work 2025-11-20 09:40:41 -05:00
mdecker6
a3de312804 I submitted my proposal.md 2025-11-19 09:16:32 -05:00
mdecker6
468f179eb3 I will work by myself
The game is about a Player trying to figure out a word. The word is (coding). I will use a hint.
Only the next letter in the word is required, and previous letters are shown as progress.
Completing the full word increases the score by 1.
Pressing a wrong key resets the progress, and you have to start over again.
Game ends when the player completes the word.

The game uses code from retro:
 -game class: class MysteryCodingGame(Game)
 -agent class
 -state
 -agents
 -game loop

1. Hidden word mechanic: use:  (self.word = "coding")
    -The game secretly stores the word: Coding
    -The player must figure out the word based on a hint
    -The game never shows the entire word—only progress
2. Sequential progression mechanic
    -The player must press the letters in order: c-o-d-i-n-g
    -The game keeps track of where the player is
    -If the player presses the correct next letter, they move forward in the word
    -If palyer types wrong letter, the entire word resets. The player restarts at the first letter,Then displayed progress updates
3. Visual progress mechanic
    -Before each keypress, the game shows: _ _ _ _ _ _
    -as the player gets letters right, it shows progrees in the word: c o _ _ _ _
4. Scoring mechanic
    -Each time the player finishes the entire word "coding": Score goes up by 1, then progress resets
    1. Build the Retro Game Structure
    2. Create the Core Gameplay Mechanics
    3. Add Game Completion, Scoring
2025-11-19 09:14:21 -05:00
2 changed files with 140 additions and 0 deletions

View File

@@ -0,0 +1,94 @@
from retro.game import Game
from retro.agent import Agent
import time
import os
import sys
def clear_terminal():
if os.name == "nt":
os.system("cls")
else:
sys.stdout.write("\033c")
sys.stdout.flush()
class RandomKeyAgent(Agent):
def act(self, state):
return None
class MysteryCodingLadderGame(Game):
def __init__(self, agents, state):
super().__init__(agents=agents, state=state)
self.word = "coding"
self.index = 0
self.position = 0
self.ladder_height = len(self.word)
self.running = True
def draw_ladder(self):
"""Draws the ladder with the orb at the current height."""
clear_terminal()
print("Hint: What this class is about\n")
for i in range(self.ladder_height - 1, -1, -1):
if i == self.position:
print(" | ● |")
else:
print(" | |")
print("\nSpell the mystery word one letter at a time.")
print("The circle climbs the ladder with each correct letter!\n")
progress = []
for i in range(len(self.word)):
if i < self.index:
progress.append(self.word[i].upper())
else:
progress.append("_")
print("Word progress:", " ".join(progress))
print(f"Next letter to guess: {self.word[self.index].upper()}\n")
def update(self, action):
"""Check the player's typed letter."""
if not action:
return
guess = action.lower()[0]
correct = self.word[self.index]
if guess == correct:
print("Correct letter! The orb climbs!")
self.index += 1
self.position += 1
else:
print("Incorrect! The ladder resets!")
self.index = 0
self.position = 0
if self.position >= self.ladder_height:
self.running = False
time.sleep(0.5)
def run(self):
print("Game Start!")
while self.running:
self.draw_ladder()
letter = input("Your letter: ")
self.update(letter)
clear_terminal()
print(" | ● | TOP OF LADDER!")
print("\n🎉 You spelled CODING correctly! Great job Buffalo Bull! 🎉\n")
agents = [RandomKeyAgent()]
state = {}
if __name__ == "__main__":
game = MysteryCodingLadderGame(agents=agents, state=state)
game.run()

46
proposal.md Normal file
View File

@@ -0,0 +1,46 @@
# game proposal
# team
I will work by myself
# Game overview
The game is about a Player trying to figure out a word. The word is (coding). I will use a hint.
Only the next letter in the word is required, and previous letters are shown as progress.
Completing the full word increases the score by 1.
Pressing a wrong key resets the progress, and you have to start over again.
Game ends when the player completes the word.
***revised 11/20/25
I want to add a ladder where an orb goes up everytime you get a right word
The word CODING has 6 letters → the ladder has 6 levels.
for every correct letter the index increases and the orb moves up one step
The progress display reveals that letter
If plaher enters a wrong letter, the ladder resets, then the orb then falls to the bottom
When the orb reaches the top you spelled the entire word correctly and win.
The game uses code from retro:
-game class
-agent class
-state
-agents
-game loop
# Core mechanics
1. Hidden word mechanic: use: (self.word = "coding")
-The game secretly stores the word: Coding
-The player must figure out the word based on a hint
-The game never shows the entire word—only progress
2. Sequential progression mechanic
-The player must press the letters in order: c-o-d-i-n-g
-The game keeps track of where the player is
-If the player presses the correct next letter, they move forward in the word
-If palyer types wrong letter, the entire word resets. The player restarts at the first letter,Then displayed progress updates
3. Visual progress mechanic
-Before each keypress, the game shows: _ _ _ _ _ _
-as the player gets letters right, it shows progrees in the word: c o _ _ _ _
4. Scoring mechanic
-Each time the player finishes the entire word "coding": Score goes up by 1, then progress resets
5. Ladder animation
# Milestones
1. Build the Retro Game Structure
2. Create the Core Gameplay Mechanics
3. Add Game Completion, Scoring