Design Tic-Tac-Toe
Problem Statement
Design and implement the core logic for a Tic-Tac-Toe game that allows two players to play on a N × N grid (commonly 3 × 3).
The design should handle game state management, move validation, and win/draw detection.
🧠 Functional Requirements
Initialize Game
Make a Move
Check Game Status
Display Board
Restart / Reset
🚫 Non-Functional Requirements
🧱 Suggested Classes
ClassResponsibility
Game
Main class that controls the game flow, player turns, and win detection.
Board
Manages grid state, cell updates, and validation logic.
Player
Represents a player with name and symbol (X/O).
Cell
Represents each cell on the board with coordinates and value.
GameStatus (Enum)
Enum for IN_PROGRESS, WIN, DRAW.
🔄 Example Flow
1
2game = new Game(3)1
2Player 1 (X) → move(0,0)
3Player 2 (O) → move(0,1)
4Player 1 (X) → move(1,1)
5Player 2 (O) → move(0,2)
6Player 1 (X) → move(2,2)🧪 Example Input / Output
Input:
1
2Board Size = 3
3Moves:
4X 0 0
5O 0 1
6X 1 1
7O 0 2
8X 2 2Output:
1
2Player X wins!
3Final Board:
4X O O
5_ X _
6_ _ X⚙️ Constraints
🎯 Goals
✅ In short:
Design the classes, interactions, and logic for a Tic-Tac-Toe game supporting configurable board size, turn management, and efficient win detection.