Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Hacksaar
Haxotel
Commits
8204abe0
Commit
8204abe0
authored
Jul 31, 2014
by
Constantin
Browse files
fixed many bugs
parent
6d1a22af
Changes
3
Hide whitespace changes
Inline
Side-by-side
labyrinth.py
View file @
8204abe0
...
...
@@ -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
)
\ No newline at end of file
thing
.
onMove
(
field
)
thing
.
afterMove
(
field
)
\ No newline at end of file
player.py
View file @
8204abe0
...
...
@@ -68,7 +68,6 @@ class Player(Thing):
thing
.
send
(
"You hear someone saying: "
+
msg
)
self
.
send
(
"You say: "
+
msg
)
def
on
Move
(
self
,
new
Field
):
desc
=
self
.
game
.
labyrinth
.
getDescription
(
newF
ield
)
def
after
Move
(
self
,
old
Field
):
desc
=
self
.
game
.
labyrinth
.
getDescription
(
self
.
f
ield
)
self
.
send
(
desc
)
return
True
thing.py
View file @
8204abe0
...
...
@@ -3,4 +3,7 @@ class Thing():
self
.
field
=
None
def
onMove
(
self
,
newField
):
return
True
\ No newline at end of file
return
True
def
afterMove
(
self
,
oldField
):
pass
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment