Skip to content

Releases: SlimPlanet92805/Fanorona

v1.0.0 — Fanorona

Choose a tag to compare

@SlimPlanet92805 SlimPlanet92805 released this 06 Aug 12:21

Play it here · 点这里玩

Fanorona — the Malagasy board game whose capture rules make it awkward for a computer: captures are compulsory, they chain, and a piece may not revisit a square inside a chain, so a "move" is really a path through the position.

What it is

A C++20 engine with a browser interface. Iterative-deepening NegaScout with alpha-beta, a 4-way set-associative transposition table with depth-preferred replacement, Lazy SMP for parallel search, and incremental Zobrist hashing. No quiescence search — a capture chain is extended at the same depth instead, which suits these rules better.

Evaluation is a mask-weighted sum over the board. Forty-five squares fit in a 64-bit mask and AVX-512 takes that mask as a first-class operand, so the per-piece loop collapses into a masked select plus VPSADBW. Chosen at runtime, so one binary still runs on older machines.

Correctness rests on a second implementation. The Java version in the repository is not legacy, it is the reference: scripts/check-parity.py compares the two layer by layer — Zobrist keys, state codec, move generation, step, evaluation — then perft for the rules alone, then whole searches whose node counts must match exactly. That last one is what catches an "optimisation" that quietly changed how the engine plays.

Playing it

  • In a browser, with nothing to install: the link above, or fanorona-web.html below — the entire game including the engine in one file, playable straight off your disk.
  • Natively, for the multithreaded search: fanorona.exe is a single static executable, no runtime to install.

Thinking time runs from 1 ms to 600 s on a logarithmic slider, because the interesting part is the bottom: the difference between 5 ms and 50 ms decides whether a human can win at all. Threads, depth, hash size, language and the stats view are all adjustable mid-game, and your settings are remembered.

The engine also remembers what it learns — to disk natively, to IndexedDB in the browser — so it does not start from nothing every session. You can turn that off or clear it from ⚙ Settings.

The interface is fully bilingual, English and Chinese, including the trash talk the AI produces instead of raw evaluation numbers. Pass --debug, or tick the box, if you would rather see Score / Depth / Nodes / NPS / TT-hit%.

Status

No further features are planned. That is not a claim that it is bug-free — nobody can know that about software they have not finished being surprised by. Issues and pull requests are welcome.