What Is Tic Tac Toe?
What Is Tic Tac Toe?
Tic Tac Toe, also popularly known as X and 0’s is a two-player game. Generally, there is a 3 X 3
grid, in which players take turns to mark the spaces with their respective symbol i.e. ‘X’ or ‘0’.
The player that succeeds in placing three of their makes either in horizontal, vertical or in a
diagonal row, wins.
If all nine squares are filled and none of the players have three in a row, the game is a draw.
Follow these steps to create a Tic Tac Toe program in java. Today, we will create a simple Tic
Tac Toe program, without any GUI and can be played by two players. Please note that both the
players must be human.
The very first step of creating our Tic Tac Toe game is to make a new project. Open your IDE (I
am using NetBeans) and create a new Java Project by the name TicTacToe. Inside our project, we
will create three Model package Model, View and Controller. It contain classes
GameController.java, Enemy.java, Player.java, Players.java, Screen.java. The Screen.java class
will contain the main() method and will be used to run the code in Screen.java. The other class
which will contain an object that will have the state of the board and methods to manipulate the
game.
1. Adding GUI:
This game will be more interactive if GUI is added to it, the symbols can be added to the by
just clicking on the matrices, which would be buttons if GUI is used.
3. User scores
Both computer and humann’s score are displyed for multiple time .