Professional Documents
Culture Documents
Dsu Micro Project
Dsu Micro Project
Anexure:1
Title:- Tic tac toe game using Array Course:- Data structure(Dsu)
1.0 Aim of micro project:-The project is basically game which is Tic Tac Toe. This game contains
xand o. It is a two player game. using Array we will implement the game called tic tac toe.
3.0 Proposed methodology:- 1. First we decided the title of our micro project.
2. Then we discussed about information of title.
3. We started work of collection for information From website,textbooks and also from
newspapers.
4.After that our team started competing project work before due date.
4 Submittion All
5.0 Resources used:-
CERTIFICATE
This is to certify that,
Aditi ghugarkar
Dnyaneshwari navthar
Vaishnavi patil
Sakshi sangle
Has satisfactorily completed the micro- project entitled,
1.0 Rational:-The project is basically game which is Tic Tac Toe. This game contains xand o. It is
a two player game. The first player plays as xand another as o. The first one to make a line is
winner. So the program is designed in a way that is easy to understand by the user.
2.0 Aim/benefits of micro project:-Develop a tic tac toe game using array.
The program contains various functions like checkwin(), board(),etc. The detailed information
of this functions is given below but the basic idea about them is in their name. So the function
checkwin() checks whether the game is completed i.e. won by someone or drawn. And the
board() function is used to display the board or the play area of this game. This program is in c
code. We have used array to store the data of xand oof the players as we have to use it as a
part of the project
1.Checkwin():
This is a function which checks whether the game is completed or is still running or it checks the
array elements and determines the winner by checking whether the Xor Oare In lines.
int checkwin()
{
if (square[1] == square[2] &&square[2] == square[3])
return 1;
return 1;
return 1;
return 1;
return 1;
return 1;
return 1;
return 0;
else
return - 1;
In the above code the conditions are checked like: if (square[1] == square[2] &&square[2] ==
square[3]). Thus if the element in the array element square[1] will be equal to square[2] and
the element in the array element square[2] will be equal to square[3] thus a line will be formed
and the game is won by the particular player so it returns 1. Similarly the other conditions are
checked and the last condition checks whether the game is completed or remaining.
2.Board():
This is a function to display the board or the play area for the player. The code of this function is
as follows:
void board()
clrscr();
printf("\t\t\t\t | | \n");
printf("\t\t\t\t_____|_____|_____\n");
printf("\t\t\t\t | | \n");
printf("\t\t\t\t_____|_____|_____\n");
printf("\t\t\t\t | | \n");
printf("\t\t\t\t | | \n\n");
This code displays the play area and the characters inside the play area. Numbers from 1 to 9
are displayed in this function. The data is modified when we call the function i.e. the number
will be changed according to the inputs given by the user.
3.Main():
In the main body, at the first all variables are declared which will be used in the program. Then
we have used do-while loop. At the start of the loop the decision of which player is active is
done. Then the value of the block is asked from that particular player. Then the mark is selected
for that i.e. whether it is Xor O. Then conditions are checked that which block is selected by the
player and then the value of variable mark is copied to the array element that resembles the
block. If the conditions of the block are false than it displays that the entered number is invalid.
Then the function checkwin() is called and the result that is returned by the function is stored in
the variable. And then it is checked that whether the game is completed, incomplete or draw.
This loop iterates till the value of the variable is -1 and board function is called every time to
change the board every time the value is correctly inputed.
Coding:
#include <stdio.h>
#include <conio.h>
char square[10] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };
int checkwin();
void board();
int main()
char mark;
do
board();
player = (player % 2) ? 1 : 2;
scanf("%d", &choice);
square[1] = mark;
square[2] = mark;
square[3] = mark;
square[4] = mark;
square[5] = mark;
square[6] = mark;
square[7] = mark;
else if (choice == 8 &&square[8] == '8')
square[8] = mark;
square[9] = mark;
else
player--;
getch();
i = checkwin();
player++;
}while (i == - 1);
board();
if (i == 1)
else
printf("\t\t\t==>\aGame Over");
getch();
return 0;
/*********************************************
int checkwin()
return 1;
return 1;
return 1;
return 1;
return 1;
return 1;
return 1;
return 1;
return 0;
else
return - 1;
}
void board()
system("cls");
printf("\t\t\t\t | | \n");
printf("\t\t\t\t_____|_____|_____\n");
printf("\t\t\t\t | | \n");
printf("\t\t\t\t_____|_____|_____\n");
printf("\t\t\t\t | | \n");
printf("\t\t\t\t | | \n\n");
Output:
0.5 Actual methodology followed:-
1. First we decided the title of our micro project.
2. Then we discussed about information of title.
3. We started work of collection for information From website,textbooks and also from
newspapers.
4. After that our team started competing project work before due date
0.6 Actual resources used:-
4 GB RAM.