This project is a basic Tic-Tac-Toe game developed in Java. It provides a graphical user interface for one player to play the game vs computer.
- Simple and intuitive GUI.
- One-player mode.
- Basic game logic for Tic-Tac-Toe.
JavaMinMax Algorithm
- Clone the repository:
git clone https://github.com/gamalahmedd/TicToe-Game.git
- Open the project in NetBeans 8.2 IDE
- In the first step, the algorithm generates the entire game-tree and apply the utility function to get the utility values for the terminal states. In the below tree diagram, let's take A is the initial state of the tree. Suppose maximizer takes first turn which has worst-case initial value =- infinity, and minimizer will take next turn which has worst-case initial value = +infinity.
- Now, first we find the utilities value for the Maximizer, its initial value is -∞, so we will compare each value in terminal state with initial value of Maximizer and determines the higher nodes values. It will find the maximum among the all.
- For node D max(-1,- -∞) => max(-1,4)= 4
- For Node E max(2, -∞) => max(2, 6)= 6
- For Node F max(-3, -∞) => max(-3,-5) = -3
- For node G max(0, -∞) = max(0, 7) = 7
- In the next step, it's a turn for minimizer, so it will compare all nodes value with +∞, and will find the 3rd layer node values.
- For node B= min(4,6) = 4
- For node C= min (-3, 7) = -3
- Now it's a turn for Maximizer, and it will again choose the maximum of all nodes value and find the maximum value for the root node. In this game tree, there are only 4 layers, hence we reach immediately to the root node, but in real games, there will be more than 4 layers.
- For node A max(4, -3)= 4
- Run the
Mainclass located in thesrcdirectory. - The game window will appear, and you can start playing.
This project is licensed under the Mozilla Public License 2.0. See the LICENSE file for details.





