C
C copied to clipboard
Update tic_tac_toe.c
Description of Change
The input validation in placex() and placey() now uses a loop that continuously prompts for valid input until a valid move is made, preventing infinite loops.
The checkwin() function has been rewritten such that it eliminates repetitive code. It uses an array to define win conditions, making the logic cleaner and easier to maintain.
References
Checklist
- [x] Added description of change
- [x] Added file name matches File name guidelines
- [ ] Added tests and example, test must pass
- [x] Relevant documentation/comments is changed or added
- [x] PR title follows semantic commit guidelines
- [x] Search previous suggestions before making a new one, as yours may be a duplicate.
- [x] I acknowledge that all my contributions will be made under the project's license.
Notes: