I'm struggling to figure out how to organize things here. I'm building a race game. There are players and race courses. Player have attributes like name, age, etc. Race courses also have a set of attributes, including difficulty. One thing I want to do is, when a player runs a course their energy level drops based on difficulty of the course. What I'm confused about is, because difficulty is an attribute of the course, and energy level is an attribute of the player, how can I affect the two?
Take the code for example...
class Player():
energy_level = 0
def __init__(self, name, ability)
self.name = name
self.ability = ability
def run(self):
#code to run course here, reduces energy level when running course. Energy level is reduced based on player ability
class Course():
def __init__(self, name, difficulty)
self.name = name
self.difficulty = difficulty
player1 = Player("Bob", 90)
course1 = Course("Advanced Track", 15)
Maybe I am going about this all wrong? Does course need to be a class?
Thanks for any input.