8000 GitHub - scottfitzhugh/grid-life: A TypeScript webapp featuring an infinite grid canvas where users can place and control programmable "ants" that follow custom JSON-based rules. Watch as simple rules create complex emergent behaviors!
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

A TypeScript webapp featuring an infinite grid canvas where users can place and control programmable "ants" that follow custom JSON-based rules. Watch as simple rules create complex emergent behaviors!

License

Notifications You must be signed in to change notification settings

scottfitzhugh/grid-life

Repository files navigation

Grid Life - Ant Simulation

A sophisticated web-based ant simulation where you can program artificial ants using JSON rules to create complex emergent behaviors. Watch as your ants interact with an infinite grid, leaving trails of color and responding to their environment through your custom logic.

Grid Life Demo

✨ Features

  • 🌐 Infinite Grid: Smooth panning and zooming across an unlimited canvas
  • 🤖 Programmable Ants: Define ant behavior using a powerful JSON-based rule system
  • 🧠 Advanced Logic: Support for variable references, mathematical expressions, tolerance-based matching, and OR/AND conditions
  • 🎨 Visual Feedback: Real-time color-coded visualization of ant states and grid cells
  • 🎮 Interactive Controls: Click to place ants, select them to edit rules, and control simulation speed
  • 💻 Modern UI: Clean, responsive interface with floating control panels

🚀 Quick Start

# Clone and install
git clone https://github.com/yourusername/grid-life.git
cd grid-life
npm install

# Start development server
npm run dev

Open http://localhost:3000 and start placing ants with left-clicks!

📖 Documentation

🐜 Simple Example

Classic Langton's Ant behavior:

[
  {
    "condition": { "cellState": { "r": 240, "g": 240, "b": 240 } },
    "action": { "setCellState": { "r": 255, "g": 0, "b": 0 }, "turn": "right", "move": true }
  },
  {
    "condition": { "cellState": { "r": 255, "g": 0, "b": 0 } },
    "action": { "setCellState": { "r": 240, "g": 240, "b": 240 }, "turn": "left", "move": true }
  }
]

This creates an ant that turns right on white cells and left on red cells, eventually forming complex highway patterns.

🎮 Controls

Action Control
Place ant Left click
Select ant Click on ant
Pan camera Right drag
Zoom Mouse wheel
Play/Pause Space
Reset R

🔧 Technology

  • TypeScript for type safety
  • Vite for fast development
  • Canvas API for high-performance rendering
  • Modern ES modules for clean architecture

🤝 Contributing

We welcome contributions! See our Development Guide for details on:

  • Setting up the development environment
  • Understanding the codebase architecture
  • Running tests and builds
  • Submitting pull requests

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🌟 Inspiration

Grid Life is inspired by:


Ready to create your own ant behaviors? Start with our Getting Started Guide!

About

A TypeScript webapp featuring an infinite grid canvas where users can place and control programmable "ants" that follow custom JSON-based rules. Watch as simple rules create complex emergent behaviors!

Topics

Resources

License

Stars

Watchers

Forks

0