Professional Documents
Culture Documents
PRACTICAL
PROJECT
NAME-MADHAV GARG
ROLL. NO-14
CLASS-XII B
ACKNOWLEDGEMENT
I would like to express my heartfelt gratitude to Mr. Amit Singhal , my dedicated teacher,
whose guidance and unwavering support played an instrumental role in the successful
completion of this project. Your patience, encouragement, and expertise have been
invaluable, and I am truly fortunate to have had you as my mentor. I would also like to extend
my thanks to all the other teachers for their contributions in helping me acquire the
knowledge and resources necessary for this project. Each member of the staff, through their
commitment to education, has played a vital role in shaping my understanding of the subject
matter. I would also like to extend my thanks my fellow students and classmates for their
camaraderie and collaborative spirit, which made the journey of this project all the more
enjoyable and enlightening. This project would not have been possible without the collective
efforts and support of all these individuals. Thank you for believing in me and helping me
achieve my goals.
CERTIFICATE OF COMPLETION
This is to certify that MADHAV GARG a student of class XII - B has successfully completed the
Computer Science Project Work entitled - “TIC TAC TOE GAME” under the guidance of Mr.
Amit Singhal, subject teacher, during the academic year 2023-24 as per the guidelines
issued by Central Board of Secondary Education (CBSE).
Teacher guide
Mr. Amit Singhal
TABLE OF CONTENTS
S.No. Topic Page
1. Introduction 5
2. How it works 6
3. Source Code 7-14
4. Output 15-17
5. Bibliography 18
INTRODUCTION
Tic-tac-toe is a classic paper-and-pencil game where two players take turns
marking either an 'X' or an 'O' in a 3x3 grid. The objective is to create a row,
column, or diagonal of three of the same symbols before your opponent does.
It's a simple yet strategic game that engages critical thinking and foresight.
Players aim to outmaneuver their opponent by strategically placing their
marks to block their opponent's moves while aiming for their own winning
combination. With its straightforward rules and quick gameplay, tic-tac-toe is
a timeless game enjoyed by people of all ages.
HOW IT WORKS
What is python?
DEF STORE_WINNER(WINNER):
"""STORE GAME WINNER IN MYSQL DATABASE"""
CONN = MYSQL.CONNECTOR.CONNECT(
HOST='LOCALHOST',
USER='ROOT',
PASSWORD='Maddy@123',
DATABASE='Madhav'
CURSOR = CONN.CURSOR()
CONN.COMMIT()
CONN.CLOSE()
DEF CHECK_WINNER(BOARD):
"""CHECK FOR A WINNER IN THE TIC TAC TOE GAME"""
WINNING_COMBINATIONS = [
[0, 1, 2], [3, 4, 5], [6, 7, 8],
[0, 3, 6], [1, 4, 7], [2, 5, 8],
[0, 4, 8], [2, 4, 6]
FOR COMBO IN WINNING_COMBINATIONS:
IF BOARD[COMBO[0]] == BOARD[COMBO[1]] == BOARD[COMBO[2]] != ' ':
RETURN BOARD[COMBO[0]]
RETURN NONE
DEF PLAY_GAME():
"""PLAY THE TIC TAC TOE GAME AND STORE OVERALL WINNER"""
PLAYER1_WINS = 0
PLAYER2_WINS = 0
FOR _ IN RANGE(5):
BOARD = [' ' FOR _ IN RANGE(9)]
PLAYER = 'X'
GAME_OVER = FALSE
2. https://youtu.be/V9MbQ2Xl4CE?feature=shared
THANK YOU