0% found this document useful (0 votes)
22 views18 pages

Tic Tac Toe

Uploaded by

ffg44314
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)
22 views18 pages

Tic Tac Toe

Uploaded by

ffg44314
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/ 18

Cluny Vidya Nikethan (CBSE)

Senior Secondary School


Attur Bye Pass Road, Erumapalayam, Salem-15
ACADEMIC YEAR: 2024-25

MINI PROJECT REPORT ON

____________________

ROLL NO : 04

NAME : ROUVIN.A.P

CLASS : XI - C

SUBJECT : COMPUTER SCIENCE

SUB CODE : 083

PROJECT GUIDE: V.MARTIN SOLOMON


PGT (CS)
Cluny Vidya Nikethan
Senior Secondary School (CBSE)
Erumapalayam, Salem-15, Tamilnadu.

Cluny Vidya Nikethan (CBSE)


Senior Secondary School

CERTIFICATE

This is to certify that Student____ROUVIN.A.P ______________


Roll No: _____04__________has successfully completed the Mini Project
Work entitled _______TIC TAC TOE GAME__________________________ in
the subject Computer Science (083) laid down in the regulations of
CBSE for the purpose of Practical Examination in Class XI to be held in
Cluny Vidya Nikethan(CBSE) Senior Secondary School, on _____________.

V. Martin Solomon
Teacher in charge

School seal Principal


TABLE OF CONTENTS [ T O C]

SER DESCRIPTION PAGE NO

01 ACKNOWLEDGEMENT 4

02 INTRODUCTION 5

OBJECTIVES OF THE MINI PROJECT


03 7

04 INSTRUCTIONS TO PLAY 9

05 SOURCE CODE 10

06 OUTPUT 15

07 HARDWARE AND SOFTWARE REQUIREMENTS 17

08 CONCLUSION 18
ACKNOWLEDGEMENT
Apart from the efforts of me, the success of any Mini Project depends
largely on the encouragement and guidelines of many others. I take this
opportunity to express my gratitude to the people who have been
instrumental in the successful completion of this Mini Project.
I express deep sense of gratitude to almighty God for giving me
strength for the successful completion of the Mini Project.
I express my heartfelt gratitude to my parents for constant
encouragement while carrying out this Mini Project.
I gratefully acknowledge the contribution of the individuals who
contributed in bringing this Mini Project up to this level, who continues to
look after me despite my flaws,
I express my deep sense of gratitude to the luminary Rev.Sr. MARIE
THERESE, The Principal, Cluny Vidya Nikethan (CBSE) Senior Secondary
School who has been continuously motivating and extending their helping
hand to us.
I am overwhelmed to express my thanks to The Office staffs for
providing me an infrastructure and moral support while carrying out this
Mini Project in the school.
My sincere thanks to Mr. V.MARTIN SOLOMON, Master In-charge, A
guide, Mentor all the above a friend, who critically reviewed my Mini
Project and helped in solving each and every problem, occurred during
implementation of the Mini Project
The guidance and support received from all the members who
contributed and who are contributing to this Mini Project, was vital for the
success of the Mini Project. I am grateful for their constant support and
help.
TIC TAC TOE GAME

INTRODUCTION

Introduction to Tic Tac Toe Game Mini Project


Tic Tac Toe is a classic two-player game that has captivated
audiences for generations with its simplicity and strategic
depth. The game, often played on a 3x3 grid, involves players
taking turns marking their respective symbols—traditionally
"X" and "O"—with the objective of placing three of their marks
in a horizontal, vertical, or diagonal row. Despite its
straightforward rules, Tic Tac Toe serves as an excellent
introduction to fundamental concepts in game design,
programming, and artificial intelligence.

This project will not only enhance our understanding of


programming constructs such as loops, conditionals, and
functions but also provide insights into designing a user-
friendly interface and implementing basic AI algorithms for
the computer opponent.

The project is developed using PYTHON IDLE which allows


for an engaging and interactive experience. We will focus on
creating a clean and intuitive user interface, ensuring that
players can easily understand the game mechanics and
enjoy seamless gameplay. Additionally, we will explore
strategies for the computer's decision-making process,
enabling it to play competitively against human players.

Through this mini project, we aim to reinforce our


programming skills, understand game logic, and appreciate
the balance between simplicity and strategy in game design.
By the end of this project, we will have a fully operational Tic
Tac Toe game that can be shared and enjoyed, showcasing
our ability to apply theoretical knowledge to practical
applications.
OBJECTIVES OF THE MINI PROJECT

The objectives of a Tic Tac Toe game can be categorized

into different aspects, including gameplay goals, educational

goals, and design/development goals. Here are some key

objectives:

●Blocking Opponent:

Players must also aim to block their opponent from

achieving three in a row, strategizing their moves to prevent

a loss.

●Understanding Game Strategy:

Players learn strategic thinking and planning by considering

their moves and anticipating their opponent's actions.

●Critical Thinking:

The game encourages players to think critically about their

choices and the potential consequences of those choices.


●User Interface Design:

An intuitive and visually appealing user interface that allows

players to easily understand how to play and make their

