Skip to content

Jitendra1mp4/tic-tac-toe

Repository files navigation

Tic-Tac-Toe Game

This is a simple Java-based implementation of the Tic-Tac-Toe game, designed to play with AI. Game declares a winner or a draw at the end.

  • Win against computer in simple Tic-Tac-Toe.
  • Play Tic-Tac-Toe with AI
  • Console-based interface

How to Run

  1. Download latest package tictactoe-*-SNAPSHOT.jar file from release [https://github.com/Jitendra1mp4/tic-tac-toe/releases]

  2. run jar file with java -jar tictactoe-*-SNAPSHOT.jar (make sure you have java version 11 or higher)

How to Play

  1. To be first player press 1 otherwise 0.

  2. The game board is represented as a 3x3 grid, with positions numbered 1 to 9:

        1 | 2 | 3
        ---------
        4 | 5 | 6
        ---------
        7 | 8 | 9
    
  3. On your turn, select an empty position by entering the corresponding number (1–9).

  4. For example if you enter 4 game will look like this :

    
        -   -   - 
    
        X   -   - 
    
        -   -   - 
    
    
  5. The game will check for a winner or a draw after each turn. Continue until the game ends.

License

This project is open-source and available under the MIT License.