DEV Community

Cover image for True or False Game by AmazonQ
Lodi
Lodi

Posted on

True or False Game by AmazonQ

I chose to develop a True or False game because it is a simple, accessible game suitable for all ages. The idea was to create a fast-paced quiz game where players answer random questions to test their general knowledge. Amazon Q, with its code generation and programming support capabilities, was the ideal tool to bring this idea to life. This game is not only fun but also a great way to explore the potential of AI in game development.

Effective Prompting Techniques
While working with Amazon Q, I realized that the way prompts are written plays a crucial role. Here are some effective techniques I discovered:

Specific and Clear: Instead of vague requests like "create a game," I wrote detailed prompts, for example: "Write Python code for a True or False game with 10 random questions, a console interface, and score tracking."
Provide Context: I described the goal, such as "The game must have a simple, user-friendly interface and save the highest score."
Step-by-Step Requests: When fixing bugs or optimizing, I broke down requests, like "Check for errors in the score calculation function and suggest fixes." These prompts helped Amazon Q understand the requirements and generate more accurate code.
AI Handling Programming Challenges
Developing the True or False game came with its share of programming challenges, and Amazon Q handled them impressively:

Game Logic Management: Amazon Q automatically generated code to manage the game flow, such as displaying random questions, checking answers, and updating the score.
Development Automation That Saved Time
Amazon Q significantly saved time through automation:

Generating Question Lists: Instead of manually writing 50 questions, I asked Amazon Q to create a JSON file containing questions and answers. With a single prompt, I got a diverse question list.
Creating Console Interface: Amazon Q automatically built a simple console interface with messages and a scoreboard.
Testing and Debugging: Amazon Q detected syntax and logic errors in the code, providing instant fix suggestions, which reduced debugging time.

Link Demo Video:
https://drive.google.com/file/d/1TYKfy4xulGLweMHWjCc33FwxAgz1Afd3/view?usp=sharing

Link Github:
https://github.com/lodi-bui/TrueFalseGame_AmazonQ

Top comments (0)