GameDev.Tech
games & tools, built in Rust
You are visitor visitor count a nostalgic skin of gamedev.tech
<< NAVIGATION >>
* Modern site
* Games
* Tools
* Devlog
* Benchmark

Under Construction
Best viewed in
Netscape Navigator
@ 800x600
The A.I. stopped dancing: a loop watchdog (and self-play)

2026-07-01

Because Flow Field Chess never looks more than one move ahead, it can occasionally fall in love with a square and shuffle a piece back and forth forever. A player on LinkedIn found this the honest way: “I played it, ended up in a stalemate, we just danced around forever until I called it quits.” Fair enough — the engine had found the move it liked best and kept re-discovering it, turn after turn. Thanks to Julian Ross for the report.

Detecting a doom loop, not a repeat

The tempting fix — “never return to a position you've seen” — is far too aggressive; a single repeat or a natural transposition is perfectly ordinary chess. So the engine now accumulates: it fingerprints every position reached this game, and only intervenes when a move would revisit a position for the third time — a genuine threefold-style cycle, the actual dance, rather than a one-off.

Breaking out by changing the weather

When a loop is detected, the watchdog does something in keeping with the whole project: it doesn't search, it changes the landscape. It switches on the extra field algorithms one at a time, in random order, re-resolving the fields after each — until the best move is one that escapes the cycle. Different fields, different terrain, different move. If shuffling algorithms somehow can't help, it falls back to the best legal move that doesn't complete the loop. No more forever-standoffs, and normal play is left entirely untouched.

While I was in there: self-play

The offline build used to let the fields play against themselves, so I put that back — and made it more interesting. There's now an AI vs AI (watch) button, plus a Randomize fields per side toggle that hands each side its own random mix of algorithms. Two different field personalities playing it out: oddly watchable, and a good way to see just how much the choice of algorithms changes the character of a game.

Play / watch: gamedev.tech/games/ffce/play
Source (Rust/WASM): github.com/cronos3k/FFCE

The dance was one of my favourite emergent bugs — but it's much better as something you can switch on than something you get stuck in.

<< back to devlog
Valid HTML 4.01 Made with Notepad Best in Netscape

Copyright (c) 2026 cronos3k - GameDev.Tech - hand-coded by a Rust generator - best viewed @ 1024x768
*** Welcome to GameDev.Tech !!!   the games are bleeding-edge Rust/WASM, the homepage is gloriously 1999   ***   visit the modern site   ***