Files
project_game/.history/questioner_20251212224036.py
caglazir 3d6773be0a In this submission, I worked on my question spawns
This was honestly a difficult submission. There were
moments when I wanted to just quit. I tried so hard to figure out
why certain things wouldnt happen (such as my starfall spawn not stopping once the
milestone score is reached). It took me soooo many trials and errors and bunch of researching
to figure out how to troubleshoot. I feel like this was an enormous learning experience
and I am overall proud of my game so far. However there is a lot of clean up to do.
My "lives" mechanic is still not in place. What I have in place is temporary until
I can figure out the play/pause mechanic with the point system. I also currently have NO IDEA
how to remove the text from the screen. During the question phase the texts overlap. Might have to keep
researching that or I might send a message to the server.
Overall I feel like I learned how to THINK for creating games and placing a bunch of
conditional statements that flow one after the other. I am loving the productive struggle!!
2025-12-12 22:55:30 -05:00

71 lines
2.9 KiB
Python

class Questioner:
name = "Questioner"
character = '?'
def __init__(self, board_size):
board_width, board_height = board_size
self.position = (board_width // 2, board_height // 2)
self.score_prompt = 200
self.speak = True
def play_turn(self,game):
score=game.state.get("score", 0)
person = game.get_agent_by_name('Person')
if not person:
return
personx, persony = person.position
questionerx, questionery = self.position
if personx == questionerx and persony == questionery +1:
if score == 0 and self.speak:
prompt = input("Questioner: Are you ready to start the game? [[Y/N]] \n")
if prompt.strip().upper() == "Y":
print("Questioner: Well then, the rules are as follows... \n 1. You have 3 lives. \n 2. For every 200 points you accumulate during Starfall, you receive a question. \n 3. Each wrong answer costs you a life. You must answer 3 questions to escape this terminal. \n")
begin = input("Questioner: Shall we begin? [[Y/N]] \n" )
if begin.strip().upper() == "Y":
print("Questioner: Well then, good luck player \n Come back to me once you accumulate 200 points! ")
game.state["begin"] = True
elif prompt.strip().upper() == "N":
print("Questioner: I'll be here when you're ready to restart. \n")
game.state["begin"] = False
else:
print("Questioner: What now? (RESTART) \n")
game.state["begin"] = False
self.speak = False
if score >= self.score_prompt:
game.state["begin"] = False
self.ask_question_1(game)
def ask_question_1(self,game):
score=game.state.get("score")
if score >= self.score_prompt:
game.state["begin"] = False
self.score_prompt += 200
self.speak = True
question_1 = input("Very well, here is the first question: \n What is the monster from the first season of 'Stranger Things' called? \n" )
if question_1.strip().lower() == "demo":
print("You may proceed. See you again once you reach 400 points!")
else:
print("HMPH! WRONG!! YOU HAVE TWO LIVES REMAINIG.")
game.state['lives'] = 2
proceed_1 = input("Shall we continue? [[Y/N]]")
if proceed_1.strip().upper() == "Y":
game.state["begin"] = True
self.speak = False
else:
print("I don't take this as an answer... CONTINUE!")
game.state["begin"] = True
self.speak = False