From abd66730c5fa85dbb8fab533f9cd5a7dd89cdda1 Mon Sep 17 00:00:00 2001 From: Alex Goodwin Date: Tue, 14 Nov 2023 13:38:44 +1000 Subject: [PATCH] Explicitly reject multiple W-pop sophont codes --- PyRoute/TradeCodes.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/PyRoute/TradeCodes.py b/PyRoute/TradeCodes.py index 659412002..0d2d475ea 100644 --- a/PyRoute/TradeCodes.py +++ b/PyRoute/TradeCodes.py @@ -499,6 +499,13 @@ def is_well_formed(self): msg = "Sophont codes must be 5 chars each - got at least " + bad_sophonts[0] return False, msg + # explicitly exclude multiple W-pop (ie, 95+%) sophonts + big_sophs = [code for code in self.sophont_list if code.endswith('W')] + if 1 < len(big_sophs): + sophs = ' '.join(big_sophs) + msg = "Can have at most one W-pop sophont. Have " + sophs + return False, msg + return result, msg def trim_ill_formed_residual_codes(self):