HOP

HOP is a compact text format for describing a position. A HOP string is exactly three comma-separated fields:

<gametype>,<topology>,<player_to_move>

Unlike a FEN that pins each bug to absolute grid coordinates, the topology field describes only the shape of the position — which bug is next to which, in which direction. The same position rotated or shifted produces the same topology. The gametype field declares which bugs are in play for each color. The player_to_move field is always w or b.

Bug Letters

Each piece type is represented by a single ASCII letter. Uppercase = White, lowercase = Black. Pieces are auto-numbered in order of appearance (no explicit a1, a2).

LetterBug
Q / qQueen
A / aAnt
B / bBeetle
D / dDragonfly
G / gGrasshopper
L / lLadybug
M / mMosquito
P / pPillbug
S / sSpider
Text Layout

There are two accepted forms:

  • Three-field: <gametype>,<topology>,<player_to_move>
  • Two-field shorthand: <topology>,<player_to_move> — the gametype is omitted and defaults to ultimate.

The topology field may be empty, denoting an empty board. The player_to_move must be w or b.

Examples
HOP notationMeaning
QA-a,wTwo-field shorthand: ultimate gametype, three pieces on the board, white to move
base,QA-a,bBase gametype, black to move
,wEmpty board, white to move (two-field shorthand)
Gametype

The gametype defines the per-color piece collection. White and black are configured independently — asymmetric sets are allowed. It can be an alias, a literal list of tokens, or an alias with modifiers.

Aliases
AliasPer-side Counts
base1Q 3A 2B 3G 2S
ultimate1Q 3A 2B 3G 1L 1M 1P 2S
Modifiers

Append + or - followed by tokens to add or remove pieces from an alias. A token is an optional digit (1–8, default 1) followed by a letter (case = color).

Example: base+MLPmlp is equivalent to ultimate (base plus ladybug, mosquito, and pillbug for each side).

Topology

The topology field is a walk through the position: drop a piece letter as you visit each cell, and use turn markers between letters to change the heading.

SymbolMeaning
+Turn 60° clockwise before the next bug
-Turn 60° counter-clockwise before the next bug
!The bug before it is the last bug that moved
N=XBug X is stacked on top of the bug at chain position N
N+...A side branch starts at chain position N, heading +60° from that anchor
N-...A side branch starts at chain position N, heading −60° from that anchor
(...)Groups a branch's chain when it would otherwise be ambiguous

Chain positions are 1-indexed in order of appearance.

Tiny Example

QA-a,w — place a White Queen (position 1), step forward and place a White Ant (position 2), turn −60°, step and place a Black Ant (position 3). White to move.

QA-a2=B,b — same as above, plus a White Beetle stacked on position 2 (the White Ant). Black to move.

QA-a1+b,b — same base, plus a Black Beetle one hex off the Queen (position 1), in the +60° direction. Black to move.

The Hex Grid

From any cell there are 6 neighbors, numbered 0–5 clockwise:

IndexDirection
0NE
1E
2SE
3SW
4W
5NW

+ in the topology means "turn one step clockwise" ((d + 1) mod 6), - means "turn one step counter-clockwise" ((d + 5) mod 6).