Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PacMan Icon
PacMan — Java Edition

A classic PacMan arcade game built from scratch in Java using Swing.


🎥 AI Agent Demo

Watch the ghosts coordinate using Agentic AI (LangGraph & Ollama). They communicate, debate, and coordinate their hunting strategies in real-time. No gimmicks, just pure LLM-driven multi-agent pathfinding.

Watch the Demo: https://res.cloudinary.com/eiss6qy0/video/upload/v1783707203/Setting_up_hhkijr.mp4


🎮 Gameplay

  • Navigate PacMan through the maze eating all the dots
  • Avoid the 4 ghosts — Blue, Red, Pink, and Orange
  • Eat all pellets to advance to the next level
  • You start with 3 lives — lose them all and it's game over
  • Press any arrow key after Game Over to restart

🕹️ Controls

Key Action
⬆️ Arrow Up Move Up
⬇️ Arrow Down Move Down
⬅️ Arrow Left Move Left
➡️ Arrow Right Move Right
Any arrow key (on Game Over) Restart game

⬇️ Download & Play

Requires Java 21 or laterDownload Java

  1. Go to the Releases page
  2. Download PacMan.jar
  3. Run it:
    java -jar PacMan.jar
    Or simply double-click PacMan.jar if Java is set as the default handler.

🛠️ Build from Source

Prerequisites

  • Java 21+ JDK
  • make (comes pre-installed on macOS/Linux; on Windows use WSL or Git Bash)

Steps

# Clone the repo
git clone https://github.com/dev-kvt/pacman.git
cd pacman

# Compile and package
make jar

# Run
java -jar PacMan.jar

Or run directly without packaging:

make build
java -cp bin App

📁 Project Structure

PacMan/
├── src/
│   ├── App.java          # Entry point — sets up JFrame
│   ├── PacMan.java       # Game logic, rendering, input
│   └── assets/           # PNG sprites & icon
├── bin/                  # Compiled .class files (git-ignored)
├── Makefile              # Build & package commands
├── MANIFEST.MF           # JAR entry point declaration
└── .gitignore

🤖 Technical Highlights

  • HashSet used for walls, foods and ghosts for O(1) lookup
  • javax.swing.Timer drives the 20 FPS game loop
  • AABB collision detection for walls, ghosts and food
  • Ghost AI: random direction changes on wall collisions; forced upward escape from spawn room

📜 License

MIT — free to use, fork, and build upon.


Made with ☕ and Java by Divyansh

About

This extension integrates an Agentic AI layer into the classic PacMan Java Swing game. Ghosts coordinate their hunting strategies using stateful, LLM-based multi-agent graphs running locally on your computer via Ollama.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages