Skip to content

Commit 80ff2c1

Browse files
committed
CybORG: accept whole-number float actions, reject bool in normalize_action
1 parent d08b705 commit 80ff2c1

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

codeclash/arenas/cyborg/runtime/run_cyborg.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ def normalize_action(action, action_space) -> tuple[int, str | None]:
6868
return DEFAULT_ACTION, None
6969
if isinstance(action, np.generic):
7070
action = action.item()
71+
if isinstance(action, bool):
72+
return DEFAULT_ACTION, "action must be an integer"
73+
if isinstance(action, float) and action.is_integer():
74+
action = int(action)
7175
if not isinstance(action, int):
7276
return DEFAULT_ACTION, "action must be an integer"
7377
if n is not None and not 0 <= action < int(n):

0 commit comments

Comments
 (0)