Quickly Create a 'Match & Merge' Number Puzzle Game with Amazon Q CLI

ashwin raiyaniashwin raiyani
3 min read

Prerequisites

Before you begin, ensure you have the following installed:

  • Windows 10 or 11 with WSL enabled

  • Ubuntu installed via WSL

  • Python 3.x: Download and install from here.

  • pip: Comes bundled with Python; verify installation by running pip --version in your terminal.

Step 1 : Install Python and Pygame in WSL

sudo apt install python3 python3-pip -y

pip3 install pygame

Step 2 Install Amazon Q CLI on WSL Ubuntu

In previous blog posts, I provided guidance on setting up the Amazon Q CLI. In this blog, I walk you through configuring and authenticating the Amazon Q CLI with your AWS credentials. Now that you have installed and configured the Amazon Q CLI, you can initiate a chat session.

Step 3: Set Up Your Game Project

In the chat session, prompt Amazon Q to help set up your game project. For example:

Create a Python project using Pygame for a number puzzle game where players merge matching numbers to achieve higher scores.

Amazon Q will generate the necessary code structure and files for your game.

Step 4: Implement Game Features

Iteratively develop your game by prompting Amazon Q for specific features. Examples:

Game Loop:

Implement the main game loop handling events, updates, and rendering.

Merge Logic:

Add functionality to merge adjacent tiles with the same number and update the score accordingly.

User Interface:

Design a start screen with the title 'Match & Merge – Number Puzzle' and a 'Start Game' button.

I've created a zip file of the Match & Merge Number Puzzle game project to download and upload in github repository.

To test the game, Clone this repository:

git clone https://github.com/ashwinraiyani/match_and_merge.git.
cd match-merge-game

How to Run the Game

This will take you into the directory containing the modular version of the Match & Merge Number Puzzle game that we created. Once inside this directory, you'll find all the component files of the game:

main.py (the entry point)

constants.py (game constants and configuration)

game.py (game logic)

renderer.py (drawing functions)

init.py (package file)

README.md (documentation)

From there, you can run the game using:

python3 main.py

The game functions exactly as it features all the same elements:

Future Improvements

  • Add levels and difficulty settings

  • Leaderboard with online scores

  • Mobile compatibility with touch controls

  • Save/Resume game feature

  • Theme customization

Ready to Give It a Try?

Github Repository link: The Code is 13KB in size. And here is the Video link.

Wrapping It Up: Code Meets Creativity

This project was one of the most fun, quirky, and creatively satisfying experiments. Combining the power of Amazon Q CLI with the playful versatility of PyGame felt like teaming up two superheroes — and the result? Pure dev magic.

Now it’s your turn. Fire up Q CLI, dream up something wild, and start building. Whether it’s a game, a tool, or something totally unexpected, let your imagination lead — and don’t forget to share your creation with the world. Who knows? Your project might be the next spark of inspiration for someone else.

4
Subscribe to my newsletter

Read articles from ashwin raiyani directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

ashwin raiyani
ashwin raiyani