From 1c1d10e186e9d974687ec3746f740615ba27be11 Mon Sep 17 00:00:00 2001 From: Wolfgang Hottgenroth Date: Sat, 23 Nov 2019 19:00:05 +0100 Subject: [PATCH] some additional checks --- wichteln.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/wichteln.py b/wichteln.py index 7f69277..c742ff7 100644 --- a/wichteln.py +++ b/wichteln.py @@ -38,6 +38,9 @@ class Wichtelee(object): def isReceiver(self): return self.giverName + def isGiver(self): + return self.receiverName + def inform(self): infoLine = "{0} -> {1}".format(self.name, self.receiverName) global notarMsg @@ -80,7 +83,14 @@ wichtelees = [ ] + for first in wichtelees: + if DEBUG: + print("Handling {}".format(first.name)) + if first.isGiver(): + if DEBUG: + print("Is already giver, skip over") + continue checked = [] while True: n = random.randint(0, len(wichtelees)-1)