Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions config/guerrillacheckers.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
[base]
env_name = guerrillacheckers
# One epoch is 4096 agents * 64 horizon = 262,144 agent steps. Save every
# 20 epochs so the historical pool receives a new policy about every 5.24M.
checkpoint_interval = 20

[selfplay]
enabled = 1
max_size = 100
seed = 42
# Refresh each frozen bank about as often as snapshots are produced. Loading is
# deferred until all tagged games reach an episode boundary.
opp_timeout_steps = 5_000_000

[vec]
total_agents = 4096
num_buffers = 8
num_threads = 8
num_frozen_banks = 1
# 80% current-v-current envs and 20% current-v-historical envs.
frozen_bank_pct = 0.2
action_mask_size = 256

[env]
# hard step cap; on timeout the Guerrilla is deemed to have failed (COIN wins).
max_episode_length = 256
render_fps = 12
# selfplay = 1: two policy slots alternate sides. In historical-pool envs,
# slot 0 is the primary and slot 1 is the frozen opponent.
# selfplay = 0: policy plays `side` against a built-in `opponent` bot.
selfplay = 1
# Side played by slot 0 (the primary policy) in selfplay, or by the agent in
# bot mode: 0 = random per episode, 1 = Guerrilla, 2 = COIN.
side = 0
# opponent bot when selfplay = 0: 0 = random, 1 = greedy (capture-maximizing), 2 = mcts.
opponent = 1
# MCTS opponent knobs (used when opponent = 2). Higher iterations = stronger, slower.
mcts_iterations = 256
mcts_exploration = 0.7
# rollout policy: 0 = random (faithful UCT), 1 = greedy (stronger, esp. as guerrilla).
mcts_rollout = 1

[policy]
hidden_size = 128
num_layers = 2
expansion_factor = 1

[train]
total_timesteps = 100_000_000
gamma = 0.98
# This env has a sparse 256-way action head; action masks handle legality, and
# low entropy pressure keeps exploration from fighting the mask too hard.
ent_coef = 0.0001
59 changes: 59 additions & 0 deletions ocean/guerrillacheckers/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Guerrilla Checkers

The standalone client and tournament preserve the original Puffer 40 as the
baseline for new standard 5c self-play models.

| Checkpoint | Purpose | SHA-256 |
| --- | --- | --- |
| `guerrillacheckers_weights.bin` | Original Puffer 40 | `f58615069b9a0e50105dd54b4729d366d602fe14b957a0042e4dc88089120398` |

Puffer 40 uses the legacy 587,264-byte biased layout. Newly trained standard
5c checkpoints use the 586,240-byte bias-free layout with a value-head row.
The standalone evaluator detects both formats directly.

## Train

The canonical `config/guerrillacheckers.ini` uses genuine alternating self-play
with randomized sides: slot 0 is the trainable policy, slot 1 is the current or
historical opponent, and the inactive slot receives one deterministic pass
action. Both recurrent states observe every game step, following the existing
Ocean Chess self-play convention. Twenty percent of environments use the
historical bank. Opponent swaps happen only after all tagged games reach an
episode boundary.

```sh
./puffer train guerrillacheckers
```

## Evaluate

Build the standalone client and compare a native candidate against the original
Puffer 40 from both sides:

```sh
./build.sh guerrillacheckers --fast
./guerrillacheckers --compare-candidate 1000 \
.runtime/checkpoints/guerrillacheckers/<run>/<checkpoint>.bin
```

The recorded baseline field contains 100 games per cell, shown as Guerrilla
wins - COIN wins.

| Guerrilla / COIN | Random | Greedy | Puffer 40 | MCTS 2K | MCTS 10K |
| --- | ---: | ---: | ---: | ---: | ---: |
| Random | 8-92 | 0-100 | 0-100 | 0-100 | 0-100 |
| Greedy | 98-2 | 33-67 | 1-99 | 0-100 | 0-100 |
| Puffer 40 | 96-4 | 99-1 | 15-85 | 12-88 | 9-91 |
| MCTS 2K | 99-1 | 100-0 | 50-50 | 30-70 | 11-89 |
| MCTS 10K | 100-0 | 100-0 | 84-16 | 81-19 | 65-35 |

The side-specific Bradley-Terry fit is anchored at Elo 1500 across all ten
side-specific entries:

| Bot | Guerrilla Elo | COIN Elo |
| --- | ---: | ---: |
| Random | 338 | 727 |
| Greedy | 1120 | 1189 |
| Puffer 40 | 1636 | 1879 |
| MCTS 2K | 1834 | 1969 |
| MCTS 10K | 2200 | 2108 |
Loading