Istrate Cristiana
Dragoș Șerban
AWC
Tic-Tac-Toe Android Program
1. Introduction
The Android application designed with Android Studio represents a
... [Show More] Tic-Tac-Toe game
which allows the user to choose whether to play with another user or with the computer. The
game consists, in the beginning, in an empty a 3x3 board that, as the game goes along, is filled
with Xs and 0s. The winner is the player that has filled 3 squares in a line (on the rows, columns
or on the diagonals) with the provided symbol, e.g. Xs or 0s.
Android Studio represents the integrated development environment (IDE) for the Android
operating system, built on JetBrains' IntelliJ IDEA software and designed precisely for Android
development.
In the beginning, a new emulated device for debugging was installed, namely the Nexus
5X. The next sections present the main components of the application.
2. Java classes description
This section presents the two classes created in java. Each class is in connection with the
XML files of layout in order to manage the tools like button, text view, pop-ups after an action
happens, etc. The main class is the MainMenuActivity.java, responsible for the first window of
the application. It presents the buttons, or intents, used for switching to the GameActivity.java
class and a button for exiting the application. The GameActivity.java class presents the actual
logic behind the gameplay. All the cases, namely the 1 vs 1, 1 vs computer, where the computer
starts, or when the user begins, when there are three straight X’s or 0’s on a line, column,
primary diagonal or secondary diagonal, or when there is a draw, have been taken into
consideration. The main idea of the application was using listeners for all the buttons and for all
the gameplays, basically for human interaction.
The codes for the MainMenuActivity.java and the GameActivity.java are presented in the
Annex.
3. Layout description
The layout of the application was developed by using the Extensible Markup Language
(XML), a language that defines a set of rules for encoding documents in a format that is both
human-readable and machine-readable. The two files used for the application’s layout were
activity_main_menu.xml and activity_game.xml. The first one represents the main page of the
application, as shown in Figure 1, which presents three buttons, two of which are for choosing
the mode of playing and one is for exiting the application. [Show Less]