Files
tictactoe/main.cpp
Jannis Heydemann ef4f2d2cbf Refactor win-check to O(1) counter-based approach, scalable to any NxN
- Win detection now uses per-player row/col/diagonal counters instead of
  scanning lines; O(1) per move and works for any board size (change N)
- Moved spielfeld into gameState as board[N][N]; removed global
- Replaced recursive getUserInput with a loop to avoid stack overflow
  on repeated bad input; also handles non-integer cin failures
- Initialized gameState::winner to ' ' to avoid undefined behaviour
- Fixed draw output: prints "Unentschieden!" instead of "Der Gewinner ist: -"
- Removed stale TODO comment that incorrectly claimed draw detection was broken

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 13:11:08 +02:00

3.3 KiB