From 8c0e8a44770db76e00295b44fdba0de0ccd4faee Mon Sep 17 00:00:00 2001 From: Matej Straka Date: Tue, 29 Oct 2024 11:41:47 +0100 Subject: [PATCH] fix: Make online observations include priority --- README.md | 1 + generals/remote/generalsio_state.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/README.md b/README.md index 7c3e6e2..0a8c98d 100644 --- a/README.md +++ b/README.md @@ -174,6 +174,7 @@ The `observation` is a `Dict`. Values are either `numpy` matrices with shape `(N | `opponent_land_count`| — | Number of cells owned by the opponent | | `opponent_army_count`| — | Total number of units owned by the opponent | | `timestep` | — | Current timestep of the game | +| `priority` | — | `1` if your move is evaluted first, `0` otherwise | The `action_mask` is a 3D array with shape `(N, M, 4)`, where each element corresponds to whether a move is valid from cell `[i, j]` in one of four directions: `0 (up)`, `1 (down)`, `2 (left)`, or `3 (right)`. diff --git a/generals/remote/generalsio_state.py b/generals/remote/generalsio_state.py index 9048e31..122473b 100644 --- a/generals/remote/generalsio_state.py +++ b/generals/remote/generalsio_state.py @@ -63,6 +63,7 @@ def get_observation(self) -> Observation: opponent_land_count = self.scores[self.opponent_index]["tiles"] opponent_army_count = self.scores[self.opponent_index]["total"] timestep = self.turn + priority = 1 if self.player_index == 0 else 0 return Observation( armies=army, @@ -79,4 +80,5 @@ def get_observation(self) -> Observation: opponent_land_count=opponent_land_count, opponent_army_count=opponent_army_count, timestep=timestep, + priority=priority, )