Hackenbush #
Hackenbush is played on a connected graph with a designated "ground" vertex. Edges are coloured Left (bLue), Right (Red) or green, which either player may remove. On their turn, a player removes an edge of their colour or a green edge. The resulting position is the connected component containing the ground vertex.
Green edges touching the ground are excluded: a single one is ⋆, which has
no stride, and Stewart shows that with green ground edges the misère outcome
problem is NP-hard. This is a hereditary condition, since edges never change
colour, so it is part of the structure.
- graph : SimpleGraph V
The underlying graph.
- ground : V
The ground vertex.
Edge colouring.
Every vertex incident to an edge is reachable from the ground vertex.
- supportFinset : Finset V
A finset witnessing the finiteness of the graph's support.
The supportFinset coerces to exactly the graph's support.
- ground_colored (e : Sym2 V) : e ∈ self.graph.edgeSet → self.ground ∈ e → self.coloring e ≠ Color.green
No edge touching the ground is green.
Instances For
The edge set of a Hackenbush position is finite.
The edge finset of a Hackenbush position's graph, derived from support finiteness.
Equations
- hack.edgeFinset = ⋯.toFinset
Instances For
The number of edges in a Hackenbush position.
Equations
- hack.edgeCard = hack.edgeFinset.card
Instances For
Ground component #
The ground component after removing an edge: the subgraph of G.deleteEdges {e} restricted to vertices reachable from the ground vertex. An edge {u, v}
is kept iff it was in G, it is not the removed edge, and both u and v are
still reachable from ground.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The support of a ground component is a subset of the original graph's support.
Reachability in G.deleteEdges {e} from ground implies reachability in the
ground component.
The ground component is connected.
Remove an edge from a Hackenbush position and take the ground component.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Ground edges #
The set of p-coloured ground edges (edges incident with the ground vertex).
Equations
- hack.groundEdges p = {e ∈ hack.edgeFinset | hack.ground ∈ e ∧ hack.coloring e = Hackenbush.Color.ofPlayer p}
Instances For
The number of p-coloured edges incident with ground vertex.
Equations
- hack.groundCount p = (hack.groundEdges p).card
Instances For
A ground edge (other than the removed one) survives in the ground component.
Ground edges of the removed position = ground edges of original minus the removed edge.
Ground count properties under edge removal #
Ground count after removing a ground p-edge decreases by 1.
Ground count is preserved when removing an edge of a different colour.
Ground count is preserved when removing a non-ground edge.
Removing any edge lowers the ground count by at most one.
Removing an edge never raises a ground count.
Hackenbush game structure #
Moves in Hackenbush: remove an edge of your colour or a green edge, and take the ground component.
Equations
Instances For
Equations
- GameGraph.hackenbush = { moves := Hackenbush.moves }
Instances For
Convert a Hackenbush position to a GameForm.
Equations
- hack.toGameForm = GameGraph.toForm hack
Instances For
The game form is zero iff the graph has no edges.
Existence of ground edges #
A p-move cannot lead to the zero game when groundCount p = 0.
Removing any edge preserves the zero-ness of groundCount p.
Stride theory #
When p has no ground edges, the position is solved for p.
When groundCount p ≥ 1, the position is not solved for p.
The p-stride of a Hackenbush position equals the number of p-coloured ground edges.
Equations
- Hackenbush.instRuleset = { toGameForm := Hackenbush.toGameForm, moves_toGameForm := ⋯ }
A star Hackenbush position over ℕ with l left ground edges and r right
ground edges. Ground vertex is 0. Left edges connect 0 to 1, ..., l.
Right edges connect 0 to l+1, ..., l+r. The colouring uses max u v (the
non-zero endpoint of each star edge) to determine colour.
Equations
- One or more equations did not get rendered due to their size.