Step 1: Requirements
Requirements
Questions to ask the interviewer
- Is this a 3×3 board only, or should it support N×N?
- Is it always 2 players, or could there be more?
- Are players always human, or could one be a computer (AI)?
- Do we need to persist game history or just play one game at a time?
- Do we need undo/redo?
Functional requirements
- Two players take turns placing their mark (X or O) on a grid
- The game detects a win (row, column, or diagonal filled by one player) or a draw (board full, no winner)
- Players cannot place a mark on an already-occupied cell
- The game announces the result and allows restarting
Non-functional requirements
- Extensible to N×N board
- Pluggable player types (human, random AI, minimax AI)
- Clean separation so UI can be swapped (CLI, web, mobile)