7
Back to Problem Dungeon

Tic-Tac-Toe

easy

Step 1: Requirements

Requirements

Questions to ask the interviewer

  1. Is this a 3×3 board only, or should it support N×N?
  2. Is it always 2 players, or could there be more?
  3. Are players always human, or could one be a computer (AI)?
  4. Do we need to persist game history or just play one game at a time?
  5. 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)

1 / 7 — Requirements