0% found this document useful (0 votes)
44 views11 pages

AI Ca1

The document discusses how AI solves the game of Tic Tac Toe. It explains that the Minimax algorithm is commonly used to determine the best move by exploring all possible future game states. The Minimax algorithm represents the game as a tree and recursively evaluates each position to find the optimal move. Alpha-Beta Pruning improves upon Minimax by pruning branches that do not affect the outcome. When implemented effectively, AI can play Tic Tac Toe perfectly or force a draw by considering all possibilities, whereas humans are more likely to make mistakes.

Uploaded by

Debasis Garai
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views11 pages

AI Ca1

The document discusses how AI solves the game of Tic Tac Toe. It explains that the Minimax algorithm is commonly used to determine the best move by exploring all possible future game states. The Minimax algorithm represents the game as a tree and recursively evaluates each position to find the optimal move. Alpha-Beta Pruning improves upon Minimax by pruning branches that do not affect the outcome. When implemented effectively, AI can play Tic Tac Toe perfectly or force a draw by considering all possibilities, whereas humans are more likely to make mistakes.

Uploaded by

Debasis Garai
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 11

NSHM KNOWLEDGE CAMPUS, DURGAPUR-

GOI (College Code: 273)


CA1 Assessment

TIC TAC TOE –problem solving method in AI

Presented By

Student Name: DEBASIS GARAI


University Roll No.: 27300121013
University Registration 212730100110040(2021-22)
No.:
Branch: Computer Science Engineering
Year: 3rd
Semester: 5th
Paper Name: Artificial Intelligence
Paper Code: PEC-IT-501
TABLE OF CONTENTS

 Introduction to tic tac toe


 Rules of the game
 How AI deals with the problem ?
 Minimax algorithm
 Alpha –Beta pruning
 AI vs Human Gameplay
 Challenges faced during implementation
 Conclusion
Introduction to Tic Tac Toe:

 Tic Tac Toe is a classic two-player pencil-and-paper game played on a 3x3 grid. The players take
turns placing their symbols (usually "X" for the first player and "O" for the second player) on an
empty cell in the grid.
 The objective of the game is to create a straight line of three of your symbols (horizontally,
vertically, or diagonally) before your opponent does.
 The first player to achieve this objective wins the game. If all cells are filled without either player
achieving a winning line, the game ends in a draw.
Rules of the Game:

1.The game is played on a 3x3 grid.


2.Two players take turns to play, one using "X" and the other using "O".

3.Players can place their symbols in any empty cell on the grid during their turn
4.The objective is to create a straight line of three of your symbols (horizontally, vertically, or
diagonally).

5.If a player succeeds in creating a winning line, they win the game.
6.If all cells are filled without any player achieving a winning line, the game ends in a draw.
How Can AI Solve the Tic Tac Toe
Problem?
:

In the context of Tic Tac Toe, AI algorithms aim to


determine the best move to make in a given game state
to maximize the chances of winning or achieving a draw.
Two common approaches for solving this problem are as
follows :

A. Minimax algorithm
B. Alpha-Beta Pruning(optimization of minimax )
MINIMAX
ALGORITHM:

How does it
work ?

 The Minimax algorithm is a decision-making algorithm 1.Tree Representation: The game state is represented as a tree, where each node
used in two-player, zero-sum games like Tic Tac Toe, corresponds to a game position, and edges represent valid moves that lead to other
chess, checkers, and many others. positions.
 It is designed to find the optimal move for a player by 2.Recursive Evaluation: Starting from the current game state, the algorithm
exploring the entire game tree. recursively evaluates all possible moves by assuming both players play optimally
3.Terminal Nodes: When the algorithm reaches a terminal node (a state where the
game ends), it assigns a score to that position.
4.Backtracking: As the algorithm explores deeper levels of the tree, it backtracks and
propagates the scores upward to evaluate the parent nodes.
5.Optimal Move: After evaluating all possible moves, the Minimax algorithm selects
the move that leads to the highest score at the root level.
Advantages :
Alpha-Beta Pruning:
 Alpha-Beta Pruning maintains two
values, alpha and beta, which represent
the best known scores for the
 During the recursive evaluation, the
algorithm prunes branches of the tree
where the evaluation of a node reveals
that it won't affect the final decision.
 By pruning these branches, the
algorithm avoids unnecessary
evaluations, making the search much
 To address the limitations of the faster while still guaranteeing the same
basic Minimax algorithm, Alpha- optimal move as the basic Minimax
algorithm.
Beta Pruning is used as an  Alpha-Beta Pruning significantly
optimization. improves the performance of the
 It helps reduce the number of Minimax algorithm and is widely used
nodes explored by eliminating in various AI applications for games and
optimization problems.
irrelevant branches, leading to a
faster and more efficient search.
 When an AI algorithm, such as Minimax with
Alpha-Beta Pruning and a suitable heuristic,
is implemented for Tic Tac Toe, it becomes a
formidable opponent.
 In most cases, the AI will play perfectly or
force a draw, given that the game is well-
implemented and the AI explores the entire
AI vs. Human game tree.
Gameplay:  Humans, on the other hand, might make
mistakes or overlook certain strategic moves,
making it easier for the AI to win.
 In general, AI will outperform human players
in Tic Tac Toe due to its ability to explore the
entire game tree and make optimal decisions
based on perfect information.
 Humans might win against AI under some
circumstances if the AI is not fully optimized
or if the human player is highly skilled and
capable of exploiting certain weaknesses or
unpredictable patterns.
Challenges in
Implementing AI for
Tic Tac Toe:

1. Noisy Data: The algorithm must contend


with noisy data and incomplete information;
for example, it may not know the strategy of
its opponents.
2. Overfitting: The algorithm may overfit a
particular strategy and perform poorly when
faced with a novel approach by the opponent.
3. Complexity: The algorithm must be
optimized to handle the overall complexity of
the game, which requires a significant
amount of computational power.
 For Tic Tac Toe, the problem is well-
solved using Minimax with Alpha-Beta
Pruning and a suitable heuristic.
 However, in the broader context of AI
and games, future directions could
CONCLUSION involve applying more advanced
techniques like Monte Carlo Tree Search
(MCTS) or Reinforcement Learning
algorithms to learn optimal strategies
from experience rather than relying on
heuristics.
 Additionally, exploring larger game
boards or variations of Tic Tac Toe with
different grid sizes and win conditions
could be interesting for research and
development.
THANK
YOU

You might also like