How Fivefold Gomoku AI searches
Method version 1.0 · Updated 31 July 2026. The AI is deterministic for the same board, rule, difficulty, and seed. A Web Worker keeps search off the interaction thread.
Four internal layers
Layer one orders legal nearby moves. Layer two takes immediate wins and blocks immediate losses. Layer three runs bounded alpha-beta search. Sharp first runs a fixed 1,800-node, two-iteration threat extension that expands only immediate wins, must-block fours, moves creating at least two next-move wins, and the unique forced reply. A result is labelled threat-space only when that forcing line is proved; otherwise it remains alpha-beta.
Difficulty boundaries
Relaxed uses legal ordering and direct tactics. Balanced searches a smaller tree. Sharp uses the largest fixed node and iteration budgets. None is described as perfect.
Fixed work, not a clock cutoff
Search is a resumable explicit-stack stepper. Node and iteration budgets determine the result; elapsed time only reports operational faults and cannot change the move.
Cancellation and failure
Every request has an ID and progress heartbeat. New games cancel old work, stale results are ignored, and a no-progress watchdog treats a hung Worker as an operational fault. Fault recovery scans at most 225 points from a deterministic start for a legal fallback; it never runs search on the main thread.