AWS Logo
Menu
Creating Snake with Amazon Q

Creating Snake with Amazon Q

Slither, Snack, and Survive: Can You Master the Grid?

Published Jan 11, 2025

Inspiration

The nostalgia of classic arcade games inspired me to reimagine the beloved Snake game with modern visuals, responsive controls and adaptive difficulty. I aimed to create a basic yet challenging game for players of all ages.
Since I did not have a lot of experience creating games and deploying them, I approached Amazon Q with my idea and used it to help me.

Base Code

Amazon Q was able to give me some starter code for the app. All I had to do was give it my idea of the same as well as some requirements. At the start, I simply told it that I wanted to code out snake. It then gave me some code in Python using tkinter as the UI.
Initial prompt for game
However, this would not work since I wanted to deploy the game online! I thus told it to give me code for the game that could be deployed. It then proceeded to give me code written in HTML, CSS and JS.

Refining

Now that I had the base functionality complete, I proceeded to use Amazon Q to implement new features. I did not have to copy paste the code again, I simply told Amazon Q my new features and it gave me the code for them. Some features included
  • Buttons for mobile UI
  • Disabling of "Start New Game" button while game was ongoing
  • Beautifying of Game Over pop-up

Deployment

Since Amazon Q is a service provided by AWS, I thought that it would be able to teach me how to deploy my app on AWS! In my prompt, I added the additional criteria of being able to deploy the app cheaply!
Prompt for deploment
Unsurprisingly, it gave me the full walk-through in doing so.

Debugging

Along the way, I faced some issues that were a little strange to me. For example, my mobile-friendly arrow buttons were rendering wrongly on the S3 deployment.
Wrongly rendered arrow buttons
After some prompting, Amazon Q informed me that I had to change the encoding accordingly. Without Amazon Q, I would have spent at least 20 minutes debugging this but I managed to solve it in 3 minutes.

Conclusion

All in all, Amazon Q was incredibly effective in helping me code as a beginner game developer. I hope to be able to use it for even more impressive features when I have the time!
 

Comments