🪟 Windows TippsModify Windows Support Phone Number with PowerShell(03.09.2026 um 00:00 Uhr)
🔧 AI Nachrichten Podcast: ChatGPT schwatzt Nutzern in Deutschland jetzt Werbung auf(28.08.2026 um 08:46 Uhr)
🪟 Windows TippsMicrosoft bringt Emoji 17.0 auf Windows 11(31.08.2026 um 08:16 Uhr)
🪟 Windows TippsModify Windows Support Phone Number with PowerShell(03.09.2026 um 00:00 Uhr)
🔧 AI Nachrichten Podcast: ChatGPT schwatzt Nutzern in Deutschland jetzt Werbung auf(28.08.2026 um 08:46 Uhr)
🪟 Windows TippsMicrosoft bringt Emoji 17.0 auf Windows 11(31.08.2026 um 08:16 Uhr)

🔧 Programmierung 🕛 vor 1 Monat 3 Min Lesezeit
0

I tried to beat my own Tic-Tac-Toe AI 1,270 ways. It never lost.

↗ Quelle (dev.to)
🗣️ Stimme:
📑 Inhaltsübersicht

Everyone says a minimax Tic-Tac-Toe bot is "unbeatable." I wanted a number instead of a vibe — so I benchmarked the exact engine that ships in ; every figure below reproduces with node benchmark.js.



Three things I measured: whether it can actually lose, how much alpha-beta pruning really saves, and whether bigger boards crack it.






1. The proof isn't a sample — it's the whole game tree



On a 3×3 board, Hard mode runs a full depth-9 minimax search, so its reply to any position is deterministic. That means I don't have to sample games — I can enumerate every reachable one: every move a human could make, answered by the AI.



Playing second, exactly as it does in the game:




  • 569 reachable game lines → 386 AI wins, 183 draws, 0 losses.



Playing first:




  • 73 lines → 71 wins, 2 draws, 0 losses.



Across all 642 possible 3×3 games, it never loses. On 3×3, "unbeatable" isn't a claim — it's the entire game tree.






2. Alpha-beta earns its keep



Minimax alone is wasteful: it scores branches that can't possibly change the decision. Alpha-beta pruning cuts them the moment that's provable. Choosing the opening move at full depth:




















Search Node visits
Plain minimax 549,945
With alpha-beta 36,528


That's a 93% reduction — identical answer, ~1/15th the work. It's why Hard mode replies instantly.






3. Does it break on bigger boards? I expected it to. It didn't.



The engine caps its search depth as the board grows (9 → 7 → 5 → 3) and only needs 4-in-a-row past 3×3. A capped horizon should leave a crack. So I ran the Hard AI against random and greedy opponents on 4×4, 5×5, and 6×6:

































Board vs random vs greedy
3×3 91.8% W · 8.2% D · 0 L
draw · 0 L
4×4 72.5% W · 27.5% D · 0 L
draw · 0 L
5×5 96.7% W · 3.3% D · 0 L
draw · 0 L
6×6 100% W · 0 L
win · 0 L


0 losses across 628 simulated games, on top of the exhaustive 3×3 proof. What actually changes with board size isn't losing — it's that forcing a win gets harder, so results drift toward draws.



Why it holds up: the engine always blocks an immediate threat before it searches, and 4-in-a-row stays defensible within the depth cap. The genuine fragility is theoretical — a player who can set up a fork beyond the AI's horizon — which is exactly why the

Play it: lkforge.com/games/tictactoe

Vollständiger Original-Bericht
Ausführliche Details, Code-Beispiele & Hersteller-Stellungnahme auf dev.to.
↗ Original-Artikel auf dev.to lesen
Wie bewertest du diesen Beitrag?
1 Klick Feedback
Teilen mit Netzwerk & Team:

Community-Analysen & Experten-Meinungen 0

Verfasse deine eigene Analyse, teile Workarounds oder diskutiere diesen Vorfall im Blog.
Noch keine Community-Analyse verfasst. Markiere einen Textabschnitt oder klicke oben auf Eigene Analyse verfassen“!
Community Pulse: Relevanz-Einschätzung
1 Klick Experten-Votum
🔴 Akute Relevanz 0%
🟡 In Evaluierung 0%
🟢 Keine Auswirkung 0%
Spannende Innovation 0%
Verwandte Story-Cluster & Quellen (Vektor-KI)
Port 8095 Engine
1 Quelle
Modify Windows Support Phone Number with PowerShell
1 Quelle
Die Zukunft des Einkaufens: Warum wir ein neues Kapitel aufschlagen (und wie du es mitschreiben kannst)
1 Quelle
ZDE Podcast 251: Wie sieht digitales Instore Marketing 2026 aus, Amit Chatterjee?