How angelazqian/2048-ai works
2048 AI is a browser-playable 2048 game with optional neural-network autoplay modes. Players control moves by keyboard or touch; the game manager updates the board, applies its tile-spawn logic, persists progress and renders each state. Selecting an AI mode loads a packaged TensorFlow.js model, ranks moves from the board, and sends candidate moves through the same game manager. The README confirms the playable game; model training assets are present, but no training workflow is documented there. Edges reflect shown calls or explicit README details; unsampled HTML wiring is not inferred.
Main entry points: game_manager.js Game manager · keyboard_input_manager.js Keyboard and touch · application.js AI mode selection · grid.js Grid and tiles
Components 14
Game interaction
- Keyboard and touch
js/keyboard_input_manager.js - Application bootstrap
js/application.js
Game engine
- Game manager
js/game_manager.js - Grid and tiles
js/grid.js - Tile state
js/tile.js - Spawn strategy
js/game_manager.js
AI autoplay
- AI mode selection
js/application.js - Move prediction
js/application.js - Packaged models
model
Persistence and display
- Storage manager
js/local_storage_manager.js - Browser storage
- HTML actuator
js/html_actuator.js
Other components
- Player
- Game screen
Connections 17
- Player → Keyboard and touch: sends moves
js/keyboard_input_manager.js - Keyboard and touch → Game manager: emits events
js/game_manager.js - Application bootstrap → Game manager: creates
js/application.js - Game manager → Keyboard and touch: registers handlers
js/game_manager.js - Game manager → Grid and tiles: updates board
js/game_manager.js - Game manager → Spawn strategy: spawns tiles
js/game_manager.js - Grid and tiles → Tile state: restores tiles
js/grid.js - Game manager → Storage manager: loads and saves
js/game_manager.js - Storage manager → Browser storage: reads and writes
js/local_storage_manager.js - Game manager → HTML actuator: renders state
js/game_manager.js - HTML actuator → Game screen: updates display
js/html_actuator.js - Player → AI mode selection: selects mode
- AI mode selection → Packaged models: loads model
js/application.js - AI mode selection → Move prediction: starts autoplay
js/application.js - Move prediction → Packaged models: predicts moves
js/application.js - Move prediction → Game manager: tries ranked moves
js/application.js - Application bootstrap → Keyboard and touch: configures input
js/application.js