0% found this document useful (0 votes)
27 views16 pages

Tik Tac Toe game (2)

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

Tik Tac Toe game (2)

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

A

PROJECT REPORT ON
“Tik Tac Toe”
FOR THE DIPLOMA IN ARTIFICIAL INTELLIGENCE AND
MACHINE LEARNING
DATA STRUCTURE USING PYTHON
SUBMITTED BY
1. Baravkar Gauri Santaram
2. Bawaskar Ajinkya Pramod
3. Bhandarge Krushna Sudam
4. Bhujade Priti Navanath
5. Fraser K Boban
6. Chaudhari Akankshaa Jitendra
UNDER THE GUIDANCE OF
Mrs.S.S.Surwade
DEPARTMENT OF ARTIFICIAL INTELLIGENCE AND MACHINE
LEARNING
CSMSS COLLEGE OF POLYTECHNIC, CHHATRAPATI SAMBHAJI
NAGAR MAHARASHTRA, INDIA

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION,


MUMBAI
CERTIFICATE

This is to certify that Ms.Baravkar Gauri Santaram, Mr. Bawaskar


Ajinkya Pramod, Mr.Bhandarge Krushna Sudam, Ms.Bhujade
Priti Navanath, Mr. Fraser K Boban, Ms. Chaudhari Akankshaa
Jitendra from (Institute) CSMSS College of Polytechnic having
Enrollment No. 23511640007, 23511640008, 23511640009
23511640010, 23511640011, 23511640012 have Completed Project of
Second year having title “Tik Tac Toe game” during academic year
2024-25. The project completed by a group consisting of 06 Candidates
under the guidance of the Faculty guide.

Mrs. S.S.Surwade Mrs. S.R. Borakhade Dr. G.B. Dongre


(Project Guide) (Head of Department) (Principal)

2
ACKNOWLEDGEMENT
We would like to express our thanks to the people who have helped us most
throughout our project We would like to express our sincere thanks to the principal of
CSMSS College of Polytechnic Dr. G B Dongre sir for being always with us as a
motivator. We are thankful to the H.O.D. Mrs. S. R. Borakhade Madam of
ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING Department for her
kind support. We are grateful to our Project Guide Mrs. S.S.Surwade Madam for
nonstop support and continuous motivation for the project. Her help made us possible
to complete our project with all accurate information. Special thanks go to our friends
who helped us in completing the project, where they all exchanged their own
interesting ideas. We wish to thanks our parents for their personal support or attention
who inspired us to go our own way. Finally, we would like to thank God who made all
things possible for us till the end.

Sr. No Name of Student Sign

1 Baravkar Gauri Santaram

2 Bawaskar Ajinkya Pramod

3 Bhandarge Krushna Sudam

4 Bhujade Priti Navanath

5 Fraser K Boban

6 Chaudhari Akanksha Jitendra

3
INDEX

Sr.no Content Page no.

1 RATIONALE 5

2 COMPETENCY 5

3 COURSE OUTCOME 5

4 AIMS/ BENEFITS OF THE MICRO PROJECT 6

5 ACTION PLAN 6

6 INTRODUCTION 8

7 PROGRAM 10

8 OUTPUT 13

9 CONCLUSION 15

10 REFERENCE/BOOKS 16

4
RATIONALE:
Data structures are mathematical and logical model of storing and organizing
data in a particular way in computer. Python is powerful programming language,
it is effective for introducing computing and problem solving to beginners.
Python has efficient high-level data structures and a simple but effective
approach to object-oriented programming. After completing this course, student
will be able to implement different types of data structures to solve real life
problems.

COMPETENCY:
Competency is the ability to perform tasks effectively, combining knowledge,
skills, and behaviors. It includes understanding relevant concepts, practical
abilities (both technical and soft skills), and the attitudes that influence
performance. Experience enhances competency through real-world application,
while continuous learning is essential for adapting to changes in technology and
industry. Ultimately, competency is vital for personal growth, career
advancement, and organizational success.

COURSEOUTCOMES (COs):
Students will be able to achieve & demonstrate the following COs on completion
of course based learning
 CO1 - Develop Python program using basic syntactical constructs.
 CO2 - Perform operations on sequence structures in Python.
 CO3 - Implement Modules, Packages in Python for given problem.
 CO4 - Design classes for given problem.
 CO5 - Implement Linear Data Structure in Python.
 CO6 - Develop Python program to implement tree data structure.

