Skip to content

hegemony evolve

Dan Riddell edited this page Aug 7, 2026 · 2 revisions

hegemony evolve

Search weights for the Evolved strategy with a genetic algorithm and print the best vector found.

hegemony evolve [flags]

Each candidate is scored by duelling it against a panel of opponents; fitness is aggregated over --seeds duels per opponent, so a candidate is judged on consistency rather than one lucky match.


Flags

Flag Default Description
--width <n> 24 Grid width in cells
--height <n> 24 Grid height in cells
--seeds <n> 16 Duels per opponent per fitness evaluation
--ticks <n> 400 Maximum ticks per match
--population <n> 40 Genetic-algorithm population size
--generations <n> 20 Genetic-algorithm generations
--threshold <f> 0 Territory fraction to win outright (0 disables)
--seed <n> 1 Evolution seed
--opponents <list> a fixed panel Strategies to evolve against

Plus the shared simulation parameters.


Cost

Total matches run is roughly:

population × generations × opponents × seeds

At the defaults that is 40 × 20 × |panel| × 16, so raising --population, --generations or --seeds multiplies the runtime rather than adding to it. Start small when exploring, and scale up once the search looks sensible.


Examples

# Default search
hegemony evolve

# Quick exploratory run
hegemony evolve --population 12 --generations 5 --seeds 4

# Longer search against a chosen panel
hegemony evolve --opponents Greedy,Turtle,Random --population 80 --generations 50

# Reproduce a search exactly
hegemony evolve --seed 99

Notes

--threshold defaults to 0 here, unlike headless and run where it is 0.6. Matches during evolution play to the tick limit by default, so fitness reflects territory held over a full match rather than how quickly a candidate reached a winning fraction.

The output is the best weight vector found. Feed it back in as the Evolved strategy's configuration to use it in a tournament.

Clone this wiki locally