check if the game is over #1

Closed
opened 2026-04-22 13:19:32 +00:00 by Jannis · 3 comments
Owner

plan is to implement a game struct which has a bool child called "running" and a string child called "winner". when the checkforWin function finds out that the game indeed ended it should put "running" to false and "winner" to either "X", "O" or "-" when no winner exists.

plan is to implement a game struct which has a bool child called "running" and a string child called "winner". when the checkforWin function finds out that the game indeed ended it should put "running" to false and "winner" to either "X", "O" or "-" when no winner exists.
Jannis self-assigned this 2026-04-22 13:19:39 +00:00
Author
Owner

should be a thing of 20 minutes. the hard-ish part is checking if the game is over on an diagonal base or if no winner could be found. i think modulo math could be involved but im not sure. simply force checking would take long

should be a thing of 20 minutes. the hard-ish part is checking if the game is over on an diagonal base or if no winner could be found. i think modulo math could be involved but im not sure. simply force checking would take long
Author
Owner

AI answer: Force‑checking every square against every other square to see whether any three form a winning line in tic‑tac‑toe runs in O(n⁴) time and O(1) extra space (or O(n²) if you store the board explicitly).

AI answer: Force‑checking every square against every other square to see whether any three form a winning line in tic‑tac‑toe runs in O(n⁴) time and O(1) extra space (or O(n²) if you store the board explicitly).
Author
Owner

Implemented check

Implemented check
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Berufsschule/tictactoe#1