To detect a draw, we need to check if all 9 cells are filled. We can use a loop instead of checking each cell manually.
For Loops:
Loops let you repeat code multiple times.
Syntax:for (uint i = 0; i < 9; i++) { ... }
This has three parts:
1. Start: uint i = 0 - Create variable i, set it to 0
2. Condition: i < 9 - Keep looping while i is less than 9
3. Increment: i++ - After each loop, add 1 to i
Example:
This loop runs 9 times. i will be 0, then 1, then 2... up to 8.
Create a function called isBoardFull that loops through all 9 cells. If any cell is Empty, return false. If the loop finishes, return true.