Tic-tac-toe with Rebecca

I have been teaching Rebecca some programming with a game she already knows: tic-tac-toe. We built this one together in App Lab. Knowing the rules is the easy part. Getting the computer to follow all of them gives us something fun to figure out together.

I wanted to practice keeping track of whose turn it is, checking whether a square is empty, and deciding when the game is over. We wrote out the winning rows, columns, and diagonals, then checked for a tie. A click is easy. Remembering what all the previous clicks mean is where it gets interesting.

Rebecca's tic-tac-toe board with a game in progress.

Try Rebeccca's Tic-Tac-Toe on Code.org.