Better scoring and map selection + Map delta

This commit is contained in:
2026-10-23 17:54:13 +02:00
parent ce720a92b2
commit f56b8c1e9c
16 changed files with 233 additions and 39 deletions
+11
View File
@@ -14,6 +14,7 @@ class AiSimulation:
def __init__(self, game_map: Map):
self.game = Game(deepcopy(game_map), GameState())
self._base_map_types = self.game.map.to_type_dict()
min_moves = self.game.map.get_min_moves()
self.max_moves = min_moves * 2 if min_moves is not None else None
self._condition = Condition()
@@ -65,8 +66,18 @@ class AiSimulation:
"moves": state.movesCount,
"position": list(state.get_player_position()),
"finished": state.stopGame,
"changes": self._get_map_changes(),
}
def _get_map_changes(self) -> list[dict]:
current_map_types = self.game.map.to_type_dict()
changes = []
for y, row in enumerate(current_map_types):
for x, block_type in enumerate(row):
if block_type != self._base_map_types[y][x]:
changes.append({"position": [x, y], "type": block_type})
return changes
def close(self) -> None:
self.stop_for_generation()