A simple tic-tac-toe game implemented in Java.
Three gameplay options:
- Basic: classic tic-tac-toe for two players.
- Advanced: tic-tac-toe for two players with additional features.
- CPU: play against the computer with an option for both single and two-player modes.
Ensure you have the following installed:
- Java Development Kit (JDK)
- Clone this repository to your local machine
git clone https://github.com/DanielVegetto/tic-tac-toe.git
- Navigate to the source directory inside the project directory
cd tic-tac-toe/src
- Compile the Java files
javac *.java
- Run the game
java TicTacToe
- The game board is a 3x3 grid.
- Players take turns to place their marks on the board.
- The first player to get three of their symbols in a row (horizontally, vertically, or diagonally) wins the game.
- Rows and columns are numbered from 1 to 3.
- Enter the position in the format
(x,y)
wherex
is the row number andy
is the column number. - Example: to place a symbol in the first row and first column, enter
(1,1)
. - The input must not contain any spaces; otherwise, the program will prompt the player to re-enter the position.
- Advanced Option: players can enter their names and choose the mark they want to play with from a list of possible symbols.
- CPU Option: play against the computer.
- In 1-player mode, the player can enter their name and choose their mark as in the advanced option.
- In 2-player mode, the game defaults to the advanced option.
Alfonso Cecilia Martínez and Daniel Lozano Uceda