def __init__(self, name, location): self.name = name self.location = location # Add more attributes as needed, which you probably will

# Add functions as needed

class Door(object):

def __init__(self, rooms_tuple): self.rooms_tuple = rooms_tuple

Now, I want to make a Room instance called living_room. That references some doors, which also reference living_room. That's a problem, because I can't make the living_room reference the door which is referencing living_room, because I can't reference them before they exist.

XndrK wrote:New prob. Is there a way to assign a variable to it "remotely"?

Hi XndrK, please watch out, as you might run into one of the problems mentioned in my sig, for example

Describe the goal, not the step

If you are trying to find out how to do something (as opposed to reporting a bug), begin by describing the goal. Only then describe the particular step towards it that you are blocked on.

Often, people who need technical help have a high-level goal in mind and get stuck on what they think is one particular path towards the goal. They come for help with the step, but don't realize that the path is wrong. It can take substantial effort to get past this.

Stupid: How do I get the color-picker on the FooDraw program to take a hexadecimal RGB value?

Smart: I'm trying to replace the color table on an image with values of my choosing. Right now the only way I can see to do this is by editing each table slot, but I can't get FooDraw's color picker to take a hexadecimal RGB value.

The second version of the question is smart. It allows an answer that suggests a tool better suited to the task.

I'm trying to make a text adventure game (I already mentioned that) and I'm trying to figure out how to give two rooms a door, or a door two rooms. I tried using the list.append() method you suggested with items to doors, but if I try to assign a variable to the item in the object's list, I get a clone instead. Is there a way to assign a variable to the object in the list?

Seriously, though. You didn't have to be brats about it. I'm tempted to leave the forum after what ochichinyezaboombwa (whatever that means) did.

Kudos to Kebap, though, for being civil. I'm sorry about the badly worded question.

XndrK wrote:Seriously, though. You didn't have to be brats about it. I'm tempted to leave the forum after what ochichinyezaboombwa (whatever that means) did.

I doubt ochichinyezaboombwa's response was meant nearly as offensively as you may be taking it. We are a rather brusque bunch. If you read the entirety of the site to which Kebap pointed you, you will confirm this.

[H]ackers have a reputation for meeting simple questions with what looks like hostility or arrogance. It sometimes looks like we're reflexively rude to newbies and the ignorant. But this isn't really true.

The A:B problem (asking about a specific implementation you have tried, rather than asking about how to accomplish your goal) is of specific annoyance to many of us.

Rest assured that everyone does indeed want to see you grow in to a competent programmer.

Say a room could have doors in the North, South, East & West.The doors connecting rooms together would have 2 rooms.A Livingroom with a Kitchen to the South of it would have a South door that has a South room(the Kitchen) & a North room(the Livingroom.John Doe gets placed in the Livingroom and goes through the South door, he would end up in the Kitchen.

Heres some code that creates the Livingroom & Kitchen & a door that connects between them in a North/South relationship.John Doe starts in the kitchen and goes through the South door, Joe Bloggs just hangs out in the Kitchen.

def enter_south_door(self, person): if not self.south_door: print 'Sorry {} there is no south door in this room'.format( person.name) return entered_room = self.south_door.enter(self) self.people.discard(person) print '{} has left the {} and entered the {}'.format(person.name, self.name, self.south_door.south_room.name) entered_room.person_enters_room(person)

def whos_in_the_room(self): people = ', '.join(person.name for person in self.people) print 'The following people are in the {}: {}'.format(self.name, people)

John Doe has entered the livingroomJoe Bloggs has entered the KitchenJohn Doe is in the livingroomJoe Bloggs is in the KitchenThe following people are in the livingroom: John DoeThe following people are in the Kitchen: Joe Bloggs

John Doe has left the livingroom and entered the KitchenJohn Doe has entered the KitchenJohn Doe is in the KitchenJoe Bloggs is in the KitchenThe following people are in the livingroom: The following people are in the Kitchen: John Doe, Joe Bloggs

Sorry Joe Bloggs there is no south door in this room

Note: Theres obviously various ways of doing this and you could decide that you dont actually need to model the doors themself and just have the rooms themself connect to each other