moves.

●Encouraging Social Interaction:

The game can be played between two players, promoting

social interaction and friendly competition.

●Building Patience and Sportsmanship:

Players can learn important values such as patience, taking

turns, and graciousness in winning or losing.

By focusing on these objectives, Tic Tac Toe can serve not

only as an entertaining game but also as a tool for learning

and social interaction.


INTRUCTIONS TO PLAY
●Choose Your Symbol:
Decide whether you want to be "X" (usually the first player) or
"O".

●Game Start:

If you are "X", you can start the game by placing your "X" in
any of the nine cells.
If you are "O", the computer will make the first move (if it’s
set to go first).

●Making Moves:

After you make your move, the computer will respond by


placing its symbol in an empty cell.
The computer typically uses a strategy to block you from
winning or to set up its own winning move.

●Winning the Game:

Keep track of the grid and look for opportunities to create


three in a row.
Block the computer if it is about to win in its next move.

●End of Game:

The first player to align 3 of their symbols in a row wins the


game.

If all the cells are filled but yet none of the player has 3 in a
row,then the game is a draw
SOURCE CODE
def __init__(self):
self.board = [' ' for _ in range(9)] # 3x3 board as a list
self.current_player = 'X' # Player 1 uses 'X', Player 2
uses 'O'

def print_board(self):
"""Prints the current board state."""
for i in range(0, 9, 3):
print(f"{self.board[i]} | {self.board[i + 1]} | {self.board[i
+ 2]}")
if i < 6:
print("-" * 9)

def is_valid_move(self, position):


"""Checks if a move is valid."""
return 0 <= position < 9 and self.board[position] == ' '

def make_move(self, position):


"""Makes a move if it's valid."""
if self.is_valid_move(position):
self.board[position] = self.current_player
return True
return False

def check_winner(self):
"""Checks if the current player has won."""
winning_combinations = [
[0, 1, 2], [3, 4, 5], [6, 7, 8], # rows
[0, 3, 6], [1, 4, 7], [2, 5, 8], # columns
[0, 4, 8], [2, 4, 6] # diagonals
]
for combo in winning_combinations:
if all(self.board[i] == self.current_player for i in combo):
return True
return False

def is_draw(self):
"""Checks if the game is a draw."""
return all(cell != ' ' for cell in self.board)

def switch_player(self):
"""Switches the current player."""
self.current_player = 'O' if self.current_player == 'X' else
'X'

def play(self):
"""Runs the game loop."""
print("Welcome to Tic Tac Toe!")
while True:
self.print_board()
try:
position = int(input(f"Player {self.current_player},
choose a position (0-8): "))
except ValueError:
print("Invalid input. Please enter a number between
0 and 8.")
continue

if not self.make_move(position):
print("Invalid move. Try again.")
continue

if self.check_winner():
self.print_board()
print(f"Player {self.current_player} wins!")
break

if self.is_draw():
self.print_board()
print("It's a draw!")
break

self.switch_player()

if __name__ == "__main__":
game = TicTacToe()
game.play()
OUTPUT
HARDWARE AND SOFTWARE REQUIREMENTS

I.OPERATING SYSTEM : WINDOWS 10 AND ABOVE

II. PROCESSOR : PENTIUM (ANY) OR AMD

ATHALON (3800+- 4200+ DUAL CORE)

III. MOTHERBOARD : 1.845 OR 915,995 FOR PENTIUM 0R MSI

K9MM-V VIA K8M800+8237R PLUS

CHIPSET FOR AMD ATHALON

IV. RAM : 4GB+

V. Hard disk : SATA 256 GB OR ABOVE

VI. CD/DVD r/w multi drive combo: (If back up required)

VII. PEN DRIVE 1 GB : (If Backup required)

VIII. MONITOR 14.1 or 15 -17 inch

IX. Key board and mouse

X. Printer : (if print is required – [Hard copy])

SOFTWARE REQUIREMENTS:
• Windows OS
• Python IDLE
• PyCharm Community
• MySQL server
• Connector module
• Internet
CONCLUSION
In conclusion, the development of the Tic Tac Toe game has
provided valuable insights into the fundamentals of game
design, programming logic, and user interaction. This mini
project allowed us to explore key concepts such as
algorithms, data structures, and basic artificial intelligence,
particularly in implementing a simple opponent for the
player.

Through the process of designing the game, we learned


how to create an engaging user interface, manage game
states, and handle player inputs effectively. We also gained
experience in debugging and testing, ensuring that the
game operates smoothly and is free of critical errors.

The project not only enhanced our technical skills but also
fostered teamwork and collaboration, as we shared ideas
and solutions to overcome challenges encountered during
development. Additionally, we recognized the importance of
user experience, which guided us in making the game
intuitive and enjoyable for players of all ages.

Looking forward, this project serves as a foundation for


more complex game development endeavors. We can
expand upon this basic framework by incorporating
advanced features such as multiplayer options, improved AI
strategies, or even transitioning to a graphical user interface.
Overall, the Tic Tac Toe game project has been a rewarding
experience that has significantly contributed to our
understanding of programming and game development
principles.

You might also like