0% found this document useful (0 votes)
6 views

PYTHON project

Uploaded by

pandablue901
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)
6 views

PYTHON project

Uploaded by

pandablue901
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/ 14

Nashik Gramin Shikshan Prasarak Mandal’s

BRAHMA VALLEY COLLEGE OF TECHNICAL EDUCATION,


ANJANERI, NASHIK

Department of Computer Technology

PROJECT WORK BOOK

YEAR 2024 -2025


Project Title: “Tic-Tac-Toe Game”

Sr.No. Student Name Enrollment No.

1 Laxmi Singh 23611480183

2 Atharva Lambole 2207780020

3 Aditya Chavan 2207780004

Project Guide: Prof. S.A.Bhamare


MAHARASHTRASTATE
BOARD OF TECHNICAL EDUCATION (MSBTE), MUMBAI
Brahma Valley College of Technical Education, Anjaneri, Nashik
Department of Computer Technology

2024-2025

A
Project Report
On
[“Tic-Tac-Toe Game”]
By
[Laxmi Singh] [23611480183]

[Atharva Lambole] [2207780020]


[Aditya Chavan] [2207780004]

Under the guidance of

[Prof. S.A.Bhamare]
Brahma Valley College of Technical Education,
Anjaneri, Nashik

Department of Computer Technology

CERTIFICATE
This is to certify that

[Laxmi Singh] [23611480183]

[Atharva Lambole] [2207780020]


[Aditya Chavan] [2207780004]

have successfully completed their Project on “Tic-Tac-Toe Game”


at Brahma Valley College of Technical Education, Anjaneri, Nashik in the partial
fulfillment of the Diploma course in Computer Technology in the academic Year
2024-2025.

Prof. S.A.Bhamare
External
Guide

Prof. M. M. Kulkarni Prof. V. P. Nikhade


Head of the Department Principal
Brahma Valley College of Technical Education,
Anjaneri, Nashik

Department of Computer Technology

CERTIFICATE

This is to certify that Atharva Ghansham Lambole from Computer Technology

Department has successfully completed his/her Project on “Tic-Tac-Toe Game” at

Brahma Valley College of Technical Education, Anjaneri, Nashik in the partial

fulfillment of the Diploma course in Computer Technology in the academic Year

2024-2025.

Prof. S.A.Bhamare External


Guide

Prof. M. M. Kulkarni Prof. V. P. Nikhade


Head of the Department Principal
ACKNOWLEDGEMENT
We would like to deeply thank the various people who, during the several months which this endeavor
lasted, provided us with useful and helpful assistance. Without care and consideration, this seminar
would likely not have matured.

First we would like to thank our project guide Head of Dept. Prof. M. M. Kulkarni Sir for his guidance
and interest. His guidance reflects expertise we certainly do not master ourselves. We also thank
him for his patience throughout, in cross-reviewing which constitutes a rather difficult balancing act.

Second, We would like to thank to sub teacher Prof.S.A.Bhamare all the Staff Members of Computer
Department for providing us their admirable feedback and insights whenever we discussed our project
with them. We also extend my thanks to our lab assistants who guided us in implementation of our
seminar.

We would like to extend my special thanks to our Principal, Prof. V. P. Nikhade for his
encouragement and words of wisdom.

Finally, We express my deepest gratitude to my family and friends who encouraged us since the
beginning and provided us with their insightful reviews to help us make our Project successful.

[Laxmi Singh] [23611480183]

[Atharva Lambole] [2207780020]


[Aditya Chavan] [2207780004]
INDEX
Sr. Page
No. No.
Contents

1 Aim 1

2 Course Outcomes Addressed 1

3 Literature Review 1

4 Actual procedure followed 2

5 Program Code 3-5

6 output 5-7

7 Resource Required 7

8 Skill Developed 8

9 Applications of this microproject 8


1.0 Rationale
The objective of this project is to develop the well-known board game Tic-Tac-
Toe for two players.
Generally, this is a two-player strategy board game. The Tic-Tac-Toe game is
based on having a game board (2D array) of size 3 x 3. The players alternate placing
Xs and Os on the board until either one has placed three Xs or Os in a row
horizontally, vertically, or diagonally; or all nine board squares are filled. The player
wins if s/he draws three Xs or three Os in a row. Otherwise, the game is draw.
Initially the board grid squares are initialized to zeros. Xs and Os might be
denoted by numbers inside the board grid by ones and twos respectively. I.e. if player
one chooses X, the location of that choice is registered as 1 and when player two
chooses O the location of that choice in your array is registered as 2. At the end if a
row of 1s is registered then player one won the game. Or if a row of 2s is registered
thus player two won the game. If not, the game is draw. The game ends when there is
no more empty fields in the array (board) to fill or if one of the players wins the
game.

1. Aim of the project


1. To develop an interesting game for children to pass their free time.
2. To develop the well-known board game Tic-Tac-Toe for two players.
3. To be one of the players to get three same symbols in a row – horizontally,
vertically or diagonally on a 3 x 3 grid.

1. Course OutcomesAchieved
1. Display message on screen using Python script on IDE.
2. Develop python program to demonstrate use of Operators.
3. Perform operations on data structures in Python.
4. Develop functions for given problems.

4.0 Literature Review


