You are on page 1of 13

Micro project proposal

Anexure:1

Title:- Tic tac toe game using Array Course:- Data structure(Dsu)

Course code:- 22317 program:- CM3I

Session:-2020_2021 Subject Teacher:-shelkar A.D.

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.

2.0 Course outcomes achieved:-1. perform basic operations on arrays.


2. Apply different searching and sorting techniques .
3. implement basic operations on stack and queue using array representation .
4. Implement basic operations on linked list.
5. Implement program to create an traverse tree to solve problems

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.0 Action plan:-

Sr.no Details of Activities Plan start Plan finished Name of responsible


date date team members

1 Discussion regarding Aditi Kiran ghugarkar


to project idea and
final topic

2 Collection of Vaishnavi patil ,


information Dnyaneshwari navathar

3 Making of praposal Sakshi bhausaheb sangle

4 Submittion All
5.0 Resources used:-

Sr.no Name of Specification Quantity Remark


resource

1 Computer Intel i3 7th gen, 1


sysytem
4 GB RAM.

2 Software Turbo c++ 1

6.0 No of team members:-

Roll no. Name Sign

26 Aditi kiran ghugarkar

44 Dnyaneshwari umesh navathar

49 Vaishnavi mahesh patil

54 Sakshi bhausaheb sangle

Name and Signature 0f Subject Teacher


prof. Shelkar.A.D.
AMRUTVAHINI SHETI AND SHIKSHAN VIKAS SANSATHA’S
AMRUTVAINI POLYTECHNIC, SANGAMNER

CERTIFICATE
This is to certify that,
Aditi ghugarkar
Dnyaneshwari navthar
Vaishnavi patil
Sakshi sangle
Has satisfactorily completed the micro- project entitled,

“Tic Tac Toe Game using Array”


As prescribed by MSBTE ,Mumbai
As part of syllabus for the partial fulfillment in diploma in computer engineering for DSU
It is submitted in the partial fulfillment of the prescribed syllabus of MSBTE, Mumbai
For the academic year 2020-2021

Prof. Shelkar. A.D. Prof. kale.G.B


(guide) (HOD)
A
Project report
AMRUTVAHINI POLYTECHNIC, AMRUTNAGAR
DEPARTMENT OF COMPUTER ENGINEERING

“Tic Tac Toe Game using Array”


In the partial fulfillment of the requirement for the diploma in
COMPUTER ENGINEERING Submitted to
Maharashtra state board of technical education ,
Mumbai
Submitted by
Aditi ghugarkar
Dnyaneshwari navthar
Vaishnavi patil
Sakshi sangle

Under The Guidance of


Prof. Shelkar A.D sir

AMRUTVAHINI POLYTECHNIC , AMRUTNAGAR


(APPROVED BY AICTE, NEW DELHI AND AFFILLIATED TO MSBTE)
(2020-2021)
Micro project Report

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.

3.0 Course outcomes:-


1. perform basic operations on arrays.
2. Apply different searching and sorting techniques .
3. implement basic operations on stack and queue using array representation .
4. Implement basic operations on linked list.
5. Implement program to create an traverse tree to solve problems.

4.0 Literature review :-

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

Explanation of functions used in program :

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;

else if (square[4] == square[5] &&square[5] == square[6])

return 1;

else if (square[7] == square[8] &&square[8] == square[9])

return 1;

else if (square[1] == square[4] &&square[4] == square[7])


return 1;

else if (square[2] == square[5] &&square[5] == square[8])

return 1;

else if (square[3] == square[6] &&square[6] == square[9])

return 1;

else if (square[1] == square[5] &&square[5] == square[9])

return 1;

else if (square[3] == square[5] &&square[5] == square[7])

return 1;

else if (square[1] != '1' &&square[2] != '2' &&square[3] != '3' &&

square[4] != '4' &&square[5] != '5' &&square[6] != '6' &&square[7]

!= '7' &&square[8] != '8' &&square[9] != '9')

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("\n\n\t\t\t\tTic Tac Toe\n\n");


printf("\t\t\tPlayer 1 (X) - Player 2 (O)\n\n\n");

printf("\t\t\t\t | | \n");