5
“Tik Tac Toe game”
Aims/Benefits of the Micro-Project :-

 Aim: -The aim of the Tic-Tac-Toe project is to enhance programming


skills through an interactive game.
 Benefits: -The Tic-Tac-Toe project enhances programming skills and
understanding of algorithms, data structures, and AI concepts.

Course Outcomes Addressed :-

1) Develop python program involving branching and looping statements.


2) Develop python program using user-defined functions.

Actule Methodology Followed :-


1) Select the topic about the micro project.
2) To understand the concept of topic.
3) Collect information about our topic.
4) Analysis coding and debugging.
5) To prepare the final project report.

Action Plan :-(Sequence and required for major activity)


Name of
Planned Planned End Responsible
Sr.No Details of Activity
Started Date Date Team
Member
Select the topic about the
1 03/08/2024 15/08/2024 ALL
micro project.
To understand the concept
2 16/08/2024 31/08/2024 ALL
of topic.
Collect information about
3 01/09/2024 29/09/2024 ALL
our topic.
Analysis coding and
4 30/09/2024 25/10/2024 ALL
debugging.
To prepare the final
5 26/10/2024 19/11/2024 ALL
project report.
6
RESOURCES REQUIRED :-

Sr. Name of Resource/


Specification Qty. Remarks
No Material
Computer, Internet service, www.Google.com,
1. 4
Notes, books www.youtube.com.

Names of Team Members Roll No.


1 Baravkar Gauri Santaram 07
2 Bawaskar Ajinkya Pramod 08
3 Bhandarge Krushna Sudam 09
4 Bhujade Priti Navanath 10
5 Fraser K Boban 11
6 Chaudhari Aakanksha Jitendra 12

Mrs. S.S. Surwade


(Course Teacher)

7
INTRODUCTION OF TIK TAC TOE GAME:-
Tic-Tac-Toe is a simple yet classic two-player game that is easy to learn and
widely popular. Played on a 3x3 grid, the objective is for players to take turns
marking empty spaces with their respective symbols—traditionally, "X" for one
player and "O" for the other. The goal is to be the first to form a continuous line
of three of their symbols, which can be horizontal, vertical, or diagonal. If all
nine squares are filled without a winning line, the game ends in a draw.

BACKGROUND OF THE PROJECT:


Creating a Tic Tac Toe game in Python is a great beginner project that introduces
fundamental programming concepts like variables, functions, loops, and
conditionals. It teaches users to work with data structures (like lists) and
implement game logic, including user input handling and win condition checks.
This project also enhances problem-solving skills and can be easily expanded
with features such as an AI opponent or a graphical interface. Overall, it serves
as an engaging way to learn programming basics and game development
principles.

1. Historical Relevance: Tic-Tac-Toe is an ancient game, dating back to Roman


times, that has been passed down through generations and is still widely played
due to its simplicity and accessibility.

2.Popular Learning Tool: In modern times, it has become a go-to project for
beginners in programming, offering an easy-to-understand framework for
learning basic coding principles.

3. Simple Game Mechanics: The game’s rules are straightforward—two players


alternate placing "X" and "O" on a 3x3 grid, aiming to align three of their
symbols either horizontally, vertically, or diagonally.

8
4. Control Flow Introduction: The project helps students grasp the basics of
control flow, including turn-taking, checking for win conditions, and determining
when a game ends in a draw.

5. Data Structures Understanding: Tic-Tac-Toe provides an opportunity to


explore data structures like arrays, lists, or matrices, which can be used to
represent the game board and store player moves.

6. Algorithm Development: It introduces participants to algorithmic thinking,


particularly through the implementation of game logic that checks winning
conditions and optimizes player strategies.

7. Artificial Intelligence Basics: The project is often used to teach fundamental


AI techniques, including the minimax algorithm, which is utilized to create AI
opponents capable of making optimal moves.

8. Game Theory and Strategy: Tic-Tac-Toe is a classic example in game


theory, allowing learners to explore concepts like zero-sum games, decision
trees, and optimal play strategies.

9.Logical Reasoning Skills: Implementing the game logic enhances participants’


problem-solving and logical reasoning abilities as they work to design a
functional, strategic game.