Author (Publication) Abstract Conclusion
Kalyani Adawadkar This paper describes the main We used this paper to learn
(Sigma Institute of features and applications of different features available in
Engineering) Python Programming Python and its applications.
David Beazley This book contains a complete We used this book to learn the
(Sams Publishing) learning of Python Programming basic concepts of Python
Programming
Tom Gutschmidt This book covers game We used this book to learn how to
(Premier Press) programming in three different build efficient, flexible and well-

1
Table 2- Actual procedure followed

• Program code

#Implementation of Two Player Tic-Tac-Toe game in Python.

theBoard = {'1': ' ' , '2': ' ' , '3': ' ' ,
'4': ' ' , '5': ' ' , '6': ' ' ,
'7': ' ' , '8': ' ' , '9': ' ' }

board_keys = []

for key in theBoard:


board_keys.append(ke
y)

def printBoard(board):

2
print("\n")
print(' '+board['1'] + ' | ' + board['2'] + ' | ' + board['3'])
print(' ---+---+---')
print(' '+board['4'] + ' | ' + board['5'] + ' | ' + board['6'])
print(' ---+---+---')
print(' '+board['7'] + ' | ' + board['8'] + ' | ' + board['9'])

print("\n")

# Now we'll write the main function which has all the gameplay functionality.
def game():

turn = 'X'
count = 0

for i in range(10):
printBoard(theBoard)
move=input("It's your turn," + turn + ". Move to which place? ")

#move = input()

if theBoard[move] == ' ':


theBoard[move] = turn
count += 1
else:
print("THAT PLACE IS ALREADY FILLED.\nMove to which place?")
continue

# Now we will check if player X or O has won,for every move after 5 moves.
if count >= 5:
if theBoard['1'] == theBoard['2'] == theBoard['3'] != ' ': # across the top
printBoard(theBoard)
print("\nGAME OVER.\n\n")
print(" ****** CONGRATULATIONS! " +turn + " YOU WON THE GAME
******\n\n")
break
elif theBoard['4'] == theBoard['5'] == theBoard['6'] != ' ': # across the middle
printBoard(theBoard)
print("\nGAME OVER.\n\n")
print(" ****** CONGRATULATIONS! " +turn + " YOU WON THE GAME
******\n\n")
3
elif theBoard['7'] == theBoard['8'] == theBoard['9'] != ' ': # across the bottom
printBoard(theBoard)
print("\nGAME OVER.\n\n")
print(" ****** CONGRATULATIONS! " +turn + " YOU WON THE GAME
******\n\n")
break
elif theBoard['7'] == theBoard['4'] == theBoard['1'] != ' ': # down the left side
printBoard(theBoard)
print("\nGAME OVER.\n\n")
print(" ****** CONGRATULATIONS! " +turn + " YOU WON THE GAME
******\n\n")
break
elif theBoard['8'] == theBoard['5'] == theBoard['2'] != ' ': # down the middle
printBoard(theBoard)
print("\nGAME OVER.\n\n")
print(" ****** CONGRATULATIONS! " +turn + " YOU WON THE GAME
******\n\n")
break
elif theBoard['9'] == theBoard['6'] == theBoard['3'] != ' ': # down the right side
printBoard(theBoard)
print("\nGAME OVER.\n\n")
print(" ****** CONGRATULATIONS! " +turn + " YOU WON THE GAME
******\n\n")
break
elif theBoard['1'] == theBoard['5'] == theBoard['9'] != ' ': # diagonal
printBoard(theBoard)
print("\nGAME OVER.\n\n")
print(" ****** CONGRATULATIONS! " +turn + " YOU WON THE GAME
******\n\n")
break
elif theBoard['7'] == theBoard['5'] == theBoard['3'] != ' ': # diagonal
printBoard(theBoard)
print("\nGAME OVER.\n\n")
print(" ****** CONGRATULATIONS! " +turn + " YOU WON THE GAME
******\n\n")
break

# If neither X nor O wins and the board is full, we'll declare the result as 'tie'.
if count == 9:
print("\nGAME OVER.\n\n")
print("*** IT'S A TIE!! ***\n\n")
4
break

# Now we have to change the player after every move.


if turn =='X':
turn = 'O'
else:
turn = 'X'

# Now we will ask if player wants to restart the game or not.


restart = input("Do want to play Again?(y/n)")
if restart == "y" or restart == "Y":
for key in board_keys:
theBoard[key] = " "

game()

if name == " main ":


game()

Output:

Fig 1: Tic Tac Toe Game Board

5
Fig 2: Message displayed if you choose the position which is already chosen

Fig 3: Message displayed after winning the game

6
Fig 4: Message displayed after losing the game

6.0 Actual Resources Required


The resources used during the completion of project are mentioned in the below

Sr.no Name of resources Specifications Quantity Remarks


material
1. YouTube MP4-file format, 640 x 1
360 pixels
2. Microsoft Word 2010 version 1

3. IDLE Version 3.8.1 1

4. Laptop Dell, RAM 8 GB, 1


Harddisk 1 TB, i3
processor

7
1. Skill Developed/ learning out of this Micro-Project
We learnt,
1. To demonstrate the use of Operators.
2. To perform operations on data structures in Python.
3. To develop functions for given problems.
4. Efficient communication skills.
5. Working as a team member for developing c program.
6. Developing leadership qualities.

1. Applications of the Project


1. Thisproject can be used as an interesting game for children to pass their free time.
2. The project can be also used to understand the.
3. The project can be used in learning the

Subject Teacher

Prof:S.A.Bhamare

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy