Duration
2 min
Access
Free
Transcript
Available

Tic-tac-toe, like many grid-based games, relies upon a 2-dimensional array data structure to hold the state of our grid.

A grid is a matrix. The outer array contains all the rows, and each row is an array of columns. Often each column value is referred to as a cell. In tic-tac-toe, we create a 3x3 grid of null values that will be replaced with Xs and Os as the user interacts with the game.