Skip to content

Tic-Tac-Toe is a Windows desktop game with an unbeatable decision-making intelligent opponent algorithm with responsive UI and animations.

Notifications You must be signed in to change notification settings

Galamrani/TicTacToe

Repository files navigation

Tic Tac Toe Game

Welcome to the Tic Tac Toe Game! This .NET application features a responsive UI with smooth animations and unbeatable intelligent opponent.

Components

The project consists of the following classes:

  • ComputerPlayer: This class implements the unbeatable intelligent opponent algorithm for making the best move. It uses the minimax algorithm with alpha-beta pruning to determine the optimal move.

  • GameLogic: This class handles the game logic, including managing the game grid, current player, turns, and checking for a win or draw.

  • GameResult: This class represents the result of a game, including the game-winner and win information.

  • WinInfo: This class represents the information about a win, including the winning player and the type of win (row, column, main diagonal, or anti-diagonal).

  • Player: This enum represents the players in the game (X, O, or None).

  • App: This is the entry point of the application.

  • MainWindow: This is the main window of the application, where the game is played. It handles user interactions and displays the game grid.

Screenshots

Tic.Tac.Toe.2022-09-29.17-47-58.mp4

Computer Opponent Algorithm

The unbeatable computer opponent is powered by the minimax algorithm with alpha-beta pruning, incorporating dynamic programming for efficient decision-making. This algorithm explores all possible moves, assigns scores to each move, and ensures optimal decision-making. The depth parameter influences scoring, favoring moves that lead to victory in fewer turns.

MiniMax algorithm

The MiniMax algorithm employed in the game is pivotal for optimal decision-making in game theory. It guides the computer player to make strategic moves, blocking the user player when needed and seeking the fastest route to victory. For a deeper understanding of the MiniMax algorithm:
for a better understanding of the MiniMax algorithm use those links:  Article about MiniMax ,  Video about MiniMax

extra features :

  • Shortest route - A depth variable optimizes the game tree traversal, ensuring optimal play even if the user doesn't.

  • Alpha-Beta pruning - An optimization technique for MiniMax, significantly reducing computation time by cutting off unnecessary branches in the game tree.

About

Tic-Tac-Toe is a Windows desktop game with an unbeatable decision-making intelligent opponent algorithm with responsive UI and animations.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages