summaryrefslogtreecommitdiff
path: root/host/simu/model
diff options
context:
space:
mode:
authorNicolas Schodet2011-05-15 22:44:20 +0200
committerNicolas Schodet2011-05-15 22:44:20 +0200
commit201aa07cbd28c6be8c4003f126b1ae258f859c68 (patch)
tree1f38db503d0fc063b6d82fbe45aa003a86ce0ba2 /host/simu/model
parent73f25d3310706c5d7a559f120805c54860b16795 (diff)
host/simu: handle dropping tower on the table
Diffstat (limited to 'host/simu/model')
-rw-r--r--host/simu/model/table.py4
-rw-r--r--host/simu/model/table_eurobot2011.py6
2 files changed, 9 insertions, 1 deletions
diff --git a/host/simu/model/table.py b/host/simu/model/table.py
index 41767ac4..d79f7758 100644
--- a/host/simu/model/table.py
+++ b/host/simu/model/table.py
@@ -22,6 +22,7 @@
#
# }}}
"""Table model."""
+from utils.observable import Observable
class Intersect:
@@ -29,9 +30,10 @@ class Intersect:
self.obstacle = obstacle
self.distance = distance
-class Table:
+class Table (Observable):
def __init__ (self):
+ Observable.__init__ (self)
self.obstacles = [ ]
def intersect (self, a, b, level = None, comp = None):
diff --git a/host/simu/model/table_eurobot2011.py b/host/simu/model/table_eurobot2011.py
index c9c1d193..f4bb63b7 100644
--- a/host/simu/model/table_eurobot2011.py
+++ b/host/simu/model/table_eurobot2011.py
@@ -81,3 +81,9 @@ class Table (simu.model.table.Table):
self.pawns.append (pawn)
# Add everything to obstacles.
self.obstacles += self.pawns
+
+ def add_pawn (self, pawn):
+ self.pawns.append (pawn)
+ self.obstacles.append (pawn)
+ self.notify ()
+