Back to Projects
AIResearch

Snake Maramari — Multi-Snake AI Battle

A competitive snake game in Python and Pygame where up to 4 AI snakes with different algorithms fight for survival and steal scores.

Live Demo GitHub

Overview

A competitive multi-agent snake game where autonomous AI snakes battle on the same board. Each snake runs a different algorithmic brain, and the game ends when only one snake remains. The score-stealing mechanic creates intense competitive dynamics.

Problem Statement

Classic snake games are single-player and deterministic. A multi-agent setting where different AI strategies compete reveals the strengths and weaknesses of each algorithm in a dynamic, adversarial environment.

Architecture

  • Pygame for game loop, rendering, and event handling
  • A* pathfinding for one AI agent (optimal path to food)
  • Minimax algorithm for another agent (adversarial strategy)
  • Greedy algorithm for another agent (myopic food-seeking)
  • Collision detection and score-stealing mechanics

Challenges

  • Handling real-time pathfinding for multiple agents simultaneously
  • Balancing algorithm complexity vs. frame rate
  • Designing fair starting conditions for agents with different strategies

Solutions

  • Optimized A* with early termination for real-time performance
  • Depth-limited Minimax to keep computation per frame bounded
  • Randomized starting positions and food spawns for fairness

Lessons Learned

  • 💡A* dominates in open boards; Minimax excels in tight, adversarial spaces
  • 💡Game state representation design is critical for AI performance
  • 💡Multi-agent systems expose emergent behaviors not visible in single-agent settings

Tech Stack

PythonPygameA*MinimaxGreedy

Categories

AIResearch

Related Projects

Brain CT Scan Classifier

Multi-label classification system for brain CT scans using ConvNeXt-V2 and Multiple Instance Learning with a dual-head architecture.

Microjobs Portal

A local part-time job board with an AI-powered recommendation system using TF-IDF and FAISS for fast similarity search.

AI Customer Support Chatbot

RAG-based chatbot that resolves customer complaints by retrieving similar past cases and generating responses with a local LLM.