0% found this document useful (1 vote)
407 views

Tic Tack To Game

This document certifies that the micro project "Employee Slip" was completed by Vishal Jagdale, Santosh Gonkar, and Ashish Bhoir. It was submitted for the computer graphics course to earn a diploma in computer engineering from the Maharashtra State Board of Technical Education. The micro project involved developing a Tic Tac Toe game program in C++ that allows two users to play the game, tracks turns and checks for a winner. By completing this project, the students learned to implement a graphical C++ program using functions.

Uploaded by

Ashish Bhoir
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (1 vote)
407 views

Tic Tack To Game

This document certifies that the micro project "Employee Slip" was completed by Vishal Jagdale, Santosh Gonkar, and Ashish Bhoir. It was submitted for the computer graphics course to earn a diploma in computer engineering from the Maharashtra State Board of Technical Education. The micro project involved developing a Tic Tac Toe game program in C++ that allows two users to play the game, tracks turns and checks for a winner. By completing this project, the students learned to implement a graphical C++ program using functions.

Uploaded by

Ashish Bhoir
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 13

This is to certify that the micro project

“Employee Slip”

Is done by

Vishal Jagdale,

Santosh Gonkar,

Ashish Bhoir

Is submitted for

Computer Graphics (cgr)

For

The diploma

In

Computer Engineering to the

Maharashtra State Board of Technical Education, Mumbai

(Autonomous) (ISO-9001-2008) (ISO/IEC 27001:2013)

Subject Incharge H.O.D Principal

(Mrs. Smita Kuldiwar) (Mrs. Manisha Patil) (Prof.D.R.Suroshe)


Micro project Proposal

Tic tac toe

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

S. No. Details of activity Planned Start Planned Finish Name of Responsible


date date Team Members

1 Analysis 20-09-2019 25-09-2019 Vishal Jagdale

2 Programming code 26-09-2019 1-10-2019 Santosh Gonkar

3 Implementation 1-10-2019 4-10-2019 Ashish Bhoir

4. RESOURCE REQUIRED

S. No. Name Of Software Required Specification Remark


1 Turbo C++ Intel-i3 , 2gb RAM
Outcomes of micro project

Tic tac toe

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.

4. ACTUAL PROCEDURE FOLLOWED

S. No. Details of activity Planed Start Planned Finish Name of Responsible


date date Team Members

1 Analysis 20-09-2019 25-09-2019 Vishal Jagdale

2 Programming code 26-09-2019 1-10-2019 Santosh Gonkar

3 Implementation 1-10-2019 4-10-2019 Ashish Bhoir

5. ACTUAL RESOURCES USED

S. No. Name Of Software Required Specification Remark


1 Turbo C Intel i3 , 2gb RAM

6. SKILL DEVELOPED
Learned to implement a C program using various graphics objects.

7. OUTPUT OF MICRO PROJECT

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);

unsigned char mat[3][3]={'_','_','_','_','_','_','_','_','_'};


unsigned char usertern=0;
unsigned char onlyOnce=0;

int main()
{
unsigned char user1[30],user2[30],winner;
int ival,jval;

printf("\nEnter name of user1 :");


gets(user1);
fflush(stdin);

printf("Enter name of user2 :");


gets(user2);
fflush(stdin);

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;
}

if(!isFull()) {printf("\n *** Game Over ."); 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;
}

void printMatrix(char val)


{
unsigned char i,j;
if(!val){
/*For blank matrix*/

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;
}

void insertValue(int i,int j,unsigned char user){


// printf("\n ##### %d, %d ###\n",i,j);
mat[i][j]=((user==0x00)?'X':'O');
}

unsigned char isFull(void){


unsigned char i,j,count=0;;
for(i=0;i<3;i++)
for(j=0;j<3;j++){ if(mat[i][j]=='_') ++count; }
return count;
}

unsigned char isOver(void){

unsigned char i,j,user;


unsigned char storeChar=0,flag;
int sum=0;
// case 1
/*sum of 'X'+'X'+'X' = 264 and sum of 'O'+'O'+'O' =237*/
flag=0;
for(i=0;i<3;i++)
{ sum=0;
for(j=0;j<3;j++)
{
if(mat[i][j]=='_') break;
sum+=mat[i][j];
storeChar=mat[i][j];
}

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.

You might also like