Skip to content

Add python_hex0n: HEX0N, a two-player placement game with chance nodes - #1643

Open
yiotri wants to merge 1 commit into
google-deepmind:masterfrom
yiotri:add-python-hex0n
Open

yiotri wants to merge 1 commit into
google-deepmind:masterfrom
yiotri:add-python-hex0n

Conversation

@yiotri

@yiotri yiotri commented Oct 12, 2026

Copy link
Copy Markdown

This adds HEX0N as a Python game, python_hex0n.

HEX0N is a two-player abstract placement game on an N×N board (5×5 by default). Players place squares, circles and triangles. A triangle that touches a circle and a square removes all three, and the same player then places a permanent, scoring hex on one of the cleared cells. Squares are a limited supply. When a triangle touches several eligible circle+square pairs, one is removed at random, which is modelled as an explicit chance node with up to 16 equally likely outcomes. Most hexes wins, with an optional tie-break on the largest connected hex group.

It is a placement game with stochastic outcomes and a depletable resource, which makes it a compact testbed for placement+conversion+chance.

Polished version & Benchmarks: https://github.com/yiotri/hextriad

Game type

SEQUENTIAL, EXPLICIT_STOCHASTIC, PERFECT_INFORMATION, ZERO_SUM, TERMINAL rewards.

Parameter Default Effect
size 5 Board width and height. 101 distinct actions on 5×5, 197 on 7×7.
tie_break true On equal hexes, the larger connected hex group wins; otherwise a draw.
opponent_pieces true A triad may use the opponent's circle or square (at least one must be the mover's); if false, both must be the mover's.

Actions are kind * N² + cell (square, circle, triangle, hex) plus one pass action, legal only when no placement is.

Changes

  • open_spiel/python/games/hex0n.py: the game.
  • open_spiel/python/games/hex0n_test.py: 15 tests. They cover random simulation with serialization on 4×4, 5×5 (all variants) and 7×7, a triad with and without a chance node, the 16-outcome maximum, pass legality, tie-break returns, etc.
  • open_spiel/integration_tests/playthroughs/python_hex0n.txt, generated with generate_new_playthrough.sh.
  • Registration in games/__init__.py, python/CMakeLists.txt, tests/pyspiel_test.py, plus a row in docs/games.md.

Verification

  • hex0n_test.py: 15/15 pass. api_test.py and playthrough_test.py pass for python_hex0n.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

⌂ Proxy