| {{ row.label }} | {{ row.value }} |
| # | Player | Cell | Copy |
|---|---|---|---|
| {{ i + 1 }} | {{ m.mark }} | {{ cellName(m.index) }} |
Tic tac toe is a classic three by three grid game where two players place X and O and the first to complete three in a row wins. It supports quick practice, quick matches, and clear review so you can spot patterns and simple traps.
You can play against a computer that replies instantly or share the same screen for two player. Choose X or O before play begins, then watch the turn indicator, the move count, and the result as a win or a draw when the board is full. A concise move list helps you see how the finish formed.
Each marked square shows its move number so the sequence is easy to follow later. You can undo the last step to try a different idea, then reset for a fresh start. A compact state string lets you reproduce the exact position for study or sharing.
Try a center start and build a fork, or practice solid replies when you go second. Short sessions work well so you can compare attempts over time and notice steady improvement.
A quick note on interpretation. A valid finish confirms a legal line only, not who blundered first, so treat single games as small samples and look for repeatable ideas.
The game state records nine cell values from a three by three board, using two marks, X and O, and empty cells. An evaluation pass checks for a completed line and reports a win or a draw when all cells are filled without a line.
Computation tests the eight winning lines that cover all rows, columns, and diagonals. When a line holds three identical non‑empty marks the game ends, the winning cells are highlighted, and a summary reflects the outcome.
For computer play the move chooser explores possible replies and scores terminal positions from the computer point of view as win, loss, or draw. The selected move maximizes the best reachable outcome, so identical positions always produce the same reply.
Read results as position quality rather than player quality. Perfect play drives many starts to a draw, and single wins or losses can hinge on one missed block. Compare sequences across several runs for a fair picture.
| Symbol | Meaning | Unit/Datatype | Source |
|---|---|---|---|
b[i] |
Board cell at index 0 to 8 | '' | 'X' | 'O' | Input/derived |
WIN_LINES |
Winning triplets over rows, columns, diagonals | int[8][3] | Constant |
currentPlayer |
Side to move | 'X' | 'O' | Derived |
winner |
Winner mark when a line forms | null | 'X' | 'O' | Derived |
isDraw |
True when board filled without a line | boolean | Derived |
history |
Ordered moves played | array of {index, mark} | Derived |
Start with an empty board. X plays center. O plays a corner. X plays an edge that creates two threats. The evaluation finds that X can complete a line on the next move unless O blocks. If O fails to block, three in a row forms and the winner is X, with the three winning cells highlighted.
Move numbers on the squares show the exact sequence that led to the finish.
| Parameter | Meaning | Unit/Datatype | Typical Range | Sensitivity | Notes |
|---|---|---|---|---|---|
| Opponent | Computer or second human | string | ai, human | High | Locked after first move to keep results consistent. |
| Play As | Chosen side | string | X, O | High | If O is chosen, the computer may open as X. |
| Moves state | Compact board encoding | string | 9 characters | Medium | Length must be nine; unexpected symbols are treated as occupied cells. |
| Field | Type | Min | Max | Step/Pattern | Error Text | Placeholder |
|---|---|---|---|---|---|---|
| Opponent | select | — | — | ai | human | — | — |
| Play As | select | — | — | X | O | — | — |
| Moves state | string | 9 | 9 | Length check only | — | — |
| Input | Accepted Families | Output | Encoding/Precision | Rounding |
|---|---|---|---|---|
| Board clicks | Pointer/touch | Marks, move numbers | Discrete cells | Exact |
| Stats copy/download | CSV | Metric rows and move log | Plain text | Exact |
| State copy/download | JSON | Params, board, result, history | Pretty‑printed | Exact |
Networking & storage: Processing happens on your device and no game data is transmitted or stored on a server. Copy and download actions use your device clipboard and file save dialog.
Performance & complexity: The search runs on at most nine empty cells, so exploration is fast. In worst cases the branching factor is small and depth is limited by remaining moves.
Diagnostics & determinism: Identical positions with the same side to move produce identical replies. The result panel summarizes status and the winning line.
Privacy & compliance: No data is transmitted or stored server‑side. Clipboard and file saves occur locally on your device.
Tic tac toe positions, outcomes, and move history are captured as you play and can be reviewed or shared.
Choose computer, play as X, open center, then build a fork on move three. If the reply misses the block, a line forms on your next move.
Pro tip: when practicing defense, choose O so you can learn strong replies to a center start.
No. Moves, stats, and copies are handled on your device only. Nothing is sent to a server or kept beyond your own saves.
Clipboard and file downloads require permission from your device.It searches positions and selects moves that maximize the best reachable outcome. With careful play many games end in a draw.
You can copy or download a CSV of metrics and the move log, and a JSON snapshot with parameters, board, result, and history.
No. Side selection locks after the first move so results remain consistent and accidental changes do not alter a live position.
Copy the state from the JSON tab or use the compact state string. Opening with the same settings reproduces the board exactly.
It shows both sides avoided immediate threats. Compare several runs to learn which moves reliably prevent forks and hidden lines.
Yes. The logic runs locally. Copy and download features depend on your device capabilities and permissions.
No licensing notice is shown in the interface. Use it at your discretion and check the host’s terms if needed.
Fair play note: the computer uses deterministic search and does not introduce randomness or delays.