Tic Tack To Game
Tic Tack To Game
“Employee Slip”
Is done by
Vishal Jagdale,
Santosh Gonkar,
Ashish Bhoir
Is submitted for
For
The diploma
In
1. INTRODUCTION
Our project name is Tic-Tac-Toe game. This game is very popular and is
Fairly simple by itself. It is actually a two player game. In this game, there is
a board with n x n squares. In our game, it is 3 x 3 squares.
The goal of Tic-Tac-Toe is to be one of the players to get three same
Symbols in a row - horizontally, vertically or diagonally - on a 3 x 3 grid..
2. AIM OF MICRO PROJECT
While performing the project we have learned many useful and creative things,
which is very useful for us to develop our mind.
We have learned to make relevant use of ‘Turbo C’ while performing the project.
3. ACTION PLAN
4. RESOURCE REQUIRED
1. BRIEF DSCRIPTION
While performing this micro project we have learned to produce C program using various
functions to get an output of a Store Tic tac toe.
2. AIM OF MICRO PROJECT
In this project we have learned to develop a C program for a Tic tac toe.
3. COURCE OUTCOME INTEGRATED
Manipulate visual and geometric information of image.
Implement standard algorithms to draw varies graphics object using c program.
6. SKILL DEVELOPED
Learned to implement a C program using various graphics objects.
Program Code:
#include <stdio.h>
/*print matrix*/
void printMatrix(char val);
/*update value in matrix*/
void insertValue(int i,int j,unsigned char user);
/*check matrix is full or not*/
unsigned char isFull(void);
/*check game is completed or not.*/
unsigned char isOver(void);
int main()
{
unsigned char user1[30],user2[30],winner;
int ival,jval;
again:
system("clear");
printf("\n\n\n\n");
if(!onlyOnce) {printMatrix(0); onlyOnce=1;}
else { printMatrix(1);}
winner=isOver();
if(winner)
{
printf("\n *** Congratulations Dear %s ,\n You have won the
game . !!!!",((winner=='X')?user1:user2));
goto end;
}
repeat:
fflush(stdin);
printf("\n *** %s , Enter value (00-22) seperated by space :",(usertern==0x00?
user1:user2));
scanf("%d%d",&ival,&jval);
if( (ival>2 || ival<0) || (jval>2 || jval<0)) {
printf("\n *** ERROR : Invalid index, try again !!!");
goto repeat;
}
if(mat[ival][jval]!='_'){printf("\n *** ERROR : Already filled,try again !!!"); goto
repeat;}
insertValue(ival,jval,usertern);
usertern=!usertern;
goto again;
end:
printf("\n");return 0;
}
for(i=0;i<3;i++){
printf("\t\t\t");
for(j=0;j<3;j++){printf("[%3c ] ",mat[i][j]);} printf("\n");
}
return;
}
for(i=0;i<3;i++){
printf("\t\t\t");
for(j=0;j<3;j++){printf("[%3c ] ",mat[i][j]);} printf("\n");
}
return;
}
if(sum==237||sum==264){return storeChar;}
}
// case 2
for(i=0;i<3;i++)
{ sum=0;
for(j=0;j<3;j++)
{
if(mat[j][i]=='_') break;
sum+=mat[j][i];
storeChar=mat[j][i];
}
if(sum==237||sum==264){return storeChar;}
}
// case 3
for(i=0;i<3;i++)
{
sum=0;
for(j=0;j<3;j++)
{
if(i==j){
if(mat[i][j]=='_') break;
sum+=mat[i][j];
storeChar=mat[i][j];
}
}
if(sum==237||sum==264){ return storeChar;}
}
return 0;
8. Output:
9. Skill developed / learning out of this micro-project
we learned how to Keep your analysis in the business world, using business words, with
encapsulation of related strings and numbers into classes.
10.Conclusion
The Tic Tac Toe game is most familiar among all the age groups. Intelligence can be a
property of any purpose-driven decision maker. This basic idea has been suggested many
times. An algorithm of playing Tic Tac Toe has been presented and tested that works in
efficient way. Overall the system works without any bugs.