10. Foundation for Advanced Learning: Beyond just a fun project, Tic-Tac-
Toe serves as a foundation for further studies in game development, artificial
intelligence, and competitive programming.

9
PROGRAM

board = [" " for x in range(9)]


def print_board():
row1 = "| {} | {} | {} |".format(board[0], board[1], board[2])
row2 = "| {} | {} | {} |".format(board[3], board[4], board[5])
row3 = "| {} | {} | {} |".format(board[6], board[7], board[8])

print()
print(row1)
print(row2)
print(row3)
print()
def player_move(icon):
if icon == "X":
number = 1
elif icon == "O":
number = 2
print("Your turn player {}".format(number))
choice = int(input("Enter your move (1-9): ").strip())
if board[choice - 1] == " ":
board[choice - 1] = icon
else:
print()
print("That space is already taken!")

10
def is_victory(icon):
if (board[0] == icon and board[1] == icon and board[2] == icon) or \
(board[3] == icon and board[4] == icon and board[5] == icon) or \
(board[6] == icon and board[7] == icon and board[8] == icon) or \
(board[0] == icon and board[3] == icon and board[6] == icon) or \
(board[1] == icon and board[4] == icon and board[7] == icon) or \
(board[2] == icon and board[5] == icon and board[8] == icon) or \
(board[0] == icon and board[4] == icon and board[8] == icon) or \
(board[2] == icon and board[4] == icon and board[6] == icon):
return True
else:
return False
def is_draw():
if " " not in board:
return True
else:
return False
while True:
print_board()
player_move("X")
print_board()
if is_victory("X"):
print("X wins! Congratulations!")
break
elif is_draw():
print("It's a draw!")
break

11
player_move("O")
if is_victory("O"):
print_board()
print("O wins! Congratulations!")
break
elif is_draw():
print("It's a draw!")
break

12
OUTPUT

13
EXPLANATION :-
Overview of the Game Structure
1. Game Board:-
The game board is represented as a list with nine empty spaces. Each space
corresponds to a cell in a 3x3 grid.
2. Display Function:-
There’s a function dedicated to displaying the current state of the board. It
formats the board into rows and prints it in a visually appealing way, showing
which cells are occupied and which are still available.
3. Player Turns:-
The game allows two players (X and O) to take turns. A function handles player
input, prompting them to choose a cell (from 1 to 9) to place their symbol. It
checks if the chosen cell is available before making a move.
4. Victory Check:-
After each move, the game checks if the current player has won. This is done by
evaluating possible winning combinations (like three in a row horizontally,
vertically, or diagonally).
5. Draw Condition:-
The game also checks if the board is full without any winner, which results in a
draw.

6. Game Loop:-
The game runs in a loop, alternating between players until one wins or the game
ends in a draw. Each iteration displays the updated board and processes the
current player’s move.

14
Improvements to Consider
- Input Validation: Ensure players only input valid numbers (1-9) and handle any
errors gracefully.
- User Experience: You could enhance the experience by clearing the console
after each turn, though this depends on the environment you’re using.
- Restart Option: After a game ends, you could prompt players to start a new
game.

CONCLUSION:-
In conclusion, This Tic-Tac-Toe game is a straight forward yet effective
implementation of the classic game. It allows two players to take turns, checks
for victories and draws, and prints the game board after each move.
Enhancements like input validation and reducing code duplication could improve
user experience and maintainability. the Tic Tac Toe project serves as an
effective and engaging introduction to programming concepts for beginners.
Through its implementation, learners not only grasp fundamental skills such as
working with variables, control structures, and data handling but also enhance
their logical thinking and problem-solving abilities. simplicity of the game allows
for easy modifications and expansions, encouraging creativity and further
exploration in coding. Overall, this project it serves as a great foundation for
further development or learning about game logic in programming.

15
REFERENCE:

https://chat.openai.com/c/b88f38ff-379d-4d4e-9e71-ac9c8df119eb
https://www.w3schools.com/c/c_intro.php
https://www.geeksforgeeks.org/e-library-management-system/
https://www.youtube.com/

BOOKS:

 Data Structures and Algorithms Made Easy


Narasimha Karumanchi (2011)

 Python Crash Course


Eric Matthes (2015)

 Artificial Intelligence: A Guide to Intelligent Systems


Michael Negnevitsky (2011)

16

You might also like