Skip to content

Strategy (turn-based)

Turn-Based Strategy With a Competent AI Opponent

Tested with Google AI Studio · produced Cell Wars

The Prompt

Build a turn-based territory strategy game as one self-contained HTML file (inline JS, no libraries). Game: [describe rules precisely, e.g. "7x7 Ataxx-style board: click one of your cells to clone to an adjacent empty cell, or jump 2 cells (the source cell is emptied); all enemy neighbors of the destination convert to your color; board fills = game over; more cells wins"].

The AI opponent is the critical requirement:
- Implement opponent as a heuristic scoring function over every legal move: prefer moves that capture the most enemy cells, that increase total mobility (adjacent empty cells), and that avoid leaving a cell vulnerable to immediate recapture. Weight captures > mobility > safety.
- Evaluate ALL legal moves every turn (board is small); pick the best with a small random tie-break so games differ.
- Add a difficulty switch: Easy = random legal move, Normal = heuristic, Hard = heuristic + 1-ply lookahead that maximizes (my gain - your best reply gain).
- Move times must be under 100ms; no blocking the UI thread noticeably.

UI: click/tap to move; last-move highlight; simple animated capture flips; score bar; win/lose overlay with restart; difficulty selector on the start screen. 960x540 letterboxed, responsive, touch-first.

After the code, print the opponent evaluation function and explain each weight in one line.

What This Prompt Produces

Explicit heuristic weights ("captures > mobility > safety") are what make the AI stop playing randomly. Cell Wars was generated from this prompt on Gemini 3 in Google AI Studio.

Modification Tips

  • Give exact rules — strategy AI is only as good as the rule text you provide.
  • If the AI plays too defensively, follow up with: "Double the capture weight and re-test."
  • Ask for the evaluation function separately; you will want to hand-tune those weights after a few matches.
  • Swap "captures > mobility > safety" for actual weights (3 / 1 / 1) when you want a specific feel — Gemini 3 maps exact numbers onto the heuristic cleanly.

The Game This Prompt Produced

Want to try it? Open Google AI Studio, paste the prompt, and you'll have a playable game in minutes. When you're happy with the result, submit it to Daily AI Games.