All Projects★ Featured Work
SELECTED WORK•10 TECHNOLOGIES•2 SCREENSHOTS

Ai Plays2048

ai-plays2048-preview.app
TECHNOLOGIES DEPLOYED
JavaScript
Python
CSS
SCSS
HTML
React
Vite
Bootstrap
Genetic Algorithms
AI
DEPLOYMENT & REPO
Repository
•

Project Overview

Concurrent browser-based evolutionary neural agent arena simulating populations of autonomous heuristic agents evolving genetic strategies to solve 2048.

⚙

Architecture & Engineering Notes

🎮 AI Plays 2048 — Evolutionary Neural Agent Arena

JavaScript
Python
Vite
WebSockets
SCSS

A real-time browser arena where populations of autonomous neural heuristic agents evolve game-playing strategies to solve 2048. Features real-time state telemetry, evolutionary breeding, cross-over mutations, and concurrent board rendering.


📸 Screenshots & Architecture

AI Plays 2048 Arena Overview Evolutionary Telemetry Dashboard


✨ Key Features

  • Concurrent Multi-Agent Simulation: Run and visualize up to dozens of autonomous 2048 agent games in parallel in real time.
  • Population-Based Genetic Algorithm:
    • Evaluates heuristic board fitness models across generations.
    • Scores six distinct board evaluation features:
      • Empty board cell capacity
      • Highest tile value
      • Monotonicity (ordered rows/columns)
      • Smoothness (neighbor tile delta penalty)
      • Corner anchoring of maximum tiles
      • Merge opportunity potential
  • Dynamic Mutation & Crossover: Top-performing policies survive each generation as elite seeds; remaining slots are populated through genetic crossover and Gaussian mutations.
  • Bi-Directional WebSocket Bridge: Python engine manages game rules, policy weights, generation state, and reward functions; front-end renders games, score charts, and generational telemetry.
  • Persistence Across Epochs: Failed games stay rendered in spectator state until the entire cohort completes the generation epoch.

🏗 Architecture & Stack

├── src/
│   ├── js/             # Real-time WebSocket client, chart renderers & board animators
│   └── scss/           # Dark mode arena layout and responsive grid styles
├── python/
│   ├── evolve_agent.py # Heuristic vector weights, board evaluator & genetic mutation engine
│   └── server.py       # High-throughput asynchronous WebSocket game server
├── demoPics/           # High-resolution application screenshots
├── index.html          # Browser workbench entrypoint
└── package.json        # Node.js dev scripts and build configuration

🚀 Quick Start

1. Install Node Dependencies

npm install

2. Start the Python Evolutionary Server

npm run python

3. Launch Vite Development Server

npm run dev

Open http://localhost:5173 in your browser. Configure your desired population size in the arena header and select Apply to begin generational learning.


🛠 Tech Stack

  • Frontend: Vanilla JavaScript (ES Modules), HTML5 Canvas, SCSS, Vite
  • Backend Simulation: Python 3.10+, WebSockets, NumPy
  • Algorithm: Genetic Algorithm (GA), Heuristic Vector Optimization, Reward Shaping