🎮 Building a Fruit Catcher Game with Amazon Q CLI (and Winning a T-Shirt!)

🛠 Step-by-Step: From Setup to Gameplay

✅ 1. Installing Amazon Q CLI

First, I installed all necessary dependencies and downloaded the Amazon Q CLI Debian package:

sudo apt install libfuse2

curl --proto '=https' --tlsv1.2 -sSf https://desktop-release.q.us-east-1.amazonaws.com/latest/amazon-q.deb -o amazon-q.deb

sudo apt install -y ./amazon-q.deb

Then I launched Amazon Q CLI:

q

I signed in with my AWS Builder ID and was ready to start building.

launch q

🎮 2. Game Idea — “Catch the Falling Fruits”

provide prompt

I chose a simple and fun concept:

  • A basket controlled by arrow keys

  • Fruits falling from the top

  • Player earns a point for each fruit caught

  • Miss three fruits and it's game over

3. Prompting Amazon Q CLI

Here’s the prompt I gave to Amazon Q:

“Create a Python game using Pygame where:

  • The player controls a basket using left/right arrow keys

  • Fruits fall from the top at random positions

  • Catching a fruit adds 1 point

  • Missing a fruit reduces lives

  • End the game after 3 misses with a Game Over screen

  • Show score and lives on screen”

it will generate code

Amazon Q CLI quickly generated the full game logic.

It then asked:

“Do you want to create the file and run it?”

I simply pressed Y to accept each action.
And just like that — the game was ready!

🚀 4. Running the Game

I saved the game as python3 fruit_catcher.py and ran it using:

The game loaded perfectly. I could move the basket and try catching falling apples!

i can see in output screen some code is changed lets try to change it

press y for this action

now i can see all changes done just press y for this action

🔧 5. AI-Powered Optimization

Initially:

  • The basket moved too slowly

  • The apples fell too quickly

So I asked Amazon Q CLI to optimize the speed. It analyzed the code and suggested changes.

Again, I pressed Y to accept:

“Do you want to apply these code changes?”

Finally i recieved a better optimistic code

to run this simply run python file

python3 fruit_catcher.py

.


🧠 Key Learnings

🔑 Why I Chose This Game

I wanted something quick, visual, and fun — and this classic fruit-catching game fit perfectly.

🧠 Prompting Techniques

Clear, descriptive prompts gave better results. For example, explicitly stating "use arrow keys to control the basket" ensured correct input handling.

🤖 How AI Solved Programming Challenges

Amazon Q handled:

  • Object collision logic

  • Real-time score/life display

  • Game Over state transitions
    — all without me having to write code from scratch.

⚙️ Development Automation

From generating boilerplate code to refactoring logic and fixing gameplay speed — Amazon Q CLI saved tons of time.

0
Subscribe to my newsletter

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

Written by

Harish Narnaware
Harish Narnaware

I am here for giving wonderful knowledge to society