SlideShare a Scribd company logo
4
Most read
9
Most read
21
Most read
FORMAT OF TERM PAPER 
1. Title page of project report 
2. Table of contents 
3. Introduction 
4. Proposed system 
i. Description 
ii. System requirements 
5. Requirement Analysis 
6. System Design 
7. Source code 
8. Testing 
9. Future scope of project
OF 
(TIC TAC TOE) 
Submitted in the partial fulfillment of the Degree of Bachelor of Technology 
(Integrated) 
In 
Computer Science and Engineering 
SUBMITTED BY:- GUIDED BY: 
Name ANIL KUMAR Miss Sukhdilpreet Kaur 
Regd. No.10802020 
RollnoR246B55 
SUBMITTED TO 
Department of Computer Science and Engineering Lovely Professional University 
Phagwara
ACKNOWLEDGEMENT 
I take this opportunity to present my votes of thanks to all those guidepost who really 
acted as lightening pillars to enlighten our way throughout this project that has led to 
successful and satisfactory completion of this study. 
We are really grateful to our HOD Mr. Rohit Dhand for providing us with an 
opportunity to undertake this project in this university and providing us with all the 
facilities. We are highly thankful to Miss Sukhdilpreet Kaur for her active support, 
valuable time and advice, whole-hearted guidance, sincere cooperation and pains-taking 
involvement during the study and in completing the assignment of preparing 
the said project within the time stipulated. 
Lastly, We are thankful to all those, particularly the various friends , who have been 
instrumental in creating proper, healthy and conductive environment and including 
new and fresh innovative ideas for us during the project, their help, it would have 
been extremely difficult for us to prepare the project in a time bound framework. 
Name ANIL KUMAR 
Regd. No.10802020 
Roll No.R246B55
TABLE OF CONTENTS 
1. Introduction 
2. Proposed system 
i. Description 
ii. System requirements 
3. Requirement Analysis 
4. System Design 
5. Source code 
6. Testing 
7. Future scope of project
INTRODUCTION 
In the existing system, most of the records are maintained on paper. It becomes very 
inconvenient to modify the data. In the existing system, here is a possibility that the same 
data in different registers may have different values which means the entries of the same 
data do not match. This inconsistent state does not supply the concrete information which 
poses a problem in the case information related to particular search record. 
Our project is very useful. User is no longer required to check his register in search of 
records, as now it can be searched over the software by choosing some options. The user 
need not to type in most of the information. He/she is just required to enter the desired 
options. On the whole it liberates the user from keeping lengthy manual records. In a 
nutshell, it abates the work load of an organization. 
In today’s world, no one likes to perform calculations on calculator or manually when 
computer is there. Every one wants his/her work to be done by computer automatically 
and displaying the result for further manipulations.
PROPOSED SYSTEM 
The following documentation is a project the “Name of the term paper allotted”. It is a 
detailed summary of all the drawbacks of the old system and how the new proposed 
system overcomes these shortcomings. The new system takes into account the various 
factors while designing a new system. It keeps into the account the Economical 
bandwidth available for the new system. The foremost thing that is taken care of is the 
Need and Requirements of the User. 
DESCRIPTION 
Before developing software we keep following things in mind that we can develop 
powerful and quality software 
PROBLEM STATEMENT 
o Problem statement was to design a module: 
o Which is user friendly 
o Which will restrict the user from accessing other user’s data. 
o Which will help user in viewing his data and privileges. 
o Which will help the administrator to handle all the changes. 
FUNCTIONS TO BE PROVIDED: 
The system will be user friendly and completely menu driven so that the users shall have 
no problem in using all options. 
o The system will be efficient and fast in response. 
o The system will be customized according to needs. 
SYSTEM REQUIRMENTS 
Operating system: MS Windows XP or Windows Vista 
Language: C Language 
Processor: Pentium IV Processor 
RAM: 512 MB 
Hard disk: 5 GB
REQUIREMENT ANALYSIS 
This process is adopted when management of the system development, Personnel decide 
that the particular system needs improvement. The system development life cycle is the 
set of activities, carried out by the analyst, designers and users to develop and implement 
a system. The systems that are present in the nature follow common life cycle pattern. 
For example consider the raining system. Initially the rain falls into the river, river flows 
into sea, the sea water evaporates to form vapors, the vapors form clouds which again 
bring rain. Similarly consider a man made system initially a system is analyzed, designed 
and made operational by the efforts of system analysis. After successful operation or a 
number of users, the system becomes less and less effective by change in the 
environment. So these changes have to be incorporated in to the system by minor 
modifications. So the general activities from the life cycle of the system are given below: 
 Select ion and identification of the system to be studied 
 Preliminary study 
 Defining the system 
 Design and development of the system 
 Implementation of the system
