Learn by Building Workshop Skills GitHub Türkçe Workshop › Tic-tac-toe › Step 6 of 33
The board as a list What we are doing The picture is only the look. The game also has to remember what is in each of the 9 cells. We keep that in an
array of 9 strings: '' for empty, later 'X' or 'O'.
```js
let board = ['', '', '', '', '', '', '', '', '']
```What it means
[ ... ] is an array: a list in order, items separated by commas.
'' is an empty string: an empty cell. A filled cell will hold 'X' or 'O'.
Items are numbered from 0 : board[0] is the top-left cell, board[8] the bottom-right one.
let, because the board will change during the game.
Your turn Under const CELL = 100, leave an empty line and write the board line. Press Run .
Skills: Arrays and objects, Game states
← Finish the grid A function that draws →
All steps Get the canvas and the pen Paint the board The first grid line Repeat with a loop Finish the grid The board as a list A function that draws Write an X From cell number to position Draw what the board holds A color for each mark Make a move No playing on a taken cell Listen for clicks Which cell was clicked? Clicks on any screen size The eight winning lines Find three in a row Win, draw or go on The round ends Show who won Light up the winning line A function for a fresh round Click to play again A computer that picks a cell The computer answers Rule one: take the center Rule two: win when you can Rule three: block the opponent Score a finished game Look ahead: minimax A computer that never loses Build it yourself: keep score