C icon indicating copy to clipboard operation
C copied to clipboard

Update tic_tac_toe.c

Open shrivalidutt opened this issue 1 year ago • 0 comments

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:

shrivalidutt avatar Oct 08 '24 21:10 shrivalidutt