check if the game is over #1
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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.
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
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).
Implemented check