SYSTEM DESIGN 
Then we began with the design phase of the system. System design is a solution, a “HOW 
TO” approach to the creation of a new system. It translates system requirements into 
ways by which they can be made operational. It is a translational from a user oriented 
document to a document oriented programmers. For that, it provides the understanding 
and procedural details necessary for the implementation. Here we use Flowchart to 
supplement the working of the new system. The system thus made should be reliable, 
durable and above all should have least possible maintenance costs. It should overcome 
all the drawbacks of the Old existing system and most important of all meet the user 
requirements. 
START 
WELCOME TO GAME TIC TAC TOE 
Enter 
your 
choice 
? 
START CHOICE QUIT 
Do you want to 
continue? 
STOP
SOURCE CODE 
#include<iostream.h> 
#include<stdio.h> 
#include<conio.h> 
#include<graphics.h> 
#include<stdlib.h> 
#include<string.h> 
#include<dos.h> 
void*message; 
int select(int mult) 
{ 
union REGS inregs, outregs ; 
int bli=1,use=1,key=34,i; 
settextstyle(2,0,5); 
while(key!=28) 
{ 
if(bli>0) 
{ 
use=bli; 
setfillstyle(1,0); 
bli=0-bli; 
} 
else if(bli<0) 
{ 
use=0-bli; 
setfillstyle(1,8); 
bli=0-bli; 
} 
floodfill(221,111+use*40,15); 
delay(100); 
if(bli<0) 
{ 
key=kbhit(); 
if(kbhit()) 
{ 
inregs.h.ah = 0 ; 
int86(22, &inregs, &outregs) ; 
key=outregs.h.ah; 
} 
}
if((key==72)&&(use>1)) 
{ 
bli=use-1; 
} 
if((key==80)&&(use<mult)) 
{ 
bli=use+1; 
} 
} 
if(bli<0) 
bli=0-bli; 
return(bli); 
} 
void box(char mes[50]) 
{ putimage(5,5,message,0); 
settextstyle(0,0,1); 
outtextxy(20,30,mes); 
} 
void draw(char mn[3][3]) 
{ 
char as[3][3][3]; 
char num[9][3]; 
for(int i=0;i<10;i++) 
{ strcpy(num[i]," "); 
num[i][0]=char(49+i); 
} 
for(i=0;i<3;i++) 
for(int j=0;j<3;j++) 
strcpy(as[i][j]," "); 
for(i=0;i<3;i++) 
{ for(j=0;j<3;j++) 
{as[i][j][0]=mn[i][j];} 
} 
clearviewport(); 
setcolor(15); 
rectangle(0,0,639,479); 
setfillstyle(1,8); 
settextstyle(0,0,1); 
for(i=0;i<3;i++) 
{ 
rectangle(192,117+i*85,267,192+i*85); 
outtextxy(260,185+i*85,num[0+i*3]); 
rectangle(277,117+i*85,352,192+i*85); 
outtextxy(345,185+i*85,num[1+i*3]); 
rectangle(362,117+i*85,437,192+i*85); 
outtextxy(430,185+i*85,num[2+i*3]);
} 
floodfill(500,430,15); 
setcolor(15); 
settextstyle(1,0,4); 
for(i=0;i<3;i++) 
{ 
outtextxy(221,135+i*85,as[i][0]); 
outtextxy(306,135+i*85,as[i][1]); 
outtextxy(391,135+i*85,as[i][2]); 
} 
} 
void main() 
{ 
clrscr(); 
int gd=DETECT,gm; 
initgraph(&gd,&gm,""); 
message=malloc(imagesize(5,5,634,55)); 
setcolor(15); 
rectangle(5,5,634,55); 
setfillstyle(1,RED); 
floodfill(30,30,15); 
outtextxy(10,10,"Message:-"); 
getimage(5,5,634,55,message); 
char col[3][3],input,madu,comps,hums,mess[70]={"computer has selected the 
symbol . Press any key to continue.."}; 
int 
exii,dang[8],my[8],hard,many,result,guess=7,bre,mad=2,count=0,dont=0,play[8],p,q 
,end=0,note,inpu,first,use; 
do 
{guess=7;mad=2;count=0;dont=0;end=0;result=0; 
for(int i=0;i<8;i++) 
play[i]=0; 
many=0;exii=1; 
clearviewport(); 
setcolor(15); 
rectangle(0,0,639,479); 
rectangle(20,320,620,460); 
rectangle(220,150,390,180); 
rectangle(240,155,370,175); 
setfillstyle(1,8); 
floodfill(100,100,15); 
setcolor(15); 
settextstyle(4,0,4); 
outtextxy(200,50,"TIC TAC TOE"); 
settextstyle(3,0,1); 
outtextxy(40,290,"How to play :-");
outtextxy(35,330,"In this Game, you may select your symbol. You musttryattain"); 
outtextxy(26,350,"three of your symbols in a line. if you suceed you are the 
winner."); 
outtextxy(35,370," But at the same time you should prevent the computer from"); 
outtextxy(35,390,"getting three of its symbols in a line. To play enterthe number"); 
outtextxy(32,410,"associated with the place where you want to play.Press any key"); 
outtextxy(35,430,"to start"); 
settextstyle(2,0,6); 
outtextxy(258,155,"Start Game"); 
select(1); 
hard=2; 
for(int j=0;j<8;j++) 
{dang[j]=0;my[j]=0;play[j]=0;} 
for(j=0;j<3;j++) 
{ 
for(int k=0;k<3;k++) 
col[j][k]=' '; 
} 
draw(col); 
box("Please type in your symbol"); 
hums=getche(); 
if((hums!='X')&&(hums!='x') 
) 
comps='X'; 
else 
comps='0'; 
mess[33]=comps; 
box(mess); 
getch(); 
randomize(); 
first=(int(rand()%100)); 
if(hard==2)guess=(int(rand()%100)); 
else guess=5; 
if((first%4)>=2) 
{use=guess%3;box("Computer has the first chance to play!");} 
else 
{use=3; 
mad=0;box("You have the first chance to play!");} 
delay(2000); 
do 
{ 
for(int j=0;j<8;j++) 
{dang[j]=0;my[j]=0;} 
count++; 
mad++;bre=0; 
if((end!=1)&&(mad!=1))
{ 
switch(use) 
{ 
case 0:{ switch(count) 
{ 
case 1: col[2][2]=comps;break; 
case 2: {if(col[1][1]==hums) 
{col[0][0]=comps;play[0]=1;} 
else if((col[2][0]==hums)||(col[2][1]==hums)) 
{col[0][2]=comps;play[1]=1;} 
else if((col[0][1]==hums)) 
{col[0][2]=comps;play[3]=1;} 
else if((col[1][0]==hums)) 
{col[2][0]=comps;play[4]=1;} 
else if((col[0][2]==hums)||(col[1][2]==hums)) 
{col[2][0]=comps;play[2]=1;} 
else if (col[0][0]==hums) 
{col[0][2]=comps;play[3]=1;} 
else dont=1; 
}break; 
case 3:{if(play[0]==1) 
dont=1; 
else if((play[1]==1)&&(col[1][2]==hums)) 
{col[0][0]=comps;} 
else if((play[2]==1)&&(col[2][1]==hums)) 
{col[0][0]=comps;} 
else if((play[3]==1)&&((col[2][1]==hums)||(col[1][2]==hums))) 
{col[2][0]=comps;} 
else if((play[4]==1)&&(col[2][1]==hums)) 
{col[0][2]=comps;} 
else 
dont=1; 
}break; 
case 4:dont=1;break; 
} 
}break; 
case 1:{switch(count) 
{ case 1:col[0][1]=comps;break; 
case 2:{if(col[2][0]==hums) 
col[0][0]=comps; 
else if(col[1][0]==hums) 
col[0][0]=comps; 
else if(col[0][2]==hums) 
col[1][0]=comps; 
else if(col[1][2]==hums) 
col[0][2]=comps;
else if(col[0][0]==hums) 
col[1][2]=comps; 
else if(col[2][2]==hums) 
col[0][2]=comps; 
else if(q<=1) 
col[2][2]=comps; 
else 
col[2][0]=comps; 
} break; 
case 3:dont=1; 
} 
}break; 
case 2:{switch(count) 
{ case 1:col[1][1]=comps;break; 
case 2:dont=1; 
} 
}break; 
case 3:{dont=1; 
}break; 
} 
if(dont==1) 
{ 
for(int i=0,l=2;i<3;i++,l--) 
{ 
if(col[i][i]==hums) 
dang[0]++; 
else if(col[i][i]==comps) 
my[0]++; 
if(col[i][l]==hums) 
dang[1]++; 
else if(col[i][l]==comps) 
my[1]++; 
} 
for(j=0;j<3;j++) 
{ 
for(int k=0;k<3;k++) 
{ 
if(col[j][k]==hums) 
dang[j+2]++; 
else if(col[j][k]==comps) 
my[j+2]++; 
if(col[k][j]==hums) 
dang[j+5]++; 
else if(col[k][j]==comps) 
my[j+5]++;
} 
} 
for(int j=0;j<8;j++) 
{ 
if((my[j]==3)||(dang[j]==3)||(count==5)) 
end=1; 
if((dang[j]==2)&&(my[j]!=0)) 
dang[j]=0; 
if((my[j]==2)&&(dang[j]==0)) 
{my[j]=3;bre=1;} 
} 
if(bre==1) 
{for(j=0;j<8;j++) 
dang[j]=0; 
} 
if((dang[0]==2)||(my[0]==3)) 
{ 
for(int i=0;i<3;i++) 
{ if(col[i][i]==' ') 
col[i][i]=comps; 
}} 
else if((dang[1]==2)||(my[1]==3)) 
{ 
for(int i=0,l=2;i<3;i++,l--) 
{ if(col[i][l]==' ') 
col[i][l]=comps; 
}} 
else 
if((dang[2]==2)||(my[2]==3)||(dang[3]==2)||(my[3]==3)||(dang[4]==2)||(my[4 
]==3)) 
{ 
for(j=0;j<3;j++) 
{if((dang[j+2]==2)||(my[j+2]==3)) 
for(int k=0;k<3;k++) 
{if(col[j][k]==' ') 
{col[j][k]=comps;bre=1;}} 
} 
} 
else 
if((dang[5]==2)||(my[5]==3)||(dang[6]==2)||(my[6]==3)||(dang[7]==2)||(my[7 
]==3)) 
{ 
for(int j=0;j<3;j++) 
{if((dang[j+5]==2)||(my[j+5]==3))
for(int k=0;k<3;k++) 
{if(col[k][j]==' ') 
{col[k][j]=comps;bre=1;}} 
} 
} 
else if(col[1][1]==' ') 
col[1][1]=comps; 
else if((use==2)&&(col[2][2]==' ')) 
col[2][2]=comps; 
else if((use==2)&&(col[0][2]==' ')) 
col[0][2]=comps; 
else 
if((((col[0][0]==hums)&&(col[2][2]==hums))||((col[0][2]==hums)&&(col[2][0]==hu 
ms)))&&(col[1][2]==' '))col[1][2]=comps; 
else 
if((col[1][1]!=hums)&&((col[0][0]==hums)||(col[2][2]==hums))&&((col[0][1]==hums 
)||(col[1][2]==hums))&&(col[0][2]==' '))col[0][2]=comps; 
else 
if((col[1][1]!=hums)&&((col[0][0]==hums)||(col[2][2]==hums))&&((col[1][0]==hums 
)||(col[2][1]==hums))&&(col[2][0]==' '))col[2][0]=comps; 
else 
if((col[1][1]!=hums)&&((col[0][2]==hums)||(col[2][0]==hums))&&((col[2][1]==hums 
)||(col[1][2]==hums))&&(col[2][2]==' '))col[2][2]=comps; 
else 
if((col[1][1]!=hums)&&((col[0][2]==hums)||(col[2][0]==hums))&&((col[0][1]==hums 
)||(col[1][0]==hums))&&(col[0][0]==' '))col[0][0]=comps; 
else if((col[1][1]!=comps)&&(col[2][2]==' ')) 
col[2][2]=comps; 
else if((col[1][1]!=comps)&&(col[0][2]==' ')) 
col[0][2]=comps; 
else if(col[0][0]==' ') 
col[0][0]=comps; 
else if(col[2][2]==' ') 
col[2][2]=comps; 
else if(col[0][1]==' ') 
col[0][1]=comps; 
else if(col[1][2]==' ') 
col[1][2]=comps; 
else if(col[0][2]==' ') 
col[0][2]=comps; 
else if(col[2][0]==' ') 
col[2][0]=comps; 
else if(col[1][0]==' ') 
col[1][0]=comps; 
else if(col[2][1]==' ')
col[2][1]=comps; 
} 
for(int i=0;i<8;i++) 
{if(my[i]==3) 
end=1; 
} 
} 
star: 
draw(col); 
box(" "); 
if(end!=1) 
{ 
box("play"); 
madu=getche(); 
if((int(madu)<49)||(int(madu)>57)) 
{box("INVALID ENTRY!");for(long double jk=0;jk<99999999;jk++); 
goto star;} 
inpu=int(madu)-48; 
p=(inpu-1)/3; 
switch(inpu%3) 
{case 0:q=2;break; 
case 1:q=0;break; 
case 2:q=1;break; 
} 
if(col[p][q]!=' ') 
{box("Space is already occupied!");for(long double 
jk=0;jk<99999999;jk++);goto star;} 
col[p][q]=hums; 
} 
for(j=0;j<8;j++) 
{dang[j]=0;my[j]=0;} 
for(int i=0,l=2;i<3;i++,l--) 
{ 
if(col[i][i]==hums) 
dang[0]++; 
else if(col[i][i]==comps) 
my[0]++; 
if(col[i][l]==hums) 
dang[1]++; 
else if(col[i][l]==comps) 
my[1]++; 
} 
for(j=0;j<3;j++) 
{ 
for(int k=0;k<3;k++) 
{
if(col[j][k]==hums) 
dang[j+2]++; 
else if(col[j][k]==comps) 
my[j+2]++; 
if(col[k][j]==hums) 
dang[j+5]++; 
else if(col[k][j]==comps) 
my[j+5]++; 
} 
} 
for(j=0;j<8;j++) 
{if((my[j]==3)||(dang[j]==3)) 
end=1; 
} 
}while((end!=1)); 
draw(col); 
for(int asd=0;asd<6;asd++) 
{many=many+1; 
if((my[0]==3)||(dang[0]==3)) 
{exii=0; 
if(many%2==1) 
for(int m=0,n=0;m<3;m++,n++) 
{ setfillstyle(1,BLUE);floodfill(193+m*85,118+n*85,15); } 
else 
for(int m=0,n=0;m<3;m++,n++) 
{ setfillstyle(1,BLACK);floodfill(193+m*85,118+n*85,15); }} 
else if((my[1]==3)||(dang[1]==3)) 
{exii=0; 
if(many%2==1) 
for(int m=0,n=2;m<3;m++,n--) 
{ setfillstyle(1,BLUE);floodfill(193+m*85,118+n*85,15); } 
else 
for(int m=0,n=2;m<3;m++,n--) 
{ setfillstyle(1,BLACK);floodfill(193+m*85,118+n*85,15); }} 
else for(j=2;j<8;j++) 
{if(((my[j]==3)||(dang[j]==3))&&(j<5)) 
{exii=0; 
if(many%2==1) 
for(int m=0,n=j-2;m<3;m++) 
{ setfillstyle(1,BLUE);floodfill(193+m*85,118+n*85,15); } 
else 
for(int m=0,n=j-2;m<3;m++) 
{ setfillstyle(1,BLACK);floodfill(193+m*85,118+n*85,15); }} 
else if((my[j]==3)||(dang[j]==3)) 
{exii=0; 
if(many%2==1)
for(int m=0,n=j-5;m<3;m++) 
{ setfillstyle(1,BLUE);floodfill(193+n*85,118+m*85,15); } 
else 
for(int m=0,n=j-5;m<3;m++) 
{ setfillstyle(1,BLACK);floodfill(193+n*85,118+m*85,15); }} 
} 
for(long double jk=0;jk<9999999;jk++); 
if(exii==1)break; 
} 
for(int m=0;m<8;m++) 
{ if(my[m]==3) 
result=1; 
} 
for(m=0;m<8;m++) 
{ if(dang[m]==3) 
result=2; } 
switch(result) 
{case 1:box("You loose! Want to try again(y/n)");break; 
case 2:box("You win! Want to try again(y/n)");break; 
default:box("The game is draw! Want to try again(y/n)");break; 
} 
input=getche(); 
}while(input=='Y'||input=='y'); 
clearviewport(); 
setlinestyle(3,4,6); 
outtextxy(80,150,"This game is developed by SUNDEEP YADAV"); 
outtextxy(170,175,"from the PROGRAMME B.TECH-M.TECH-C.S.E(246)"); 
delay(4000); 
for(long double mas=0;mas<=99999999;mas++); 
exit(0); 
}
TESTING 
Testing is the major control measure used during software development. Its basic 
function is to detect errors in the software. During requirement analysis and design, the 
output is a document that is usually textual and no executable. After the coding phase, 
computer programs are available that can be executed for testing purpose. This implies 
that testing not only, has to uncover errors introduced during coding, but also errors 
introduced during previous phase. Thus the goal of testing is to uncover the requirements, 
design and coding errors in the programs. So after testing the outputs of my project are as 
follows: 
** Paste the outputs of your project
FUTURE SCOPE OF THE PROJECT 
Our project will be able to implement in future after making some changes and 
modifications as we make our project at a very low level. So the modifications that can 
be done in our project are: 
In future one change can be done by adding the fingerprints of the persons of which the 
address is entered.And one more major change which can be done in this project is that to 
add the snaps of the person of which the address is entered.We can also add or subtract 
details of the individual.

More Related Content

PDF
Project black book TYIT
DOC
Medical store management system
DOCX
Major File On web Development
DOC
C programming project by navin thapa
PDF
Contact management system
PDF
Report on e-Notice App (An Android Application)
DOC
Student record
PPTX
Project Documentation Student Management System format.pptx
Project black book TYIT
Medical store management system
Major File On web Development
C programming project by navin thapa
Contact management system
Report on e-Notice App (An Android Application)
Student record
Project Documentation Student Management System format.pptx

What's hot (20)

PPTX
Tic tac toe game with graphics presentation
PPTX
Tic tac toe
DOC
Tic tac toe
PPTX
Weather app presentation
PDF
A project report on chat application
PPTX
Quiz application
PDF
snake game
PPT
Spiral model presentation
PDF
Phone book with project report for BCA,MCA
PDF
Python final ppt
PDF
Snake Game Flow Chart
DOCX
college website project report
PPT
Breakout Ball project presentation
PPTX
report on snake game
PPTX
Book Shop Management System
PPT
Software development slides
PPTX
Voice assistant ppt
DOCX
The complete srs documentation of our developed game.
PPT
project on snake game in c language
PDF
Data Structures Practical File
Tic tac toe game with graphics presentation
Tic tac toe
Tic tac toe
Weather app presentation
A project report on chat application
Quiz application
snake game
Spiral model presentation
Phone book with project report for BCA,MCA
Python final ppt
Snake Game Flow Chart
college website project report
Breakout Ball project presentation
report on snake game
Book Shop Management System
Software development slides
Voice assistant ppt
The complete srs documentation of our developed game.
project on snake game in c language
Data Structures Practical File
Ad

Similar to Tic tac toe game code (20)

DOC
Book store automation system
PDF
Student information management system project report ii.pdf
PDF
STUDENT INFORMATION MANAGEMENT SYSTEM PROJECT REPORT II
DOC
Fee collection system
PDF
Telephone billing system project report project.pdf
DOCX
College Management System project
DOC
Introduction and objectives of the project
PDF
COMPUTER INSTITUTE Management system.pdf
PDF
Ignou MCA mini project report
PDF
Documentation project of college management [1]
PDF
System Proposal(Personal Information & Leave Management System)
PDF
Event Management System Vb Net Project Report.pdf
PDF
Library Management System using oracle database
DOC
School management System
PDF
Online examination management system..pdf
DOC
student-data-management-1-2.doc
PDF
Durgesh o level_2nd_part
PDF
lake city institute of technology
PDF
666 computer technology 7th sem
PDF
Mca sem1syll
Book store automation system
Student information management system project report ii.pdf
STUDENT INFORMATION MANAGEMENT SYSTEM PROJECT REPORT II
Fee collection system
Telephone billing system project report project.pdf
College Management System project
Introduction and objectives of the project
COMPUTER INSTITUTE Management system.pdf
Ignou MCA mini project report
Documentation project of college management [1]
System Proposal(Personal Information & Leave Management System)
Event Management System Vb Net Project Report.pdf
Library Management System using oracle database
School management System
Online examination management system..pdf
student-data-management-1-2.doc
Durgesh o level_2nd_part
lake city institute of technology
666 computer technology 7th sem
Mca sem1syll
Ad

More from Upendra Sengar (15)

DOC
Shipping and Storage: A New Approach
PDF
Sales and inventory management project report
PPT
Data flow diagram for order system
PPT
Data flow diagram
DOCX
Analog term paper
PDF
Photo-Elctric Effect
DOC
Ums in c
DOC
DOC
Ticket window & automation system
DOC
Term paper of cse(211) avdhesh sharma c1801 a24 regd 10802037
DOC
Telephone directory
DOC
Snake game implementation in c
DOC
Scientific calculator in c
DOC
Telephone directory in c
PPT
Bluetooth technology
Shipping and Storage: A New Approach
Sales and inventory management project report
Data flow diagram for order system
Data flow diagram
Analog term paper
Photo-Elctric Effect
Ums in c
Ticket window & automation system
Term paper of cse(211) avdhesh sharma c1801 a24 regd 10802037
Telephone directory
Snake game implementation in c
Scientific calculator in c
Telephone directory in c
Bluetooth technology

Recently uploaded (20)

PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PPTX
Geodesy 1.pptx...............................................
PDF
Digital Logic Computer Design lecture notes
PPTX
UNIT 4 Total Quality Management .pptx
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PDF
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
PPTX
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PPTX
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
PPT
Mechanical Engineering MATERIALS Selection
PDF
PPT on Performance Review to get promotions
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PPTX
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
PPTX
Sustainable Sites - Green Building Construction
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PPTX
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
Geodesy 1.pptx...............................................
Digital Logic Computer Design lecture notes
UNIT 4 Total Quality Management .pptx
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
Mechanical Engineering MATERIALS Selection
PPT on Performance Review to get promotions
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
Sustainable Sites - Green Building Construction
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
Operating System & Kernel Study Guide-1 - converted.pdf
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx

Tic tac toe game code

  • 1. FORMAT OF TERM PAPER 1. Title page of project report 2. Table of contents 3. Introduction 4. Proposed system i. Description ii. System requirements 5. Requirement Analysis 6. System Design 7. Source code 8. Testing 9. Future scope of project
  • 2. OF (TIC TAC TOE) Submitted in the partial fulfillment of the Degree of Bachelor of Technology (Integrated) In Computer Science and Engineering SUBMITTED BY:- GUIDED BY: Name ANIL KUMAR Miss Sukhdilpreet Kaur Regd. No.10802020 RollnoR246B55 SUBMITTED TO Department of Computer Science and Engineering Lovely Professional University Phagwara
  • 3. ACKNOWLEDGEMENT I take this opportunity to present my votes of thanks to all those guidepost who really acted as lightening pillars to enlighten our way throughout this project that has led to successful and satisfactory completion of this study. We are really grateful to our HOD Mr. Rohit Dhand for providing us with an opportunity to undertake this project in this university and providing us with all the facilities. We are highly thankful to Miss Sukhdilpreet Kaur for her active support, valuable time and advice, whole-hearted guidance, sincere cooperation and pains-taking involvement during the study and in completing the assignment of preparing the said project within the time stipulated. Lastly, We are thankful to all those, particularly the various friends , who have been instrumental in creating proper, healthy and conductive environment and including new and fresh innovative ideas for us during the project, their help, it would have been extremely difficult for us to prepare the project in a time bound framework. Name ANIL KUMAR Regd. No.10802020 Roll No.R246B55
  • 4. TABLE OF CONTENTS 1. Introduction 2. Proposed system i. Description ii. System requirements 3. Requirement Analysis 4. System Design 5. Source code 6. Testing 7. Future scope of project
  • 5. INTRODUCTION In the existing system, most of the records are maintained on paper. It becomes very inconvenient to modify the data. In the existing system, here is a possibility that the same data in different registers may have different values which means the entries of the same data do not match. This inconsistent state does not supply the concrete information which poses a problem in the case information related to particular search record. Our project is very useful. User is no longer required to check his register in search of records, as now it can be searched over the software by choosing some options. The user need not to type in most of the information. He/she is just required to enter the desired options. On the whole it liberates the user from keeping lengthy manual records. In a nutshell, it abates the work load of an organization. In today’s world, no one likes to perform calculations on calculator or manually when computer is there. Every one wants his/her work to be done by computer automatically and displaying the result for further manipulations.
  • 6. PROPOSED SYSTEM The following documentation is a project the “Name of the term paper allotted”. It is a detailed summary of all the drawbacks of the old system and how the new proposed system overcomes these shortcomings. The new system takes into account the various factors while designing a new system. It keeps into the account the Economical bandwidth available for the new system. The foremost thing that is taken care of is the Need and Requirements of the User. DESCRIPTION Before developing software we keep following things in mind that we can develop powerful and quality software PROBLEM STATEMENT o Problem statement was to design a module: o Which is user friendly o Which will restrict the user from accessing other user’s data. o Which will help user in viewing his data and privileges. o Which will help the administrator to handle all the changes. FUNCTIONS TO BE PROVIDED: The system will be user friendly and completely menu driven so that the users shall have no problem in using all options. o The system will be efficient and fast in response. o The system will be customized according to needs. SYSTEM REQUIRMENTS Operating system: MS Windows XP or Windows Vista Language: C Language Processor: Pentium IV Processor RAM: 512 MB Hard disk: 5 GB
  • 7. REQUIREMENT ANALYSIS This process is adopted when management of the system development, Personnel decide that the particular system needs improvement. The system development life cycle is the set of activities, carried out by the analyst, designers and users to develop and implement a system. The systems that are present in the nature follow common life cycle pattern. For example consider the raining system. Initially the rain falls into the river, river flows into sea, the sea water evaporates to form vapors, the vapors form clouds which again bring rain. Similarly consider a man made system initially a system is analyzed, designed and made operational by the efforts of system analysis. After successful operation or a number of users, the system becomes less and less effective by change in the environment. So these changes have to be incorporated in to the system by minor modifications. So the general activities from the life cycle of the system are given below:  Select ion and identification of the system to be studied  Preliminary study  Defining the system  Design and development of the system  Implementation of the system
  • 8. SYSTEM DESIGN Then we began with the design phase of the system. System design is a solution, a “HOW TO” approach to the creation of a new system. It translates system requirements into ways by which they can be made operational. It is a translational from a user oriented document to a document oriented programmers. For that, it provides the understanding and procedural details necessary for the implementation. Here we use Flowchart to supplement the working of the new system. The system thus made should be reliable, durable and above all should have least possible maintenance costs. It should overcome all the drawbacks of the Old existing system and most important of all meet the user requirements. START WELCOME TO GAME TIC TAC TOE Enter your choice ? START CHOICE QUIT Do you want to continue? STOP
  • 9. SOURCE CODE #include<iostream.h> #include<stdio.h> #include<conio.h> #include<graphics.h> #include<stdlib.h> #include<string.h> #include<dos.h> void*message; int select(int mult) { union REGS inregs, outregs ; int bli=1,use=1,key=34,i; settextstyle(2,0,5); while(key!=28) { if(bli>0) { use=bli; setfillstyle(1,0); bli=0-bli; } else if(bli<0) { use=0-bli; setfillstyle(1,8); bli=0-bli; } floodfill(221,111+use*40,15); delay(100); if(bli<0) { key=kbhit(); if(kbhit()) { inregs.h.ah = 0 ; int86(22, &inregs, &outregs) ; key=outregs.h.ah; } }
  • 10. if((key==72)&&(use>1)) { bli=use-1; } if((key==80)&&(use<mult)) { bli=use+1; } } if(bli<0) bli=0-bli; return(bli); } void box(char mes[50]) { putimage(5,5,message,0); settextstyle(0,0,1); outtextxy(20,30,mes); } void draw(char mn[3][3]) { char as[3][3][3]; char num[9][3]; for(int i=0;i<10;i++) { strcpy(num[i]," "); num[i][0]=char(49+i); } for(i=0;i<3;i++) for(int j=0;j<3;j++) strcpy(as[i][j]," "); for(i=0;i<3;i++) { for(j=0;j<3;j++) {as[i][j][0]=mn[i][j];} } clearviewport(); setcolor(15); rectangle(0,0,639,479); setfillstyle(1,8); settextstyle(0,0,1); for(i=0;i<3;i++) { rectangle(192,117+i*85,267,192+i*85); outtextxy(260,185+i*85,num[0+i*3]); rectangle(277,117+i*85,352,192+i*85); outtextxy(345,185+i*85,num[1+i*3]); rectangle(362,117+i*85,437,192+i*85); outtextxy(430,185+i*85,num[2+i*3]);
  • 11. } floodfill(500,430,15); setcolor(15); settextstyle(1,0,4); for(i=0;i<3;i++) { outtextxy(221,135+i*85,as[i][0]); outtextxy(306,135+i*85,as[i][1]); outtextxy(391,135+i*85,as[i][2]); } } void main() { clrscr(); int gd=DETECT,gm; initgraph(&gd,&gm,""); message=malloc(imagesize(5,5,634,55)); setcolor(15); rectangle(5,5,634,55); setfillstyle(1,RED); floodfill(30,30,15); outtextxy(10,10,"Message:-"); getimage(5,5,634,55,message); char col[3][3],input,madu,comps,hums,mess[70]={"computer has selected the symbol . Press any key to continue.."}; int exii,dang[8],my[8],hard,many,result,guess=7,bre,mad=2,count=0,dont=0,play[8],p,q ,end=0,note,inpu,first,use; do {guess=7;mad=2;count=0;dont=0;end=0;result=0; for(int i=0;i<8;i++) play[i]=0; many=0;exii=1; clearviewport(); setcolor(15); rectangle(0,0,639,479); rectangle(20,320,620,460); rectangle(220,150,390,180); rectangle(240,155,370,175); setfillstyle(1,8); floodfill(100,100,15); setcolor(15); settextstyle(4,0,4); outtextxy(200,50,"TIC TAC TOE"); settextstyle(3,0,1); outtextxy(40,290,"How to play :-");
  • 12. outtextxy(35,330,"In this Game, you may select your symbol. You musttryattain"); outtextxy(26,350,"three of your symbols in a line. if you suceed you are the winner."); outtextxy(35,370," But at the same time you should prevent the computer from"); outtextxy(35,390,"getting three of its symbols in a line. To play enterthe number"); outtextxy(32,410,"associated with the place where you want to play.Press any key"); outtextxy(35,430,"to start"); settextstyle(2,0,6); outtextxy(258,155,"Start Game"); select(1); hard=2; for(int j=0;j<8;j++) {dang[j]=0;my[j]=0;play[j]=0;} for(j=0;j<3;j++) { for(int k=0;k<3;k++) col[j][k]=' '; } draw(col); box("Please type in your symbol"); hums=getche(); if((hums!='X')&&(hums!='x') ) comps='X'; else comps='0'; mess[33]=comps; box(mess); getch(); randomize(); first=(int(rand()%100)); if(hard==2)guess=(int(rand()%100)); else guess=5; if((first%4)>=2) {use=guess%3;box("Computer has the first chance to play!");} else {use=3; mad=0;box("You have the first chance to play!");} delay(2000); do { for(int j=0;j<8;j++) {dang[j]=0;my[j]=0;} count++; mad++;bre=0; if((end!=1)&&(mad!=1))
  • 13. { switch(use) { case 0:{ switch(count) { case 1: col[2][2]=comps;break; case 2: {if(col[1][1]==hums) {col[0][0]=comps;play[0]=1;} else if((col[2][0]==hums)||(col[2][1]==hums)) {col[0][2]=comps;play[1]=1;} else if((col[0][1]==hums)) {col[0][2]=comps;play[3]=1;} else if((col[1][0]==hums)) {col[2][0]=comps;play[4]=1;} else if((col[0][2]==hums)||(col[1][2]==hums)) {col[2][0]=comps;play[2]=1;} else if (col[0][0]==hums) {col[0][2]=comps;play[3]=1;} else dont=1; }break; case 3:{if(play[0]==1) dont=1; else if((play[1]==1)&&(col[1][2]==hums)) {col[0][0]=comps;} else if((play[2]==1)&&(col[2][1]==hums)) {col[0][0]=comps;} else if((play[3]==1)&&((col[2][1]==hums)||(col[1][2]==hums))) {col[2][0]=comps;} else if((play[4]==1)&&(col[2][1]==hums)) {col[0][2]=comps;} else dont=1; }break; case 4:dont=1;break; } }break; case 1:{switch(count) { case 1:col[0][1]=comps;break; case 2:{if(col[2][0]==hums) col[0][0]=comps; else if(col[1][0]==hums) col[0][0]=comps; else if(col[0][2]==hums) col[1][0]=comps; else if(col[1][2]==hums) col[0][2]=comps;
  • 14. else if(col[0][0]==hums) col[1][2]=comps; else if(col[2][2]==hums) col[0][2]=comps; else if(q<=1) col[2][2]=comps; else col[2][0]=comps; } break; case 3:dont=1; } }break; case 2:{switch(count) { case 1:col[1][1]=comps;break; case 2:dont=1; } }break; case 3:{dont=1; }break; } if(dont==1) { for(int i=0,l=2;i<3;i++,l--) { if(col[i][i]==hums) dang[0]++; else if(col[i][i]==comps) my[0]++; if(col[i][l]==hums) dang[1]++; else if(col[i][l]==comps) my[1]++; } for(j=0;j<3;j++) { for(int k=0;k<3;k++) { if(col[j][k]==hums) dang[j+2]++; else if(col[j][k]==comps) my[j+2]++; if(col[k][j]==hums) dang[j+5]++; else if(col[k][j]==comps) my[j+5]++;
  • 15. } } for(int j=0;j<8;j++) { if((my[j]==3)||(dang[j]==3)||(count==5)) end=1; if((dang[j]==2)&&(my[j]!=0)) dang[j]=0; if((my[j]==2)&&(dang[j]==0)) {my[j]=3;bre=1;} } if(bre==1) {for(j=0;j<8;j++) dang[j]=0; } if((dang[0]==2)||(my[0]==3)) { for(int i=0;i<3;i++) { if(col[i][i]==' ') col[i][i]=comps; }} else if((dang[1]==2)||(my[1]==3)) { for(int i=0,l=2;i<3;i++,l--) { if(col[i][l]==' ') col[i][l]=comps; }} else if((dang[2]==2)||(my[2]==3)||(dang[3]==2)||(my[3]==3)||(dang[4]==2)||(my[4 ]==3)) { for(j=0;j<3;j++) {if((dang[j+2]==2)||(my[j+2]==3)) for(int k=0;k<3;k++) {if(col[j][k]==' ') {col[j][k]=comps;bre=1;}} } } else if((dang[5]==2)||(my[5]==3)||(dang[6]==2)||(my[6]==3)||(dang[7]==2)||(my[7 ]==3)) { for(int j=0;j<3;j++) {if((dang[j+5]==2)||(my[j+5]==3))
  • 16. for(int k=0;k<3;k++) {if(col[k][j]==' ') {col[k][j]=comps;bre=1;}} } } else if(col[1][1]==' ') col[1][1]=comps; else if((use==2)&&(col[2][2]==' ')) col[2][2]=comps; else if((use==2)&&(col[0][2]==' ')) col[0][2]=comps; else if((((col[0][0]==hums)&&(col[2][2]==hums))||((col[0][2]==hums)&&(col[2][0]==hu ms)))&&(col[1][2]==' '))col[1][2]=comps; else if((col[1][1]!=hums)&&((col[0][0]==hums)||(col[2][2]==hums))&&((col[0][1]==hums )||(col[1][2]==hums))&&(col[0][2]==' '))col[0][2]=comps; else if((col[1][1]!=hums)&&((col[0][0]==hums)||(col[2][2]==hums))&&((col[1][0]==hums )||(col[2][1]==hums))&&(col[2][0]==' '))col[2][0]=comps; else if((col[1][1]!=hums)&&((col[0][2]==hums)||(col[2][0]==hums))&&((col[2][1]==hums )||(col[1][2]==hums))&&(col[2][2]==' '))col[2][2]=comps; else if((col[1][1]!=hums)&&((col[0][2]==hums)||(col[2][0]==hums))&&((col[0][1]==hums )||(col[1][0]==hums))&&(col[0][0]==' '))col[0][0]=comps; else if((col[1][1]!=comps)&&(col[2][2]==' ')) col[2][2]=comps; else if((col[1][1]!=comps)&&(col[0][2]==' ')) col[0][2]=comps; else if(col[0][0]==' ') col[0][0]=comps; else if(col[2][2]==' ') col[2][2]=comps; else if(col[0][1]==' ') col[0][1]=comps; else if(col[1][2]==' ') col[1][2]=comps; else if(col[0][2]==' ') col[0][2]=comps; else if(col[2][0]==' ') col[2][0]=comps; else if(col[1][0]==' ') col[1][0]=comps; else if(col[2][1]==' ')
  • 17. col[2][1]=comps; } for(int i=0;i<8;i++) {if(my[i]==3) end=1; } } star: draw(col); box(" "); if(end!=1) { box("play"); madu=getche(); if((int(madu)<49)||(int(madu)>57)) {box("INVALID ENTRY!");for(long double jk=0;jk<99999999;jk++); goto star;} inpu=int(madu)-48; p=(inpu-1)/3; switch(inpu%3) {case 0:q=2;break; case 1:q=0;break; case 2:q=1;break; } if(col[p][q]!=' ') {box("Space is already occupied!");for(long double jk=0;jk<99999999;jk++);goto star;} col[p][q]=hums; } for(j=0;j<8;j++) {dang[j]=0;my[j]=0;} for(int i=0,l=2;i<3;i++,l--) { if(col[i][i]==hums) dang[0]++; else if(col[i][i]==comps) my[0]++; if(col[i][l]==hums) dang[1]++; else if(col[i][l]==comps) my[1]++; } for(j=0;j<3;j++) { for(int k=0;k<3;k++) {
  • 18. if(col[j][k]==hums) dang[j+2]++; else if(col[j][k]==comps) my[j+2]++; if(col[k][j]==hums) dang[j+5]++; else if(col[k][j]==comps) my[j+5]++; } } for(j=0;j<8;j++) {if((my[j]==3)||(dang[j]==3)) end=1; } }while((end!=1)); draw(col); for(int asd=0;asd<6;asd++) {many=many+1; if((my[0]==3)||(dang[0]==3)) {exii=0; if(many%2==1) for(int m=0,n=0;m<3;m++,n++) { setfillstyle(1,BLUE);floodfill(193+m*85,118+n*85,15); } else for(int m=0,n=0;m<3;m++,n++) { setfillstyle(1,BLACK);floodfill(193+m*85,118+n*85,15); }} else if((my[1]==3)||(dang[1]==3)) {exii=0; if(many%2==1) for(int m=0,n=2;m<3;m++,n--) { setfillstyle(1,BLUE);floodfill(193+m*85,118+n*85,15); } else for(int m=0,n=2;m<3;m++,n--) { setfillstyle(1,BLACK);floodfill(193+m*85,118+n*85,15); }} else for(j=2;j<8;j++) {if(((my[j]==3)||(dang[j]==3))&&(j<5)) {exii=0; if(many%2==1) for(int m=0,n=j-2;m<3;m++) { setfillstyle(1,BLUE);floodfill(193+m*85,118+n*85,15); } else for(int m=0,n=j-2;m<3;m++) { setfillstyle(1,BLACK);floodfill(193+m*85,118+n*85,15); }} else if((my[j]==3)||(dang[j]==3)) {exii=0; if(many%2==1)
  • 19. for(int m=0,n=j-5;m<3;m++) { setfillstyle(1,BLUE);floodfill(193+n*85,118+m*85,15); } else for(int m=0,n=j-5;m<3;m++) { setfillstyle(1,BLACK);floodfill(193+n*85,118+m*85,15); }} } for(long double jk=0;jk<9999999;jk++); if(exii==1)break; } for(int m=0;m<8;m++) { if(my[m]==3) result=1; } for(m=0;m<8;m++) { if(dang[m]==3) result=2; } switch(result) {case 1:box("You loose! Want to try again(y/n)");break; case 2:box("You win! Want to try again(y/n)");break; default:box("The game is draw! Want to try again(y/n)");break; } input=getche(); }while(input=='Y'||input=='y'); clearviewport(); setlinestyle(3,4,6); outtextxy(80,150,"This game is developed by SUNDEEP YADAV"); outtextxy(170,175,"from the PROGRAMME B.TECH-M.TECH-C.S.E(246)"); delay(4000); for(long double mas=0;mas<=99999999;mas++); exit(0); }
  • 20. TESTING Testing is the major control measure used during software development. Its basic function is to detect errors in the software. During requirement analysis and design, the output is a document that is usually textual and no executable. After the coding phase, computer programs are available that can be executed for testing purpose. This implies that testing not only, has to uncover errors introduced during coding, but also errors introduced during previous phase. Thus the goal of testing is to uncover the requirements, design and coding errors in the programs. So after testing the outputs of my project are as follows: ** Paste the outputs of your project
  • 21. FUTURE SCOPE OF THE PROJECT Our project will be able to implement in future after making some changes and modifications as we make our project at a very low level. So the modifications that can be done in our project are: In future one change can be done by adding the fingerprints of the persons of which the address is entered.And one more major change which can be done in this project is that to add the snaps of the person of which the address is entered.We can also add or subtract details of the individual.