OO and game design questions
davea at ieee.org
Wed Oct 20 01:49:20 CEST 2010
On 2:59 PM, Terry Reedy wrote:
> On 10/19/2010 1:46 PM, Ian Kelly wrote:
>> On Tue, Oct 19, 2010 at 5:37 AM, Dave Angel <davea at ieee.org
>> <mailto:davea at ieee.org>> wrote:
>> Simply replace room B with a "destroyed room" object. That can be
>> quite small, and you only need one, regardless of how many rooms are
>> thus eliminated.
>> How does this avoid the problem of having to keep a list of doors that
>> lead to room B? You can't just replace one object with another. You
>> would have to replace every reference to B with a reference to the new
>> object. This is no simpler than deleting the references or replacing
>> them with None.
> One should rather *change* (not replace) the room into a 'destroyed
> room' or 'collapsed passage' or whatever, that cannot be entered. The
> keeps the room around but allows it to be repaired, rebuilt, cleared,
> or whatever.
Thanks, that is what I was trying to say. In the same sense that
emptying a list makes it quite small, if it's a general purpose object,
you just want to remove all the attributes.
More information about the Python-list