[PR #1412] [CLOSED] fix: tic_tac_toe: Both player are filling choice at different time on… #2006

Closed
opened 2026-01-29 15:27:24 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/TheAlgorithms/C/pull/1412
Author: @ashvin-parmar
Created: 9/7/2024
Status: Closed

Base: masterHead: tic_tac_toe


📝 Commits (1)

  • ec69aa0 fix: tic_tac_toe: Both player are filling choice at different time one by one

📊 Changes

1 file changed (+17 additions, -15 deletions)

View changed files

📝 games/tic_tac_toe.c (+17 -15)

📄 Description

…e by one

problem

Previously/Problem : There are 2 player playing but tic_tac_toe game but preferences for choice filling for 'o' and 'x' are filled at same time, which cause a bug in which same 'x' value are filled 2 times.
Which need to be improved and also at one time only one player can fill thier choice, that why i resolve this problem.

solution

Solution: I used conditional statement in which value of 'x' which are used for first player choice applied when (instance_for_loop%2==0) or else part for other player. on each round thier is checking for any player for win the match or draw and in a manner such that once player data is not assigned to other one.

Description of Change

References

Checklist

  • Added description of change
  • Added file name matches File name guidelines
  • Added tests and example, test must pass
  • Relevant documentation/comments is changed or added
  • PR title follows semantic commit guidelines
  • Search previous suggestions before making a new one, as yours may be a duplicate.
  • I acknowledge that all my contributions will be made under the project's license.

Notes:
Both player are filling choice at different time one by one


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/TheAlgorithms/C/pull/1412 **Author:** [@ashvin-parmar](https://github.com/ashvin-parmar) **Created:** 9/7/2024 **Status:** ❌ Closed **Base:** `master` ← **Head:** `tic_tac_toe` --- ### 📝 Commits (1) - [`ec69aa0`](https://github.com/TheAlgorithms/C/commit/ec69aa02038a38d5bd284955d0bb079b2e945524) fix: tic_tac_toe: Both player are filling choice at different time one by one ### 📊 Changes **1 file changed** (+17 additions, -15 deletions) <details> <summary>View changed files</summary> 📝 `games/tic_tac_toe.c` (+17 -15) </details> ### 📄 Description …e by one ![problem](https://github.com/user-attachments/assets/b63b3d8d-dd41-4ff1-8a64-7b69a80c3de3) Previously/Problem : There are 2 player playing but tic_tac_toe game but preferences for choice filling for 'o' and 'x' are filled at same time, which cause a bug in which same 'x' value are filled 2 times. Which need to be improved and also at one time only one player can fill thier choice, that why i resolve this problem. ![solution](https://github.com/user-attachments/assets/d3c4cb6e-026b-4601-b51b-ae084480bcf8) Solution: I used conditional statement in which value of 'x' which are used for first player choice applied when (instance_for_loop%2==0) or else part for other player. on each round thier is checking for any player for win the match or draw and in a manner such that once player data is not assigned to other one. #### Description of Change <!-- Thank you for your Pull Request. Please provide a description above and review the requirements below. Contributors guide: https://github.com/TheAlgorithms/C/blob/master/CONTRIBUTING.md --> #### References <!-- Add any reference to previous pull-request or issue --> #### Checklist <!-- Remove items that do not apply. For completed items, change [ ] to [x]. --> - [x] Added description of change - [x] Added file name matches [File name guidelines](https://github.com/TheAlgorithms/C/blob/master/CONTRIBUTING.md#File-Name-guidelines) - [x] Added tests and example, test must pass - [x] Relevant documentation/comments is changed or added - [x] PR title follows semantic [commit guidelines](https://github.com/TheAlgorithms/C/blob/master/CONTRIBUTING.md#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: <!-- Please add a one-line description for developers or pull request viewers --> Both player are filling choice at different time one by one --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 15:27:24 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/C#2006