From ebcc40249233959a6fbc743adc6df7c22ca8cf16 Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Mon, 31 Aug 2015 18:41:04 +0200 Subject: Demonstrate that on_cell_eaten gets called for unknown cells --- subscriber.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/subscriber.py b/subscriber.py index ecec729..e11fbb5 100644 --- a/subscriber.py +++ b/subscriber.py @@ -99,8 +99,11 @@ class EnhancingSubscriber(DummySubscriber): del self.victims[eater] def on_cell_eaten(self, eater_id, eaten_id): - if eater_id in self.c.world.cells and self.c.world.cells[eater_id].is_virus: - print("virus ate something!") + if eater_id in self.c.world.cells: + if self.c.world.cells[eater_id].is_virus: + print("virus ate something!") + else: + print("eater is not in world.cells, da fuq?") if eater_id not in self.victims: self.victims[eater_id] = [] -- cgit v1.2.1