Hackenbush every drawing has a value

Edges stand on the ground. Blue cuts a blue or green edge, Red cuts a red or green edge, and whatever is no longer joined to the ground falls away. Whoever cannot cut loses. The side panel shows the exact game value of the drawing in Conway's sense: a number like 3/4 is how many free moves Blue is ahead, * (star) is a win for whoever moves first, and ↑ (up) is a positive amount smaller than every positive number. With hints on, every cut you may make is marked ✓ (keeps the win) or ✗ (hands it over).

value of the drawing

reading a value

3/4 a number: Blue is that many moves ahead. Blue-red drawings always have one.

*, *2, … nimbers: whoever moves first wins. All-green drawings are always one.

↑ up: positive but smaller than any positive number; ↑* is a first-player win.

{a | b} what Blue can reach | what Red can reach, when nothing simpler fits.

A sum is played by moving in one piece at a time; values add.

How the values are computed

A Hackenbush position is a game {Blue's options | Red's options}. The engine values a drawing by cutting every edge in turn, valuing what is left, and reducing the result to its canonical form: options that are worse than another option are deleted, and options the opponent can immediately reverse are bypassed. Equal games then have identical forms, so each value is stored once and comparing two values is an id lookup. Pieces that meet only at the ground are valued separately and added.

Three theorems, checked by brute force

Berlekamp's rule: a blue-red stalk is worth the number whose sign expansion is its colours, read from the ground up. Colon and fusion principles: an all-green drawing is worth a nimber, found by fusing the vertices of every circuit and adding one per edge up the remaining tree. And every blue-red drawing is a number. The repository checks all three on every small drawing, and checks the engine's verdict on who wins against a plain win/lose search that knows nothing about game values.