https://github.com/oslint/tick-tack-toe-java
🎮 This is a simple Tic-Tac-Toe game implemented in the console using vanilla java.
https://github.com/oslint/tick-tack-toe-java
begginer-friendly begginer-project begginersguide java tik-tac-toe
Last synced: 4 months ago
JSON representation
🎮 This is a simple Tic-Tac-Toe game implemented in the console using vanilla java.
- Host: GitHub
- URL: https://github.com/oslint/tick-tack-toe-java
- Owner: OsLint
- Created: 2023-04-30T10:50:11.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-06-15T19:01:04.000Z (almost 2 years ago)
- Last Synced: 2024-12-05T23:09:40.312Z (6 months ago)
- Topics: begginer-friendly, begginer-project, begginersguide, java, tik-tac-toe
- Language: Java
- Homepage:
- Size: 7.81 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Tic-Tac-Toe in Console
🎮 This is a simple Tic-Tac-Toe game implemented in the console.
## Author
👤 Oskar Kalbarczyk
🌐 GitHub: [https://github.com/oskalbarczyk](https://github.com/oskalbarczyk)
📺 YouTube Channel: [Code with Oskar](https://www.youtube.com/@codewithoskar)
## How to Play
1. Run the program.
2. The game will display a 3x3 grid representing the Tic-Tac-Toe board.
3. The first player is always 'O', and the second player is 'X'.
4. The players take turns to choose a field they want to cover.
5. When prompted, enter the number of the field you want to choose (1-9).
6. The game will validate the move and update the board accordingly.
7. The game will continue until a player wins or the board is full.
8. The game will display "Game Over!" when it ends.## Gameplay
The game uses the numbers 1-9 to represent the fields on the board. The grid is displayed as follows:
|1|2|3|
|4|5|6|
|7|8|9|When it's your turn, select the field number you want to cover. For example, if you want to cover the top-right corner, enter '3'.
## Winning Conditions
The game checks for the following winning conditions:
- Rows: If a player covers all fields in a row, they win.
- Columns: If a player covers all fields in a column, they win.
- Diagonals: If a player covers all fields in a diagonal, they win.## Building the Project
To compile and run the project, ensure you have Java installed on your system. Then follow these steps:
1. Save the code into a file named `Main.java`.
2. Open a command prompt or terminal window.
3. Navigate to the directory where you saved the file.
4. Compile the code by running the command: `javac Main.java`
5. Run the program using the command: `java Main`Enjoy playing Tic-Tac-Toe in the console! 🎉