
Building 👻 Pac-Man 🎮 with Amazon Q CLI
This blog is about using Amazon Q CLI to build Pac-Man game using pygame library with multiple game elements, scores, and difficulty levels
Published Jun 1, 2025
As 90's kids, we all had that one game on our early mobile phones that never failed to entertain - the legendary Pac-Man game. With its simple rules and addictive gameplay, it taught us the value of precision, timing, scoring, and catching the bonus points. We became addicted to this game! I decided to recreate the classic Pac-Man game using Python and the Pygame library, but with a twist - I used Amazon Q CLI to accelerate the development process.
I must say, it’s an absolute game-changer for Cloud Engineers/Developers looking to accelerate development and experiment with creative ideas in record time.
If you are using Docker Desktop, you need to uninstall using the command below to be compatible with WSL for Windows
- Install AWS CLI: https://docs.aws.amazon.com/cli/v1/userguide/cli-chap-install.html
- Install WSL: Follow https://learn.microsoft.com/en-us/windows/wsl/install to enable WSL on your machine. Install Ubuntu: Get it from the Microsoft Store or via CLI
- Configure AWS Login Inside WSL, run: “q login”. Here, select “Use for Free with Builder ID”. If you do not have a Builder ID yet, create it using your email.
- Type “q chat” command
q chat
Amazon Q CLI begins to write a Python program importing the 'Pygame' library(needs to be pre-installed!) and starts its magic.
Yes!! It generates a Python code

At this point, I was curious and have decided to build the game in three different levels; also to add various gameplay elements
🔹 Level 1: Plain Mode
- Ghosts move at a slower speed
- Ghosts have simple random movement patterns
- Power pellets last longer (10 seconds)
- More Pac-dots for easier scoring
- 3 lives to start
- Perfect for beginners learning the game
🔸 Level 2: Normal Mode
- Ghosts move at standard speed
- Ghosts occasionally chase Pac-Man
- Power pellets last for a medium duration (5 seconds)
- Balanced number of pac-dots
- 3 lives to start
- The classic Pac-Man experience
⭐ Level 3: Challenge Mode
- Ghosts move at increased speed
- Ghosts actively hunt Pac-Man with smarter AI
- Power pellets last for a shorter duration (3 seconds)
- Fewer Pac-dots but higher point value
- Only 2 lives to start
- Maze has more complex paths and fewer escape routes
- Bonus fruits appear less frequently
- For experienced players looking for a challenge
🟡 Character Movement
👾 **Pac-Man**: Controlled by the arrow keys, moves through the maze at a moderate speed
👻 **Ghosts**: Four uniquely colored ghosts with different movement patterns
🔺 Red Ghost (Blinky): Aggressive, directly targets Pac-Man's position
🌺 Pink Ghost (Pinky): Ambushes by targeting a position ahead of Pac-Man
🔵Blue Ghost (Inky): Unpredictable, combines positions of Blinky and Pac-Man
🎃 Orange Ghost (Clyde): Alternates between chasing Pac-Man and wandering randomly
🥈 Scoring System
• **Pac-Dots**: 10 points each, scattered throughout the maze
• **Power Pellets**: 50 points each, located at strategic corners
• **Ghosts**: 200 points for first ghost, doubles for each consecutive ghost (200, 400, 800, 1600)
🍓🍉🍒🍑**Bonus Fruits**: Appear periodically at the center of the maze
• Cherry: 100 points (levels 1-2)
• Strawberry: 300 points (levels 3-4)
• Orange: 500 points (levels 5-6)
• Apple: 700 points (levels 7-8)
💥 Power-Ups
👾 **Power Pellets**: Turn ghosts blue and vulnerable for a limited time
• Duration decreases with each level
• Flashing blue indicates the power-up is about to expire
• **Bonus Fruits**: Provide extra points when collected
• **Extra Life**: Awarded at 10,000 points
📊 Level Progression
• **Level Completion**: Collect all Pac-dots to advance to the next level
• **Difficulty Scaling**:
• Ghost speed increases with each level
• Power pellet duration decreases
• Ghost vulnerability time is shortened
• Ghost "frightened" behavior becomes more strategic
Outcome:
- Classic Pac-Man reimagined with three exciting difficulty modes: Plain for beginners, Normal for the authentic experience, and Challenge for seasoned players.
- Navigate through increasingly complex mazes while collecting Pac-dots and avoiding colorful ghosts with unique hunting patterns and behaviors.
- Strategic power pellets transform ghosts into vulnerable prey, offering brief opportunities to turn the tables and earn bonus points.
- Collect special fruits for high-score bonuses as you progress through levels with increasing speed and ghost intelligence.
- Master the art of cornering, tunnel shortcuts, and ghost prediction to become the ultimate Pac-Man champion!




The codebase for this game can be forked and customized from my GitHub public repository:
https://github.com/vjraghavanv/Pac-Man-QCLI
We have seen the power of Amazon Q CLI assisting us in creating a game application in a very short time. but this is just the tip of the iceberg.
Amazon Q CLI comes with lot of powerful features to integrate with your AWS accounts to help cloud/platform engineering teams, help to create piece of code for lambda functions, pull Cloudwatch logs for your analysis, etc., Addition of MCP capability to this tool makes it even more powerful for a lot of use-cases.
Finally, before wrapping up this blog, I have used Amazon Q CLI to summarize all the conversations while building the game, and you will be amazed at its memory retention.
Please share your feedback in the comments section after playing the game. Thank you