Add Command-Line Tic-Tac-Toe Game with Two-Player Support#14
Open
Add Command-Line Tic-Tac-Toe Game with Two-Player Support#14
Conversation
Co-authored-by: Tom Zu <138054255+tomcat323@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR implements a fully functional command-line tic-tac-toe game that allows two players to play against each other. The game provides an interactive experience with clear instructions and proper game state management.
Features Implemented
Core Game Mechanics
User Experience
Technical Details
Implementation
tic_tac_toe.pyAdditional Changes
.gitignorefile to exclude Python build artifacts and IDE/OS specific filesHow to Use
Run the game from the command line:
Or if executable permissions are set:
Players will be prompted to enter positions (1-9) corresponding to the board layout:
Testing Considerations
The implementation includes:
Requirements Met
✅ Command-line tic-tac-toe game script created
✅ Two-player gameplay support
✅ 3x3 grid display with current board state
✅ Turn-based move input system
✅ Move validation for empty positions only
✅ Win condition checking (horizontal, vertical, diagonal)
✅ Draw condition detection
✅ Game result display
✅ Clear player instructions
✅ Command-line executable