>> ZAMYLA CHAN: To win the game of 15, the tiles have to be
in a specific order.
And the one function checks whether the game is won.
It returns true if the game is won and the tiles are in the correct order,
and false otherwise.
>> So to win the game of 15, tiles have to be in increasing order, with the
blank tile at the bottom right corner.
So how do you check whether the user has moved the board into the right
orientation?
Well, you'll iterate over the board and check the values to make sure that
they're in the right place.
To do this, you could use nested for loops just like you did
in Draw and in Init.
>> There are a couple of ways to check and validate whether the board is
correct in a winning though.
If you go from left to right, starting from the top row down, then every
number must be greater than the previous one.
Be careful about what value you've chosen for your blank tile, though.
>> Or you could use a counter variable to ensure that each value is in place if
you come up with some sort of formula to represent this.
So have fun experimenting with the math.
Once you come up with a way, return true once the user has won the game.
>> But if any value is incorrect, return false.
The user has to continue moving, because they haven't won the game yet.
Once you implement this check, and along with initialize, draw, and move,
you've finish the game of 15.
Congratulations, and have fun playing.
My name is Zamyla, and this is CS50.
>> [MUSIC PLAYING]