From f41ee8cbc33df5069041100046f0c58ba1e9cc75 Mon Sep 17 00:00:00 2001 From: Jon Bergland Date: Mon, 29 Apr 2024 18:39:18 +0200 Subject: [PATCH] fix: add updateBoard to geneticAlgAgentJon.py --- src/agents/geneticAlgAgentJon.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/agents/geneticAlgAgentJon.py b/src/agents/geneticAlgAgentJon.py index fc262d1..3b86585 100644 --- a/src/agents/geneticAlgAgentJon.py +++ b/src/agents/geneticAlgAgentJon.py @@ -80,6 +80,8 @@ def play_game(self, agg_height, max_height, lines_cleared, bumpiness, holes): move += 1 # Advance the game by one frame board.doAction(Action.SOFT_DROP) + if board.blockHasLanded: + board.updateBoard() #board.printBoard() total_cleared += board.rowsRemoved @@ -116,7 +118,7 @@ def paring_pop(self, pop_list: list[list[list[float], float]]) -> list[list[floa norm = np.linalg.norm(new_pop[0]) if norm == 0: norm = 1e-10 # or some small constant - new_pop[0] = (new_pop[0] / norm).tolist() + new_pop[0] = [i / norm for i in new_pop[0]] # Mutate 5% of children pops if random.randrange(0,1000)/1000 < 0.05: