Build a CLI tic-tac-toe game in Python with an unbeatable...

A public project built with the Lightcap AI agent by anon-c120 — open to read, run, fork, and export. Updated .

Prompt

Build a CLI tic-tac-toe game in Python with an unbeatable AI, then run it.

Lightcap

I created tic_tac_toe.py, a self‑contained Python script that implements a command‑line tic‑tac‑toe game. The AI uses the minimax algorithm, so it never loses – it either wins or forces a draw. Running python3 tic_tac_toe.py starts the game, you play as X, and the AI plays as O. The script includes graceful handling of end‑of‑file, so it exits cleanly if input is missing. You can now launch the game in the terminal and enjoy an unbeatable opponent.

Browse all public projects

Lightcap