DEV Community

Cover image for ๐Ÿง  I Rebuilt Tetris with an AI Brain Using Amazon Q CLI โ€“ Neon Tetris
Kshitij Gawankar
Kshitij Gawankar

Posted on

๐Ÿง  I Rebuilt Tetris with an AI Brain Using Amazon Q CLI โ€“ Neon Tetris

Ever thought Tetris needed a glow-up?

I did โ€” and thanks to Amazon Q Developer CLI, I didnโ€™t just build a Tetris clone... I built Neon Tetris: an AI-enhanced, retro-themed version with brainpower, beauty, and a background track that hits you with nostalgia and chill.

Neon Tetris Screenshot

This is my submission for the #BuildGamesChallenge using #AmazonQDevCLI โ€“ a global event where developers reimagine classic games through the power of conversational AI.



๐Ÿงฉ Challenge Breakdown

๐ŸŽฏ Why I Chose Tetris

Tetris is the OG puzzle game โ€” timeless, addictive, and beautifully simple. But I wanted to bring it into 2025 with a twist: AI + glowing visuals + dynamic gameplay. Tetris gave me the perfect base to explore real-time logic, visual feedback, and adaptive difficulty all in one project.


๐Ÿ› ๏ธ Prompting Techniques I Discovered

Instead of micro-managing each file or feature, I went high-level with prompts like:

"Build a modular Tetris game with AI helper logic that uses heuristics to suggest optimal moves. Include ghost piece, theme switching, and dynamic difficulty based on player performance."

This let Q CLI do the heavy lifting. I followed up with focused prompts like:

  • "Add a performance tracker that monitors score and adjusts speed."
  • "Create a theme switcher with Neon, Dark, and Retro themes."
  • "Write a helper class that calculates best piece placement using heuristics."

These small conversational tweaks saved HOURS of setup and rewrites.


๐Ÿค– How AI Handled Classic Game Dev Challenges

Q CLI impressed me with:

  • Clean module separation for game logic, AI, rendering, and input
  • Automatically generated code that worked out of the box
  • Clear comments and docstrings for most generated methods

I rarely had to fight with the code โ€” I was just refining it and adding polish.


๐Ÿ” Automation That Saved Me Time

  • Project Structure Generation: The full game skeleton (files + folders) was built in seconds
  • Heuristic AI Logic: It created a scoring system using classic Tetris metrics like holes, bumpiness, and height
  • Control Mapping: Auto-added standard controls + pause/restart/quit states
  • Theme Manager: I just said โ€œswitchable themesโ€ and it wrote the class, handled key inputs, and applied different styles. Insane.

๐ŸŽฅ Gameplay Demo

Check out the full video here! ๐ŸŽฎ๐Ÿ‘‡

๐Ÿ“บ Watch on YouTube


๐ŸŽฎ Why Tetris?

Tetris is the ultimate retro puzzle game. Itโ€™s simple, fast, and satisfying. But what if it evolved with AI?

With Neon Tetris, I added:

  • ๐Ÿค– AI that suggests your next best move
  • ๐ŸŽญ Switchable themes (Neon, Dark, Retro)
  • ๐Ÿ“ˆ Dynamic difficulty based on player skill
  • ๐Ÿ‘ป Ghost piece to preview hard drops
  • ๐ŸŽต A peaceful Tetris piano + lullaby remix soundtrack

Built using Amazon Q CLI, this was about more than just coding โ€” it was about prompting.


๐Ÿ’ฌ Prompting the Game into Existence

Hereโ€™s an example of what I told Q CLI:

โ€œCreate a modular Tetris game with an AI Helper. The AI should recommend the best position for the current piece based on heuristics like aggregate height, complete lines, holes, and bumpiness. Add a ghost piece, dynamic difficulty, theme switching, and modular file structure.โ€

Q CLI broke this down into a full project with:

๐Ÿ“ main.py โ€“ Game loop & inputs
๐Ÿ“ game.py, board.py, tetromino.py โ€“ Core Tetris mechanics
๐Ÿ“ ai_helper.py โ€“ Heuristic-based AI recommendation engine
๐Ÿ“ theme_manager.py โ€“ Multiple themes with switch key
๐Ÿ“ performance_tracker.py โ€“ Player analytics for dynamic speed
๐Ÿ“ renderer.py โ€“ Handles visuals, ghost piece, UI


๐Ÿง  The AI Helper Logic

The AI evaluates every possible move using the following heuristics:

  • ๐Ÿ“ Aggregate Height
  • ๐Ÿ•ณ๏ธ Holes
  • ๐Ÿ“Š Bumpiness
  • โœ… Completed Lines

It then recommends the best move by showing a ghost piece, helping players improve their strategy.


๐ŸŽ›๏ธ Controls

โฌ…๏ธโžก๏ธโฌ†๏ธโฌ‡๏ธ Arrow Keys: Move & rotate
๐Ÿ”ณ Space: Hard drop
๐Ÿ…ฐ๏ธ A: Toggle AI helper
๐Ÿ”ค T: Change theme
๐Ÿ” G: Toggle ghost piece
โธ๏ธ P: Pause
๐Ÿ”„ R: Restart (on game over)
โŒ Q: Quit (on game over)


๐Ÿงต Final Thoughts
This challenge showed me that AI is no longer just a helper โ€” itโ€™s a real dev partner.
Amazon Q CLI let me build something playable, clean, and smart โ€” just by talking to it.

Big thanks to the AWS Build Games Challenge team for making this possible.
And if you're a dev who loves building games but hates boilerplate, Q CLI is your new best friend.

๐ŸŽฎ Game on.

#BuildGamesChallenge
#AmazonQDevCLI #GameDev
#Python #PyGame #AI
#RetroGaming #MadeWithAI

๐Ÿ“ฆ Try It Yourself

๐Ÿ“ GitHub Repository:

๐Ÿ‘‰ https://github.com/Kshitij-0007/Neon_Tetris

๐Ÿงฐ Requirements:

  • Python 3.6+
  • Pygame 2.5.2+

โšก Installation:


bash
git clone https://github.com/Kshitij-0007/Neon_Tetris
cd Neon_Tetris
pip install -r requirements.txt
python main.py


Enter fullscreen mode Exit fullscreen mode

Top comments (0)