Tic Tac Toe Game

Kotlin Android Studio

✏️ Description

Tic Tac Toe is a two-player game in which the objective is to take turns and mark the correct spaces in a 3×3 (or larger) grid.

The player always starts the game. After the player’s move, the computer randomly selects a place to move from the remaining free cells. There are 9 buttons (3 lengthwise and 3 widthwise), each of them is assigned a number (e.g. button1 from the top left is button1, then button2, button3…button9). When the game starts, after pressing any field, the ” ❌” sign will appear and the background will change to pink and purple. You will immediately see the computer move (” ⭕️” on an orange background). After the movement of the computer is our movement again.

? Rules

?? The game is played on a 3×3 board ?? You are ❌ (the cross), the computer is ⭕️ (the circle). ?? Players take turns placing their characters in the empty squares. ?? The first player to place 3 of his characters in a row (up, down, across or diagonally) is the winner. ?? The players take turns placing their signs in the empty squares. ?? When all 9 squares are filled, the game is over. If no player has 3 characters in a row, the game ends in a draw.

? Game Flow

1️⃣. The board before the game starts

The board before the game starts

2️⃣. The player always makes the move first

In this case player puts a cross in the middle of the board, and the computer automatically after him puts a circle in a random place (from the remaining free spaces), in this case in the middle of the the bottom row.

The board after you make the first move

3️⃣. In case the computer wins the Winner dialog box is displayed, dialog box, which informs us that the computer won the game. After pressing the OK button, the application will close.

The board before the game starts

4️⃣. If the player wins, the Winner dialog box is displayed, which informs us that we have won the game. After pressing the OK button, the application will close.

The board before the game starts

GitHub

View Github