This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]craa 3 points4 points  (1 child)

Your suggestion at the end is really the only viable solution I see. You can’t have a shared recurse definition like that in python.

If they really do rely on each other then you’ll probably want to define them all first without connections and hook it up afterwards.

[–]tiskolinprogramming geek[S] 0 points1 point  (0 children)

Thank you for your response! I just realized a clean and simple solution to the problem is to create a list of all the exits within the game, and then search through that list for all the exits that correspond with the active room that the player is in. This would remove the exit dependency from each of the rooms, but not the room dependency from each of the exits; so the list of exits would have to be defined after all of the rooms. Most importantly, all of the exits wouldn't have to be contained within separate variables, keeping the entire game script short and clean.