From 5b2621965268851c05b49471dc1ed8e67f1a6133 Mon Sep 17 00:00:00 2001 From: Auric Vente Date: Sun, 21 Jul 2024 21:44:12 -0600 Subject: [PATCH] Mods --- cromulant/ants.py | 11 +++++++---- cromulant/game.py | 7 +++++-- cromulant/manifest.json | 2 +- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/cromulant/ants.py b/cromulant/ants.py index f7bde8d..8638b5a 100644 --- a/cromulant/ants.py +++ b/cromulant/ants.py @@ -211,7 +211,7 @@ class Ants: return top, top_score @staticmethod - def merge(ant_1: Ant | None = None) -> None: + def merge(ant_1: Ant | None = None) -> bool: from .game import Game def split(ant: Ant) -> list[str]: @@ -232,12 +232,12 @@ class Ants: ant_1 = Ants.random_ant() if not ant_1: - return + return False ant_2 = Ants.random_ant([ant_1]) if not ant_2: - return + return False words_1 = split(ant_1) words_2 = split(ant_2) @@ -252,13 +252,15 @@ class Ants: name = f"{combo[0]} {combo[1]}" if (name == ant_1.name) or (name == ant_2.name): + name = "" continue if (name in names) or (name in Utils.names): + name = "" continue if not name: - return + return False Ants.set_terminated(ant_1) Ants.set_terminated(ant_2) @@ -275,6 +277,7 @@ class Ants: Ants.ants.append(ant) Game.add_update(ant) Ants.hatch() + return True @staticmethod def clear() -> None: diff --git a/cromulant/game.py b/cromulant/game.py index 67e9b73..05ed246 100644 --- a/cromulant/game.py +++ b/cromulant/game.py @@ -180,8 +180,11 @@ class Game: Game.last_update = num if num == Method.merge: - Ants.merge() - return + if Ants.merge(): + return + + # If merge failed + num = max_num status = "" method = "normal" diff --git a/cromulant/manifest.json b/cromulant/manifest.json index 2f699ea..5b3faf4 100644 --- a/cromulant/manifest.json +++ b/cromulant/manifest.json @@ -1,5 +1,5 @@ { - "version": "1.0.0", + "version": "1.1.0", "title": "Cromulant", "program": "cromulant", "author": "madprops",