I’m sure you’ve all heard of ChatGPT by now. If not, it’s an open API that is trained to follow instructions from a prompt and provide you with a detailed response. to It’s going to be a total game-changer. I even asked it to create a property management game. And it did! Not exactly tons-o-fun. But still pretty crazy stuff.
import random
# Set up initial game variables
rent_due = 1000
tenant_location = random.randint(1, 10)
property_manager_location = 1
game_over = False
# Game loop
while not game_over:
# Print current game state
print(f”Rent due: ${rent_due}”)
print(f”Tenant location: {tenant_location}”)
print(f”Property manager location: {property_manager_location}”)
# Ask player to choose a direction to move
move_direction = input(“Which direction would you like to move (L/R)? “)
if move_direction == “L”:
property_manager_location -= 1
elif move_direction == “R”:
property_manager_location += 1
else:
print(“Invalid direction. Please choose L or R.”)
continue
# Check if property manager caught tenant
if property_manager_location == tenant_location:
# Tenant caught, game over
print(“You caught the tenant!”)
rent_paid = random.randint(0, rent_due)
print(f”The tenant paid ${rent_paid} towards their rent.”)
rent_due -= rent_paid
if rent_due == 0:
print(“Congratulations, you collected all the rent and won the game!”)
game_over = True
else:
print(f”Rent still due: ${rent_due}”)
tenant_location = random.randint(1, 10)
property_manager_location = 1
elif property_manager_location < 1 or property_manager_location > 10:
# Property manager moved out of bounds, game over
print(“You moved out of bounds and lost the game!”)
game_over = True
We are pledged to the letter and spirit of U.S. policy for the achievement of equal housing opportunity throughout the Nation. See Equal Housing Opportunity Statement for more information.