[update] Documentation for heuristic, fork detection, and playable threats.

Updated Background information.md, Achtergrondinformatie.md, and
README.md to describe the improved AI: playable vs non-playable
threat scoring, fork detection bonus, and the split Phase 1 strategy.
README now lists all three implementations and the AI strategy section.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-27 17:00:10 +01:00
parent b27032762e
commit 3341c3922a
3 changed files with 49 additions and 15 deletions
+10 -5
View File
@@ -67,17 +67,22 @@ After playing out a "what if?" scenario, the AI needs to decide: is this a good
Instead of calling every unsolved position "neutral," the AI examines every possible group of four consecutive cells on the board (horizontal, vertical, and both diagonals — 69 groups in total). For each group, it counts pieces:
- **3 AI pieces + 1 empty:** This is a strong threat — the AI is one move away from winning here. Score: **+50**.
- **3 AI pieces + 1 empty (playable):** The empty cell can be filled right now (it's on the bottom row or has a piece below it). This is an immediate threat. Score: **+100**.
- **3 AI pieces + 1 empty (not yet playable):** The empty cell is floating in the air — the threat exists but can't be used yet. Score: **+40**.
- **2 AI pieces + 2 empty:** A promising setup that could develop into a threat. Score: **+5**.
- **3 opponent pieces + 1 empty:** A dangerous opponent threat. Score: **-50**.
- **3 opponent pieces + 1 empty (playable):** An immediate danger. Score: **-100**.
- **3 opponent pieces + 1 empty (not yet playable):** A future danger. Score: **-40**.
- **2 opponent pieces + 2 empty:** The opponent is building something. Score: **-5**.
- **Mixed groups** (both players have pieces in the same group): Blocked — nobody can win here. Score: **0**.
On top of that, the AI gives a small bonus (**+3** per piece) for controlling the center column, and a penalty (**-3** per opponent piece) there. The center column is involved in more winning lines than any other column, so controlling it is valuable.
On top of that, the AI uses two more scoring bonuses:
All these small scores add up. The maximum possible heuristic score is well below 1000, so it never interferes with actual win/loss detection — a guaranteed win always beats the best heuristic position.
- **Center column control:** +3 per AI piece in the center column, -3 per opponent piece. The center column is involved in more winning lines than any other column, so controlling it is valuable.
- **Fork detection:** If a player has **two or more** three-in-a-row threats at the same time, that's a fork — the opponent can only block one per turn, so the other wins the game. The AI adds a large bonus (**+200** or **-200**) when it detects a fork, making it aggressively pursue fork setups and desperately avoid letting the opponent create one.
This heuristic means the AI can now tell the difference between a strong position (many threats being built) and a weak one (the opponent has all the threats), even when it can't see a forced win or loss within its search depth.
All these scores add up. The maximum possible heuristic score is well below 1000, so it never interferes with actual win/loss detection — a guaranteed win always beats the best heuristic position.
This heuristic means the AI can now tell the difference between a strong position (many threats being built, especially playable ones) and a weak one (the opponent has all the threats), even when it can't see a forced win or loss within its search depth.
### Why the center column matters