From 6725c4ae0c749b38f04e7bc26831b350c5e0a395 Mon Sep 17 00:00:00 2001 From: Marcin Kostrzewski Date: Sat, 16 May 2020 22:50:56 +0200 Subject: [PATCH] Weighted entity picks are now seeded --- src/AI/GA.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/AI/GA.py b/src/AI/GA.py index dea1a50..afd7f92 100644 --- a/src/AI/GA.py +++ b/src/AI/GA.py @@ -171,4 +171,7 @@ def pickEntity(player, map): if not finalEntities: # If all items are gone, pick random one finalEntities = map.getInteractablesByClassifier() - return random.choices(finalEntities, finalWeights)[0] + random.seed(10) + choice = random.choices(finalEntities, finalWeights)[0] + random.seed() + return choice