Skip to content
ashannanarriePublic

About

Pacman Test Game

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Terminal Pac-Man

A classic Pac-Man game implementation for the terminal using Python's curses library. No external dependencies required!

Features

  • Classic Gameplay: Traditional Pac-Man mechanics in your terminal
  • Ghost AI: Intelligent ghost behavior with vulnerability states
  • Power-Ups: Power pellets that make ghosts vulnerable
  • Lives System: Start with 3 lives
  • Score Tracking: Earn points by eating dots and ghosts
  • Color Graphics: Full-color terminal rendering
  • Username Input: Personalized game experience

Requirements

  • Python 3.x (standard library only)
  • Terminal with curses support (Linux/macOS/Windows with proper terminal)

Installation

No installation required! Just clone and run.

Usage

# Make executable
chmod +x pacman.py

# Run the game
./pacman.py
# or
python3 pacman.py

Controls

  • Arrow Keys: Move Pac-Man (↑ ↓ ← →)
  • Q: Quit game

Game Rules

  1. Objective: Eat all dots and power pellets while avoiding ghosts
  2. Scoring:
    • Regular dot: Points earned
    • Power pellet: Makes ghosts vulnerable
    • Vulnerable ghost: Bonus points
  3. Lives: Start with 3 lives, lose one when caught by a ghost
  4. Win Condition: Collect all dots and pellets
  5. Lose Condition: Run out of lives

Game Mechanics

Entities

  • Pac-Man (●): Yellow player character
  • Ghosts: Enemy AI with different behaviors
    • Normal state: Chase Pac-Man
    • Vulnerable state: Run away from Pac-Man
    • Eaten state: Return to spawn
  • Dots (·): Regular collectibles
  • Power Pellets (○): Grant temporary invincibility

Ghost AI

  • Pathfinding: 70% chance to move toward Pac-Man
  • States: Normal → Vulnerable → Eaten → Normal
  • Vulnerability Timer: Limited time when ghosts are edible
  • Respawn: Ghosts return to center after being eaten

Maze

  • Grid Size: 10x10
  • Walls: Impassable barriers
  • Valid Moves: Only through empty spaces and collectibles

Code Architecture

The game is contained in a single file (pacman.py) with these classes:

  1. Entity - Base class for game objects (position, movement)
  2. Pacman - Player with lives, score, power-up state
  3. Ghost - Enemy AI with vulnerability mechanics
  4. Maze - Grid management, collision detection
  5. Game - Main controller, game loop, rendering

Color Scheme

  • Yellow: Pac-Man
  • Red/Blue/Green/Purple: Ghosts
  • White: Dots and walls
  • Cyan: Power pellets

Development

For developers working with this code, see CLAUDE.md for detailed architecture documentation.

Terminal Compatibility

Works best with:

  • Linux terminals (gnome-terminal, konsole, xterm)
  • macOS Terminal
  • Windows Terminal (with proper curses support)

Troubleshooting

Game doesn't start:

  • Ensure your terminal supports curses
  • Check Python version (3.x required)

Display issues:

  • Resize terminal to at least 80x24
  • Ensure terminal supports color

Controls not working:

  • Make sure terminal window is focused
  • Try running with python3 instead of python

Contributing

Contributions welcome! Possible improvements:

  • Additional ghost AI behaviors
  • Level progression
  • High score persistence
  • Sound effects (terminal beep)
  • Larger mazes
  • Difficulty settings

License

See LICENSE file for details.

Credits

Classic Pac-Man game reimagined for the terminal. Built with Python curses library.

About

Pacman Test Game

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages