Spaces:
Running
Running
Record the model's raw completion for each played move
Browse files
arena.py
CHANGED
|
@@ -34,6 +34,13 @@ def choose(game: TetrisGame, player, protocol: str, seed: int):
|
|
| 34 |
rng = random.Random(f"{seed}:{game.pieces}")
|
| 35 |
i = ties[rng.randrange(len(ties))]
|
| 36 |
game.apply(cands[i], vals[i], len(cands))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
return True
|
| 38 |
|
| 39 |
|
|
|
|
| 34 |
rng = random.Random(f"{seed}:{game.pieces}")
|
| 35 |
i = ties[rng.randrange(len(ties))]
|
| 36 |
game.apply(cands[i], vals[i], len(cands))
|
| 37 |
+
# the model's raw completion for the move it played (shown under the board; baselines have none)
|
| 38 |
+
game.last_raw = None
|
| 39 |
+
if hasattr(player, "complete"):
|
| 40 |
+
try:
|
| 41 |
+
game.last_raw = player.complete(protocol, cands[i].description)
|
| 42 |
+
except Exception:
|
| 43 |
+
game.last_raw = None
|
| 44 |
return True
|
| 45 |
|
| 46 |
|