Design tic-tac-toe
easy 70 minModel a game everybody knows: marks on a grid, turns, a full line wins.
Watch lesson4:32
Deep dives
Compare the options before you open them, then say which you would pick.
Dig
Where they go next, and your first sentence
| They ask | First sentence | Full page |
|---|---|---|
| Faster win check? | A move touches four lines, so I count. | Win in O(1) |
| Redo, sharing a game? | The list of moves is the truth. | Undo and replay |
| A computer? | 5,478 positions: I can know them all. | Computer player |
| Many games? | One lock for each game, a short one for the list. | Many games |
| New rules? | Let me name the class that changes. | New rules |
| k in a row? | Counting forgets where, so I walk from the last move. | Four in a row |
Numbers
Five to have ready
| What | Number |
|---|---|
| Ways to fill the board in order (9!) | 362,880 |
| Games | 255,168 |
| of them won by X, by O, drawn | 131,184, 77,904, 46,080 |
| Positions that can be reached | 5,478 |
| Positions, turned and mirrored ones as one | 765 |