Creating a Character (classes)
Making Sub-Classes (Inheritance)
Game Choices & Loops
OpenAI Integration
Basics "Hard Mode" (Yesterday's Review)
100

If you want every hero to start the game with 100 health, where inside your class do you type self.health = 100 ?

Inside the __init__ method (the setup code)

100

If Dragon class is a sub-class of Monster, what does the dragon automatically get from the monster class without you having to re-type it?

All of its stats and actions (attributes and methods)

100

What keyword do you use to check if a player typed option "1" versus option "2" in your text adventure?

if (and elif)

100

What is the word for the text instructions you send to OpenAI telling it to "generate a puzzle for an RPG"?

A prompt

100

If you have a list of items inventory = ["Sword", "Shield", "Potion"], what line of code do you use to add an "Elixir" to the very end of that list?

inventory.append("Elixir")

200

What word must you put as the very first item inside the parentheses of any function you write inside a class?

self

200

If you want a Mage class to copy everything from a Hero class, how do you write the very first line of the Mage class?

class Mage(Hero):

200

What line of code do you write to keep a battle going over and over until the monster's health drops to 0?

while monster.health > 0:

200

What mandatory line of code do you put at the very top of your script so Python knows how to talk to OpenAI?

from openai import OpenAI

200

What is the exact index number of the item "Dragon" if it is the very last item inside a list of 100 total elements?

99 (or -1)

300

If you want your player to use an ability called heal, what line of code do you write to define that action inside the class?

def heal(self):

300
If class Warrior(Hero): has no code inside it except the word pass, what happens when you create a warrior?

It works exactly like a regular Hero.

300

If you want to pick a random encounter for the player out of a list of rooms, what function from the random module should you use?

random.choice()

300

What is the secret password/code you must load into your script to OpenAI knows it's you and allows the API call to work?

The API Key

300

If a loop starts with for i in range(2, 8, 2):, what are the exact numbers that i will equal as the loop runs?

2, 4, 6 (Starts at 2, goes up by steps of 2, and stops before 8)

400

If you have a class called Hero, what exact line of code creates a real character and saves it to a variable named player1?

player1 = Hero()

400

If a base Monster class has an attack action that deals 10 damage, but you want your Goblin class to deal 5 damage instead, what do you do?

Write a new def attack(self): function inside the Goblin class with the new damage code.

400

If you want an enemy in the arena to randomly deal anywhere between 10 and 25 damage, what function do you write?

random.randint(10, 25)

400

Inside your OpenAI code, what parameter do you change to switch between different versions of ChatGPT (like gpt-4o or gpt-4o-mini)?

model

400

What will this code print out:

num = "5"
print(num * 3)

?

555 (Because "5" is a string, multiplying it repeats the characters instead of doing math!)

500

If you have a variable named boss, how do you access or change just his health attribute in your code?

boss.health

500

What special function do you call inside a sub-class's setup code to make sure the parent class's setup code runs too?

super().__init__()

500

How do you fix a bug where typing uppercase "LEFT" doesn't match your check for lowercase "left"?

Add .lower() to the input variable (e.g., choice.lower() )

500

When OpenAI sends back a massive bundle of data, what code path do you use to grab just the actual text response?

response.choices[0].message.content

500

What two logical operators would you use in a single if statement if you want an action to trigger only if the player has gold > 50 and they do not have an empty inventory?

and & not (e.g. if gold > 50 and not empty_inventory:)