Commit 8204abe0 authored by Constantin's avatar Constantin
Browse files

fixed many bugs

parent 6d1a22af
......@@ -38,7 +38,7 @@ class Labyrinth:
if len(self.things) == 0:
return "there is nothing"
elif len(self.things) == 1:
return "there is "+self.things[0].toString()
return "there is "+str(self.things[0])
else:
return "there are "+(", ".join([x.toString() for x in self.things[:-1]]))+" and "+self.things[-1].toString()
......@@ -99,11 +99,14 @@ class Labyrinth:
assert thing.field.labyrinth == self
assert newField.labyrinth == self
thing.field._removeThing(thing)
oldField = thing.field
thing.field = newField
newField._addThing(thing)
thing.afterMove(oldField)
return True
def createThing (self, thing, field):
thing.field = field
field._addThing(thing)
thing.onMove(field)
thing.afterMove(field)
\ No newline at end of file
......@@ -68,7 +68,6 @@ class Player(Thing):
thing.send("You hear someone saying: "+msg)
self.send("You say: "+msg)
def onMove(self, newField):
desc = self.game.labyrinth.getDescription(newField)
def afterMove(self, oldField):
desc = self.game.labyrinth.getDescription(self.field)
self.send(desc)
return True
......@@ -4,3 +4,6 @@ class Thing():
def onMove(self, newField):
return True
def afterMove(self, oldField):
pass
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment