Lesson 5: Building the Game

This video will likely be best viewed in fullscreen mode.  It's about 13 minutes long.  You can download the resulting file below.

In this lesson, we build a lot of the game itself.  We stop users from using a square that's already occupied, and we tell the player when somebody's won the game.

Some thoughts:
  • If you added the function below to your code, how could you use it to change the winning row green?
function makeGreen(a, b, c) {
    document.getElementById("s" + a).style.backgroundColor = "green";
    document.getElementById("s" + b).style.backgroundColor = "green";
    document.getElementById("s" + c).style.backgroundColor = "green";

Timothy James,
Apr 24, 2014, 1:02 PM