From 201aa07cbd28c6be8c4003f126b1ae258f859c68 Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Sun, 15 May 2011 22:44:20 +0200 Subject: host/simu: handle dropping tower on the table --- host/simu/model/table.py | 4 +++- host/simu/model/table_eurobot2011.py | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'host/simu/model') 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 () + -- cgit v1.2.3