metadata
license: mit
version: 1.0.0
language:
- en
pretty_name: Tic-Tac-Toe Distinct Legal Move Dataset
size_categories:
- 1M<n<10M
tags:
- tic-tac-toe
- board-games
- game-dataset
- ai
- ml
- reinforcement-learning
- supervised-learning
- q-learning
- minimax
- explainable-ai
- symmetry
- dataset-generation
- python
- educational
task_categories:
- reinforcement-learning
- tabular-classification
- tabular-regression
- other
๐ง Tic-Tac-Toe Distinct Legal Move Dataset
๐ Overview
This dataset contains all possible legal Tic-Tac-Toe game sequences โ that is, every unique path through the complete game tree (about 255,168 distinct sequences) from start to finish.
Each row represents one move in one possible game, with metadata like:
- Which player made the move
- The board state before the move
- The move position
- The final game result (Win/Loss/Draw)
- A
symmetry_idthat groups equivalent boards under rotations and reflections
This dataset can be used for machine learning experiments, game theory analysis, or reinforcement learning training.
๐งฉ Dataset Structure
| Column | Description |
|---|---|
game_id |
Unique identifier for each full game sequence |
step |
Step number within the game (1โ9) |
player |
X or O โ the player who made the move |
board_state |
The board represented as a 9-element list (1 = X, -1 = O, 0 = Empty) |
next_move |
The index (0โ8) of the next move in the flattened 3ร3 grid |
result |
The final outcome of the game (X Win, O Win, or Draw) |
board_state_str |
Human-readable board string (e.g., X,_,_,O,_,_,_,_,_) |
symmetry_id |
A hash of the canonical form of the board after accounting for rotations/reflections |
๐ Example
| game_id | step | player | board_state | next_move | result | board_state_str | symmetry_id |
|---|---|---|---|---|---|---|---|
| 1 | 1 | X | [0,0,0,0,0,0,0,0,0] |
0 | X Win | _,_,_,_,_,_,_,_,_ |
812347823 |
| 1 | 2 | O | [1,0,0,0,0,0,0,0,0] |
4 | X Win | X,_,_,_,_,_,_,_,_ |
982734987 |
| 1 | 3 | X | [1,0,0,0,-1,0,0,0,0] |
8 | X Win | X,_,_,_,O,_,_,_,_ |
123459812 |
๐งฎ Data Generation Logic
The dataset was programmatically generated by exploring the complete Tic-Tac-Toe game tree using recursive backtracking in Python.
Key features:
- Symmetry normalization: Boards that are identical under rotation/reflection are reduced to a single canonical form.
- Comprehensive coverage: Every legal sequence is included.
- Direct serialization: Each move is written as a CSV row for efficient analysis.