# Square It!

## Square It!

Square It is a fun, simple online game created by the NRICH Maths Project in Cambridge, England, that’s all about – you guessed it – squares! Discover the range and variety of squares on an nxn board, and try to find a winning strategy that fools your opponent every time. Click HERE to play!

## Rules of the Game

The rules are pretty simple:

• Players takes turns – each player can choose one vertex on the graph per turn.
• The player who makes a square (with four of their moves) first, wins!
At the top of the board, you’ll see something that looks like this:

Either play against the computer by selecting 1-player (you always go first), or select 2-player to play with a friend. You can also use the up or down arrows to increase or decrease the size of the board.

Note: squares can be ANY size or orientation, as long as they satisfy the properties of a square (i.e. four equal-length sides at 90 degree angles). That means your square can even look like this:

Watch this Math Monday session with Javier Haro for more examples of how the game is played!

## Strategy

STARTING POINT

One way to strategize is to choose a good starting point. Ask yourself this: how many unique starting points are there on a 4×4 board? A 5×5? 6×6?

Let’s start with a 4×4, for simplicity’s sake. Look at the picture below, and pick a point within the black triangle. If you pick any same-colored point outside the triangle, you can make some sort of reflection or rotation of the board to get that point back to the one in the triangle. So, that color represents a distinct starting point.

Since we have 3 colors, we have 3 distinct starting points on our board. Let’s see how many squares we can get at each starting point – we’ll focus on the ones inside the black triangle. Here are the 3 possibilities for squares stemming from the red dot, or (row, column) = (1,1).

But that’s only 3 squares – we can do better. Let’s look at the possible squares stemming from the green dot at the point (2, 1). It seems like there will be more options there!

That’s 5 squares! Can we do even better?  Now, for the blue dot at (2,2):

That’s seven possible squares from the blue dot. I think we’ve found our winner! So, picking one of the four blue center points gives you the most options for possible squares including that point. More possible squares could mean a greater chance of winning!

On a 5×5 board, you can guess that starting with the middle would be the most advantageous move. In fact, you can make 12 squares with it! Then, you can choose one of the middle four dots on a 6×6 board (I counted around 17 possible squares), then the middle dot on a 7×7,  then one of the middle four for an 8×8, and so on for all bigger boards.

BEATING THE COMPUTER

In the 1-player mode of Square It, you play against computer generated moves (you always go first). I tried many times to beat the computer on a 4×4 board, but to no avail. Although forcing a draw is relatively simple, I’ve come to the conclusion that winning is quite impossible (but I’d be happy for someone to prove me wrong). So, I moved on to the 5×5 board to see if I’d have more luck there.

I won’t lie  – I got pretty frustrated with this problem at first. It seemed impossible to beat the computer! It anticipated almost all of my moves. Then, out of nowhere, I stumbled on an answer… and a strategy.

Each number represents a turn (I – blue – went first).

In order to understand the computer’s “brain,” think about it as if it’s always playing defensively.  Every time you make a move, the computer is trying to anticipate the possible squares you could make using your existing moves, then block you from being able to make at least one of those squares.

You can see that the computer first blocked me from getting a potential 1×1 square by playing on the diagonal after my first move. Then, it blocked me from getting a potential 2×2 square with my first and second moves (1, 2) by playing in the top lefthand corner. When I made my third move, the computer was smart to play directly next to mine – that way, it kept me from getting two 1×1 squares (with moves (1, 3) or (2, 3)) AND a diagonal square with moves (1, 2).

But I was smarter. By placing my 4th move next to my third in a “T” shape, I had already won. Now, I could either make a square with (1, 3, 4) or with (2, 3, 4). The computer could only make 1 move to stop me, so it could only block one of those possible squares.

So there you have it! A winning strategy. Aim to place 3 dots in a row where on at least one side, all of the adjacent dots on that side are empty. Then, make the “T” shape with your next move, and you can’t lose. Fortunately, this strategy gets even easier on bigger boards!

Unfortunately, it doesn’t always work out so nicely. Sometimes the computer blocks you from your initial attempt to get that “T” shape by placing dots somewhere on both sides of your line of 3. But that doesn’t mean it’s over! Since you start in the middle on a 5×5 board, you still have 3 ways to make that line of 3 and 6 other ways to make that “T” shape. If you keep plugging away with this strategy, you can almost always still win. Make sure you pay attention to where the computer plays so they don’t get a square before you!

This is only one strategy – there are so many more ways to go about this! Keep exploring to see how many you can find that give you a winning strategy every time.