Zum Inhalt springen

Code the Grid: Reimagining Tic-Tac-Toe with Just Chat Prompts ❌⭕⚡

💭 Remember those intense desk battles during free periods?

📝 Just a paper grid, two pens, and that one friend you had to beat in Tic-Tac-Toe.
⭕❌ Strategic chaos.
🔥 Instant rivalries.
🥇 Ultimate bragging rights.

👾 But what if I told you…
In 2025, I rebuilt that entire playground rivalry experience into a polished desktop game — and I didn’t write a single line of code from scratch.

💬 All I did was chat with Amazon Q CLI. That’s it.
No blank code editors.
No “Where do I start?” anxiety.
Just prompts → responses → magic. 🪄

⚡ No IDE boot-up.
🚫 No StackOverflow rabbit holes.
🎯 No „Hello World“ boilerplate.

🎮** What I Built**
Title: Tic-Tac-Toe Rebooted
Tech Stack: Python + Pygame
Generated by: Amazon Q CLI

🚀 Why Amazon Q CLI?
Amazon Q CLI is like having a senior game‑dev friend on standby. You describe what you want, it drafts the code, folder structure, even placeholder assets and many more, the way you want. That frees you – the developerv – to iterate, theme, and polish instead of wrestling with boilerplate

Features
✅ Clean and modern UI with a teal grid layout.
🎯 Mouse-based input for easy cell selection.
❌⭕ Image-based X and O icons for polished visuals.
🔁 Turn alternation logic between Player X and Player O.
🧠 Win and draw detection with automatic game-over handling.
🔊 Optional click sound effect using external audio file.
🔄 Restart button to reset the board instantly.
🐍 Built with Python 3.12 and Pygame for fast performance.

Prompts I Used
Build a Pygame-based game titled „Galactic Tic-Tac-Toe“ featuring a stunning space-themed background. All assets should be stored in an assets folder with images/ and sounds/ subdirectories. Use custom icons for Player X and Computer O (x_icon.png, o_icon.png) and a galactic background image. Include interaction sounds such as click.wav, hover.wav, win.wav, and lose.wav for various actions.

The game should include five states: MENU, PLAYING, RESULT, VICTORY, and DEFEAT. In the MENU state, show “Play Game” and “Quit” buttons with hover effects and play click sounds when selected. During the PLAYING state, show a stylized 3×3 grid and allow the player to click a cell to place their X icon with sound feedback. The computer responds after a short delay using a basic AI. Provide hover effects on empty cells and highlight the winning row/column/diagonal when a win condition is met.

Once a round ends, transition to the RESULT state, displaying “You Won!”, “Computer Wins!”, or “It’s a Draw!” with the respective sound effect. Provide buttons for “Play Again” and “Main Menu,” each with sound and visual feedback. Track how many rounds the player and computer win, and when either side reaches 3 wins, show a VICTORY or DEFEAT overlay. These should include options for “Next Match” and “Main Menu,” with celebratory or defeat-themed audio and visuals.

Amazon Q didn’t just generate the code. It created:

  • An organized folder structure
  • Pre-set assets folder
  • UI grid logic and input listeners
  • Fully working win-check function

A small tweak in my prompt like “use image assets for X and O” was enough to switch from default drawing to customized icons.
There were several areas where I expected bugs or complexity — but Amazon Q handled them surprisingly well:

  • Turn alternation logic:
    It automatically created a boolean switch to flip players after each valid move.
  • Grid state management:
    A 2D list (board[row][col]) was used, tracking each move accurately.
    -Win detection:
    The generated function checked all rows, columns, and diagonals for a match.
  • Draw logic:
    The board state was evaluated after each move to determine if no moves were left — an elegant one-liner I didn’t touch.

Final Output:

Home Page

Game

Final

Link of My project:Git Hub

Guide: Thanks to Subha Mondal Sir

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert