An open API service indexing awesome lists of open source software.

https://github.com/imwrdo/tic-tac-toe-java

Java implementation of tic-tac-toe game
https://github.com/imwrdo/tic-tac-toe-java

java java-core java-games

Last synced: 3 months ago
JSON representation

Java implementation of tic-tac-toe game

Awesome Lists containing this project

README

        

# Tic-Tac-Toe in Java

A command-line implementation of the classic Tic-Tac-Toe game written in Java.

## Features

- Two game modes:
- Human vs Human
- Human vs Computer
- Simple command-line interface
- Computer player with strategic moves
- Input validation
- Interactive game board display

## Requirements

- Java 23 or higher

## How to Play

1. Start the game and choose a game mode:
- 1 for Human vs Human
- 2 for Human vs Computer
- 3 to Exit

2. The board is numbered from 1 to 9:
```
1 | 2 | 3
------------
4 | 5 | 6
------------
7 | 8 | 9
```

3. Players take turns entering a number (1-9) to place their mark (X or O)
4. First player to get three in a row (horizontally, vertically, or diagonally) wins!

## Project Structure

- `Main.java`: Start point
- `Players/`: Player-related classes
- `GameLogic/`: Game logic-related classes

## Technical Details

- Built with Java 23
- Implements basic AI strategy for computer moves
- Object-oriented design with clear separation of concerns