Closed kungtotte closed 8 years ago
Why should it be a dict, rather than a list?
It should actually be a list. The dict thing was just because I was stuck thinking about the way people are currently handled (with string references to their names).
Currently, rooms keep track of which inhabitants are in them with a weird string of binary numbers. I.e. 100010 means that the 1st and 5th people are assigned to the room. Transitioning from a list to a dictionary ( for the people) has broken this system. We need a new way for rooms to know who's assigned to them. I would recommend having the room.assigned variable set to a list of the names of the people assigned there, as mentioned before. This can be easily cross-referenced with the people dictionary.
It's cumbersome and error prone to have assigned rooms implemented as a string, it's better to use a dict (or a set, to enforce unique values), and pass around person objects.
E.g: