Puzzle 3 - The final test
Puzzle 3a
This puzzle will test your knowledge about variables. There is something strange with one of the player’s color on the board.
Find // PUZZLE 3a
in the MainActivity.kt
file and update the colorGreen
variable to show green colored pieces on the board.
Puzzle 3b
Why does Player 2 always win on the first move?! This doesn’t make any sense, solve puzzle 3b to fix the game.
Find // PUZZLE 3b
in the MainActivity.kt
file and update the winner
variable to ensure a player truly wins.
Final Puzzle
Now that Player 2 is no longer automatically winning the game and all the game pieces look good, there is still one last thing that is weird. Tic-Tac-Toe rules state that a player can win when the player has 3 pieces connected horizontally, vertically, or diagonally. The game works well for detection the horizontal and vertical wins, but something is wrong with the diagonal check.
Look for // FINAL PUZZLE
in the MainActivity.kt
file. Solve this puzzle to complete the game!
You did it!
Workshop complete