Arsh Final Project
Arsh Final Project
on
By
Arsh Siddique
AJU/220866
JAMSHEDPUR, JHARKHAND
This is to certify that the project entitled “Tic Tac Toe”, is bonafide work of Arsh
Siddique bearing enrollment Number: AJU/220866 under the guidance of Dr.
Arvind Kumar Pandey and Ms. Aarsi Kumari submitted in partial fulfilment of the
requirement for the award of degree in BACHELOR OF COMPUTER
APPLICATION from ARKA JAIN UNIVERSITY, JHARKHAND during the
year 2022 - 2023.
2
ABSTRACT
The project is very useful for those who want to know about Tic Tac Toe and want to develop
software’ s websites based on the same concept. This project “ Tic Tac Toe” provides an
interactive and enjoyable games experience for users of all ages. The game is designed to be
played on various platforms including desktop, computers, mobile, devices and web browsers,
making it accessible to a wide audience. The “ Tic Tac Toe Game Project” serves as an excellent
example of how classic games can be transformed into modern digital experiences. It combines
elements of strategy fun and accessibility to create an engaging gaming application for use users
to enjoy.
3
ACKNOWLEDGEMENT
I would like to express my special thanks of gratitude to my guidance to our Dean Dr. Arvind
Kumar Pandey and Ms. Aarsi Kumari who gave me the golden opportunity to do this project on
the topic TIC TAC TOE. It helped me in doing a lot of Research and I came to know about a lot
of things related to this topic.
Also I would like to thank my friends for their immense help and support. Without their support
I couldn’ t have succeeded in completing this project.
4
DECLARATION
I, Arsh Siddique, hereby declare that the Project entitled Tic Tac Toe done at ARKA JAIN
UNIVERSITY has not been in any case duplicated to submit to any other university for the award
of any degree. To the best of my knowledge other than me, no one has submitted to any other
university.
This project is done in partial fulfilment of the requirement for the award of degree of
BACHELOR OF COMPUTER APPLICATION to be submitted as final semester project as part
of our curriculum.
Arsh Siddique
AJU/220866
5
CONTENTS
1. INTRODUCTION 7
2. SPECIFICATION REQUIREMENT 8
3. CODE 9-11
4. OUTPUT 12-17
5. CONCLUSION 18
6. REFERENCE 19
6
INTRODUCTION
7
SPECIFICATION REQUIREMENT
Hardware Requirement:
Printer
Laptop
Processor-AMD PRO A10-8750B R7, 12 Compute cores 4C+3.60 CPU @
1.30GHz 1.50 GHz
RAM-8.00 GB (7.70GB usable)
Software Requirement:
For execution of code-VS Studio Code(C++)
For presentation of the code-MS Word
Operating Environment:
The Operating System used:
Windows 10 pro
Version: 1809
8
CODE
include <stdio.h>
#include <term.h>
char box[10]={'0','1','2','3','4','5','6','7','8','9'};
void creating_board();
void marking_board(int, char);
int check_for_win();
int main()#
{
int choice,player=1,i;
char mark;
do{
creating_board();
player= (player % 2) ? 1: 2;
printf("Player %d, enter a number: ",player);
scanf("%d",&choice);
mark = (player==1) ? 'X' : 'O';
marking_board(choice,mark);
i=check_for_win();
player++;
}while(i == -1);
creating_board();
if(i==1)
printf("Player %d YUHOO YOU WON THE MATCH!!!!!!! ",--player); else
printf("<-------Draw------>");
return 0;
}
void creating_board()
{
9
clear_screen;
printf("\n\n\tTic Tac Toe\n\n");
printf("Player 1 (X) -- Player 2 (O)\n\n");
printf(" | | \n");
printf(" %c | %c | %c \n",box[1],box[2],box[3]);
printf("_____|_____|_____\n");
printf(" | | \n");
printf(" %c | %c | %c \n",box[4],box[5],box[6]);
printf("_____|_____|_____\n");
printf(" | | \n");
printf(" %c | %c | %c \n",box[7],box[8],box[9]);
printf("_____|_____|_____\n");
}
void marking_board( int choice, char mark)
{
if(choice==1 && box[1]=='1')
box[1]=mark;
else if(choice==2 && box[2]=='2')
box[2]=mark;
else if(choice==3 && box[3]=='3')
box[3]=mark;
else if(choice==4 && box[4]=='4')
box[4]=mark;
10
else if (choice==9 && box[9]=='9') box[9]=mark;
else
{
printf("Invalid move");
}
}
int check_for_win()
{
if(box[1]==box[2] && box[2]==box[3])
return 1;
else if(box[4]==box[5] && box[5]==box[6])
return 1; // horizontal match
else if (box[7]==box[8] && box[8]==box[9])
return 1;
else if (box[1]==box[4] && box[4]==box[7])
return 1;
else if(box[2]==box[5] && box[5]==box[8]) // vertical match return 1;
else if(box[3]==box[6] && box[6]==box[9])
return 1;
else if(box[1]==box[5] && box[5]==box[9])
return 1;
else if(box[3]==box[5] && box[5]==box[7]) //diagonal match
return 1;
else if(box[1]!='1' && box[2]!='2' && box[3]!='3' && box[4]!='4'&& box[5]!='5' &&
box[6]!='6'&& box[7]!='7' && box[8]!='8' && box[9]!='9') //no match
return 0;
else
return -1;
}
11
OUTPUT
||
1|2|3
_____|____|_____
||
4|5|6
_____|____|_____
||
7|8|9
_____|____|_____
||
1|2|3
_____|____|_____
||
4|X|6
_____|____|_____
||
12
7|8|9
_____|____|_____
||
1|O|3
_____|____|_____
||
4|X|6
_____|____|_____
||
7|8|9
_____|____|_____
||
1|O|3
_____|____|_____
||
4|X|X
_____|____|_____
13
||
7|8|9
_____|____|_____
||
1|O|3
_____|____|_____
||
O|X|X
_____|____|_____
||
7|8|9
_____|____|_____
||
1|O|3
_____|____|_____
||
[19]
14
O|X|X
_____|____|_____
||
X|8|9
_____|____|_____
||
1|O|O
_____|____|_____
||
O|X|X
_____|____|_____
||
X|8|9
_____|____|_____
||
||
1|O|O
15
_____|____|_____
||
O|X|X
_____|____|_____
||
X|8|X
_____|____|_____
||
||
1|O|O
_____|____|_____
||
O|X|X
_____|____|_____
||
X|O|X
_____|____|_____
||
16
Player 1 (X) -- Player 2 (O)
||
X|O|O
_____|____|_____
||
O|X|X
_____|____|_____
||
X|O|X
_____|____|_____
||
17
CONCLUSION
The Tic Tac Toe was created with the help of C programming language. The game provides an
interactive and enjoyable experience for two players, allowing them to complete in a classic
game of strategy and skill. Throughout the project, we have efficiently managed player input,
displayed the game board and implemented logic for win condition and draws. This project not
only showcases our proficiency and C programming but also reinforces fundamental
programming concepts such as Arrays, Loops, and conditional statements. It serves as a
testament to our ability to design and develop simple yet engaging games. In the future,
enhancements such as graphical interfaces or additional features could be considered to further
enhance the gaming experience. Overall this project has been well available learning experience
in software development and problem solving.
18
REFERENCE
https://www.google.com/
https://www.youtube.com/
https://www.programmingwithbasics.com
https://www.github.com
https://www.sourcecode.com
19