Skip to content

Welcome to my first C# console application! This is a simple implementation of the classic Tic-Tac-Toe game, built as a beginner project to learn C# programming concepts.

Notifications You must be signed in to change notification settings

Saba-Burduli/Tic-Tac-Toe-C-Game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tic-Tac-Toe Console Game in C#


Welcome to my first C# console application! This is a simple implementation of the classic Tic-Tac-Toe game, built as a beginner project to learn C# programming concepts.


In this Paragraph im gonna talk about my first experience making Console Application using only c# and for editor and IDE Visual Studio 2022

So first let's talk about Visual studio 2022 Role, making Console Applications .. (why is this editor best Option for Begginers and why i choose)


  • Integrated Development Environment (IDE) with Beginner-Friendly Features
  • Seamless Integration with .NET Ecosystem
  • Extensive Learning Resources and Community Support

lets dive in this 3 reason deepily :

Integrated Development Environment (IDE) with Beginner-Friendly Features

Visual Studio 2022 provides a comprehensive and intuitive IDE that simplifies the coding process for beginners. It includes features like:

IntelliSense: Offers real-time code completion, syntax suggestions, and error detection, helping beginners write code more efficiently and learn proper syntax.

Debugging Tools: Built-in debugging tools make it easy to identify and fix errors, which is crucial for understanding how code works.

Templates and Wizards: Pre-built project templates and wizards help beginners get started quickly without worrying about setting up complex configurations.


🎮How to Play

  1. The game is played on a 3x3 grid.
  2. Two players take turns marking a space in the grid:

    Player 1 uses X.

    Player 2 uses O.

  3. The first player to get 3 of their marks in a row (horizontally, vertically, or diagonally) wins!
  4. If all spaces are filled and no player has won, the game ends in a draw.

✨Features

  • Interactive Gameplay:Players take turns entering their moves via the console.
  • Input Validation: The game ensures valid moves (e.g., no overwriting existing moves).
  • Win/Draw Detection: The game checks for a winner or a draw after every move.
  • Simple and Clean Code: Easy-to-understand logic for beginners.

🌐Code Structure

Here’s a brief overview of the code:

Main Components

  1. Game Board: Represented as a 3x3 array.
  2. Player Turns: Alternates between Player 1 (X) and Player 2 (O).
  3. Win/Draw Logic: Checks for winning conditions or a draw after each move.

💡Key Functions

  1. PrintBoard(): Displays the current state of the board.
  2. CheckForWin(): Determines if a player has won.
  3. CheckForDraw(): Checks if the game is a draw.
  4. PlayerMove(): Handles player input and updates the board.

📚What I Learned

  • Basic C# Syntax:strong> Variables, loops, conditionals, and functions.
  • Arrays: Using a 2D array to represent the game board.
  • Input Handling: Validating user input to ensure correct gameplay.
  • Problem Solving: Breaking down the game logic into smaller, manageable parts.

✨Future Improvements

  • 🔧Add a single-player modestrong> against an AI.
  • 🔧Improve the UI with colors or ASCII art.strong>
  • 🔧Add a score trackerstrong> for multiple rounds.


image image image

📥 If you want to learn more about This Project you can actually contact me on Mail : [email protected]

About

Welcome to my first C# console application! This is a simple implementation of the classic Tic-Tac-Toe game, built as a beginner project to learn C# programming concepts.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages