AWS Logo
Menu

Building ๐Ÿ Snake Xenzia ๐ŸŽฎ with Amazon Q CLI

This blog is about using Amazon Q CLI to build Snake Xenzia game using pygame library with multiple game elements and difficulty levels

Published May 25, 2025

Introduction:

Over the past few weeks, Iโ€™ve been diving deep into Amazon Q CLI, and using Q chat function to understand its capabilities. I've used it from within AWS Cloudshell and from Terminal to do AWS environment related conversations. 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.
When I heard about the Amazon Q CLI Build Games Contest, I knew this was the perfect opportunity to put it to the test. What better way to combine innovation with nostalgia than by recreating the Snake Xenzia game โ€” the one we all played on those good old Nokia phones?

๐ŸŽฒ Gaming Mode:

By the time I started to use Q Chat to create game application, there were already few amazing AWS builders created Snake game, Tetris, 2048, PacMan, fruit ninja, 2D maze, etc., Having said that, I was so obsessed with Snake Xenzia game since childhood days. So I decided to develop my own Snake Xenzia with multiple game elements, difficulty levels, etc., It all started with one simple natural command in lay-man terms as below in Q CLI Chat.
> write a pygame game that gives me snake game
Amazon Q CLI begins to write a python program importing 'pygame' library(needs to be pre-installed!) and started its magic.
I've downloaded the script to my machine using below prompt and I started executing the program to play the default version of Snake Xenzia game.
> could you save this program to a file in documents folder on my machine.?
It's was a classic game with green snake, red food. However, I wasn't fully convinced as the game gets-over if hits the wall and lacks other interesting elements.

๐Ÿ Snake Xenzia Evolution ๐ŸŽฎ

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 - Minimalist design with square snake segments and no special food
  • ๐Ÿ”ธ Level 2: Normal Mode - Colorful graphics with circular snake segments and bonus food with a time to consume them(Remember your Nokia 1100 days)
  • โญ Level 3: Challenge Mode - Navigate through obstacles for an extra challenge.

Gameplay Elements:

  • ๐Ÿ Snake starts with a length of 3 blocks
  • ๐ŸŸก Regular food to grow your snake and earn points
  • ๐Ÿฅˆ Special bonus food in Levels 2-3 that gives extra points (not in Level 1)
  • ๐Ÿงฑ L-shaped obstacles in corners and two rectangular obstacles in Level 3
  • ๐Ÿ”„ Wrap-around screen edges for continuous movement
  • ๐Ÿ“Š Score tracking to monitor your progress
  • ๐Ÿ’ฅ Visual collision detection with red X marks

Outcome:

Level-1:
Level-2:
Level-3:

Prompts:

Here are the prompts that I have used along the way..!
> write a pygame game that gives me snake game
> Keep the snake body in a circular shape and food in triangle shape.. snake should be in brown color and food should be in green color
> I loved it, occasionally, can you give me bonus food with larger points.?
> here, I want the bonus food to be in round shape with dimensions slightly higher than regular food. and add a 15-second timer to hide the bonus food if snake didn't eat it.
> Create obstacles with 2 boxes per corner and also a slight thin rectangular box in the middle of the area
> the food should not be on the obstacles.
> when the snake hits its own body or obstacles, hold the screen for few seconds and highlight the clash area with Red X
> I observed that in level-3, sometimes, food is coming on top of the obstacle, so the snake can't eat it without hitting the obstacles and losing life. could you improve this.
> modularize the final code and create readme to be more interactive with gaming emoji's

Conclusion:

Codebase for this game can be forked and customized from my GitHub public repository: https://github.com/SrinivasanAgile/SnakeXenzia-QCLI
We have seen the power of Amazon Q CLI assisting us to create game application in very short time. but this is just a tip of 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 to 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 with its memory retention.
> Hey Q, Could you summarize the discussions that we had while building this game in 10 lines.?
AmazonQCLI-ConversationSummary
If you are planning to play this game or have a feedback, Do let me know your highest score/opinion in the comments section below.
ย 

Comments