printf("\t\t\t\t %c | %c | %c \n", square[1], square[2], square[3]);

printf("\t\t\t\t_____|_____|_____\n");

printf("\t\t\t\t | | \n");

printf("\t\t\t\t %c | %c | %c \n", square[4], square[5], square[6]);

printf("\t\t\t\t_____|_____|_____\n");

printf("\t\t\t\t | | \n");

printf("\t\t\t\t %c | %c | %c \n", square[7], square[8], square[9]);

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

int player = 1, i, choice;

char mark;

do

board();

player = (player % 2) ? 1 : 2;

printf("\t\t\tPlayer %d, enter a number: ", player);

scanf("%d", &choice);

mark = (player == 1) ? 'X' : 'O';

if (choice == 1 &&square[1] == '1')

square[1] = mark;

else if (choice == 2 &&square[2] == '2')

square[2] = mark;

else if (choice == 3 &&square[3] == '3')

square[3] = mark;

else if (choice == 4 &&square[4] == '4')

square[4] = mark;

else if (choice == 5 &&square[5] == '5')

square[5] = mark;

else if (choice == 6 &&square[6] == '6')

square[6] = mark;

else if (choice == 7 &&square[7] == '7')

square[7] = mark;
else if (choice == 8 &&square[8] == '8')

square[8] = mark;

else if (choice == 9 &&square[9] == '9')

square[9] = mark;

else

printf("\t\t\tInvalid move ");

player--;

getch();

i = checkwin();

player++;

}while (i == - 1);

board();

if (i == 1)

printf("\t\t\t==>\aPlayer %d win ", --player);

else

printf("\t\t\t==>\aGame Over");

getch();

return 0;

/*********************************************

FUNCTION TO RETURN GAME STATUS

1 FOR GAME IS OVER WITH RESULT

-1 FOR GAME IS IN PROGRESS

O GAME IS OVER AND NO RESULT


**********************************************/

int checkwin()

if (square[1] == square[2] &&square[2] == square[3])

return 1;

else if (square[4] == square[5] &&square[5] == square[6])

return 1;

else if (square[7] == square[8] &&square[8] == square[9])

return 1;

else if (square[1] == square[4] &&square[4] == square[7])

return 1;

else if (square[2] == square[5] &&square[5] == square[8])

return 1;

else if (square[3] == square[6] &&square[6] == square[9])

return 1;

else if (square[1] == square[5] &&square[5] == square[9])

return 1;

else if (square[3] == square[5] &&square[5] == square[7])

return 1;

else if (square[1] != '1' &&square[2] != '2' &&square[3] != '3' &&

square[4] != '4' &&square[5] != '5' &&square[6] != '6' &&square[7]

!= '7' &&square[8] != '8' &&square[9] != '9')

return 0;

else

return - 1;

}
void board()

system("cls");

printf("\n\n\t\t\t\tTic Tac Toe\n\n");

printf("\t\t\tPlayer 1 (X) - Player 2 (O)\n\n\n");

printf("\t\t\t\t | | \n");

printf("\t\t\t\t %c | %c | %c \n", square[1], square[2], square[3]);

printf("\t\t\t\t_____|_____|_____\n");

printf("\t\t\t\t | | \n");

printf("\t\t\t\t %c | %c | %c \n", square[4], square[5], square[6]);

printf("\t\t\t\t_____|_____|_____\n");

printf("\t\t\t\t | | \n");

printf("\t\t\t\t %c | %c | %c \n", square[7], square[8], square[9]);

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:-

Sr.no Name of resource Specification Quantity

1 Computer sysytem Intel i3 7th gen, 1

4 GB RAM.

2 Software Turbo c++ 1

0.7 Skill developed:-


1. Basic knowledge
2. Discipline knowledge
3. Communications
4. Team work
5. Life long learning

0.8 Applications of this micro project:-


Creating a tic-tac-toe program using a 2-D array and functions in C , It is apparent
you are stuck on understanding your function declarations and where you have used int
and where you have used char . c arrays tic-tac-toe. share | improve this question |
follow | edited Feb 13 '19 at 17:42. Duck Dodgers. 3,005 6 6 gold badges 23 23 silver
badges 35 35 bronze badges.

You might also like