From 0b13db754d234f384b8c87ad3983299d2624c88f Mon Sep 17 00:00:00 2001 From: aerinon Date: Mon, 23 Mar 2020 15:40:56 -0600 Subject: [PATCH] Fixing some seed reporting --- DungeonRandomizer.py | 3 ++- source/gui/bottom.py | 11 ++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/DungeonRandomizer.py b/DungeonRandomizer.py index ca008a96..15e73f85 100755 --- a/DungeonRandomizer.py +++ b/DungeonRandomizer.py @@ -53,7 +53,8 @@ def start(): if args.gui: from Gui import guiMain guiMain(args) - elif args.count is not None: + elif args.count is not None and args.count > 1: + random.seed(None) seed = args.seed or random.randint(0, 999999999) failures = [] logger = logging.getLogger('') diff --git a/source/gui/bottom.py b/source/gui/bottom.py index 6daa4e30..218f7785 100644 --- a/source/gui/bottom.py +++ b/source/gui/bottom.py @@ -91,14 +91,19 @@ def bottom_frame(self, parent, args=None): seeds = [] if not needEnemizer or (needEnemizer and hasEnemizer): try: - if guiargs.count is not None: + if guiargs.count is not None and guiargs.seed: seed = guiargs.seed for _ in range(guiargs.count): seeds.append(seed) main(seed=seed, args=guiargs, fish=parent.fish) seed = random.randint(0, 999999999) else: - seeds.append(guiargs.seed) + if guiargs.seed: + seeds.append(guiargs.seed) + else: + random.seed(None) + guiargs.seed = random.randint(0, 999999999) + seeds.append(guiargs.seed) main(seed=guiargs.seed, args=guiargs, fish=parent.fish) except (FillError, EnemizerError, Exception, RuntimeError) as e: logging.exception(e) @@ -119,7 +124,7 @@ def bottom_frame(self, parent, args=None): successMsg += (made["playthrough"] % (YES if (guiargs.calc_playthrough) else NO)) + "\n" successMsg += (made["spoiler"] % (YES if (not guiargs.jsonout and guiargs.create_spoiler) else NO)) + "\n" # FIXME: English - successMsg += ("Seed%s: %s" % ('s' if len(seeds) > 1 else "", ','.join(seeds))) + successMsg += ("Seed%s: %s" % ('s' if len(seeds) > 1 else "", ','.join(str(x) for x in seeds))) messagebox.showinfo(title="Success", message=successMsg)