Skip to content

๐ŸŽฎ This is a simple Tic-Tac-Toe game implemented in the console using vanilla java.

Notifications You must be signed in to change notification settings

okdotdev/tick-tack-toe-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

7 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

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

๐Ÿ“บ YouTube Channel: Code with Oskar

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! ๐ŸŽ‰

About

๐ŸŽฎ This is a simple Tic-Tac-Toe game implemented in the console using vanilla java.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages