Dev.to
7/30/2026

The original title is "Six Games, Three Classic Algorithms: Shipping Real Game AI in Vanilla JS"
Original: Six Games, Three Classic Algorithms: Shipping Real Game AI in Vanilla JS
Short summary
A developer built six browser games with real AI opponents using three classical algorithms: minimax with alpha-beta pruning for adversarial games, expectimax for 2048's chance-based mechanics, and BFS for pathfinding. The 2048 solver uses a corner-snake heuristic with adaptive search depth and reaches the 2048 tile ~70% of the time. All games ship as zero-dependency static files with a published self-play benchmark harness.
- •Three classical algorithms (minimax, expectimax, BFS) power AI opponents across six vanilla JS browser games
- •2048 solver reaches 2048 tile ~70% of runs using corner-snake heuristic with adaptive depth; real benchmark numbers published
- •Zero dependencies, static files, runs entirely client-side with a reproducible self-play harness
Generated with AI, which can make mistakes.
Is this a good recommendation for you?



