0% found this document useful (0 votes)
24 views13 pages

CGR Microproject

Uploaded by

namdev misal
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 (0 votes)
24 views13 pages

CGR Microproject

Uploaded by

namdev misal
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

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION, MUMBAI.

A Project Report
On

“ TIC - TAC - TOE GAME ”


In

Second Year Computer Engineering


Submitted by

MAST.SHUBHAM DATTA GAINGADE

MAST.DARSHAN VITTHAL SUTAR

MAST. OMKAR JAYWANT PATIL

MAST. NAMDEV EKNATH MISAL

UNDER THE GUIDANCE OF,

PROF. H.A.PUNDAPAL
SANT GAJANAN MAHARAJ RURAL POLYTECHNIC MAHAGAON

ACADEMIC YEAR

2023 – 2024

1
Maharashtra State Board of Technical Education, Mumbai.

“SANT GAJANAN MAHARAJ RURAL


POLYTECHNIC”
AP/-MAHAGAON, SITE- CHINCHEWADI, TAL-GADHINGLAJ, DIST – KOLHAPUR

CERTIFICATE
THIS IS TO CERTIFY THAT THE FOLLOWING STUDENTS OF SECOND YEAR.
THIRD SEMESTER OR DIPLOMA IN COMPUTER ENGINEERING OF
INSTITUTE SANT GAJANAN MAHARAJ RURAL POLYTECHNIC, MAHAGAON
– (CODE)416502 HAS COMPLETED MICRO PROJECT—TIC-TAC-TOE GAME
IN SUBJECT – COMPUTER GRAPHICS CODE- 22318 FOR ACADEMIC YEAR
2023-2024

AS PRESCRIBED IN THE CURRICULUM

ROLL STUDENT NAME ENROLLMENT NO. SEAT NO.


NO.
20 SHUBHAM DATTA
GAINGADE
21 DARSHAN VITTHAL
SUTAR
27 OMKAR JAYWANT
PATIL
69 NAMDEV EKNATH
MISAL

DATE: PLACE: MAHAGAON

PROF. H.A.PUNDAPAL PROF.B.K.BIRANGADDI PROF.R.S.PATIL

( SUBJECT ) ( HOD ) (PRINCIPAL)

2
INDEX

SR. CONTENT PAGE

1 AIM 4

2 COURSE OUTCOME 4

3 METHODOLGY 4

4 RESOURCES USED 4

5 SCOPE OF PROJECT 5

6 BRIEF INTRODUCTION 5

7 RULES 6

8 PROGRAM CODE 6

9 OUTPUT 10

10 CONCLUSION AND REFERENCE 12

● AIM OF THE PROJECT :-


3
The Aim of the project is to develop a c program code to develop a ‘ TIC – TAC –
TOE ’ game. The goal of the game is for players to position their marks so that they make a
continuous line of three cells vertically, horizontally, or diagonally. An opponent can prevent
a win by blocking the completion of the opponent’s line. In our variant of the game, players
placed objects on a board.

● COURSE OUTCOME :-

 The game of tic-tac-toe is a game of predictability.


 The moves that are believed to be important are highly predictable.
 This also makes it a game of opposites in a way, because this goes against the
definition of an “important move”.
 But this predictability is what helps faster strategic thinking in children

● METHODOLGY :-

 A hash shape square board grid.


 One of the players has to choose. O and the other, to mark their respective ce 0.
 The player will have to input a numerical character, from 1 to 9, to select a position
for X or O into the space.
 The game ends when one whole row column diagonal fed with his/her respective
character ( 0 or X).
 If the blank spaces in the grid are all filed, and there is no winner, then the game is
said to be a draw.

● RESOURCES USED :-

SR.NO NAME OF THE RESORCES SPECIFICATION QTY

1 LAPTOP INTEL CORE I3 10TH GEN 1

2 SOFTWARE USED TURBO C++ -

3 REFERENCE - -

● SCOPE OF THE MICROPROJECT :-


4
This Report describes all the requirements for the project. The purpose of this
research is to provide a virtual image for the combination of both structured and
unstructured information of my project “Tic Tac Toe”. This is a single-player strategy game
on the Windows platform. The player will progress through levels which require precise
manipulation of the environment, though the game Encourages creativity and daring via
branching pathways. The episodic structure of the game facilitates the pace of the story. I
demonstrate the action flow between inputs, script, display (output)

● BRIEF INTRODUCTION :-
The Tic Tac Toe game is a game for two players, called "X" and "O", who take turns
marking thespaces in a 3×3 grid. The player who succeeded in placing three respective
marks in a horizontal,vertical, or diagonal row wins the game. The Tic Tac Toe is a great way
to pass your free timewhether you're standing in a line or spending time with your kids.
Stop wasting paper and savetrees. Because of the simplicity of Tic Tac Toe, is it is often used as
a pedagogical tool for teaching the concepts of good sportsmanship and the branch of artificial intelligence.

Fig . TIC – TAC – TOE GAME


The players first decide who will mark his moves with an X and who will go first. Play proceeds with the
opponents alternately placing their marks in any unoccupied cell delineated by the figure. The object of the
game is to be the first player with 3 marks in a row, where a row can be either vertical, horizontal, or
diagonal. If all the cells become filled the game is a draw. A great number of isomorphs of this game are
known, many of which are discussed by Herbert A. Simon in his monograph "Representations in Tic-Tac-
Toe" (36). A variety of spellings for the standard game described above have been used. Throughout this
paper, we shall use the abbreviation "TTT." The exact origin of TTT is unknown but variations such as "three
men's morris" were popular in England in 1300 (24). In this game each player has exactly 3 counters to mark
his moves. After your 3 counters have been placed on the board, successive moves will consist of moving
one of your counters to an unoccupied cell. GO-MOKU is a variant of TTT played upon a 19x19 matrix where
one must get exactly 5-in-a-row to win. It is an ancient Japanese game that is usually played with stones on
the intersections of a GO board. Most readers will be aware that there are only a few basic patterns of play
that occur during a game of TTT because of its symmetrical nature. Once these patterns become familiar,
the games result in a draw and the players apt to lose interest. There are however, many difficult and
interesting questions to be considered. One class of such questions considers a particular arrangement of X's
and O's within the game field and asks who went first or upon which cell the last move was made. Other
subjects arise as a result of it being used as part of a magician's prediction routine (28). The problems dealt
with in this paper will be LIMITED.

● RULES OF THE TIC - TAC - TOE GAME :-


5
1. The game is played on a grid that's 3 squares by 3 squares.
2. You are X , your friend (or the computer in this case) is O . Players take turns putting
their marks in empty squares.
3. The first player to get 3 of her marks in a row (up, down, across, or diagonally) is the
winner.
4. When all 9 squares are full, the game is over. If no player has 3 marks in a row, the
game ends in a tie.

● CODE :-

6
#include <stdio.h>
#include<conio.h>
#include<graphics.h>
#include<dos.h>
void initialize_board(char board[3][3])
{
int i,j;
for (i = 0; i < 3; i++)
{
for (j = 0; j < 3; j++) {
board[i][j] = ' ';
}
}
}
void display_board(char board[3][3])
{
int i,j;
printf("\n 1 2 3\n");
for (i = 0; i < 3; i++)
{
printf("%d ", i + 1);
for ( j = 0; j < 3; j++)
{
printf("%c", board[i][j]);
if (j < 2)
{
printf("|");
}
}

7
printf("\n");
if (i < 2) {
printf(" -----\n");
}
}
printf("\n");
}
int is_game_over(char board[3][3])
{
int is_draw=1;
int i,j;
for ( i = 0; i < 3; i++) {
if (board[i][0] == board[i][1] && board[i][1] == board[i][2] && board[i][0] != ' ') {
return 1;
}
if (board[0][i] == board[1][i] && board[1][i] == board[2][i] && board[0][i] != ' ') {
return 1;
}
}
if (board[0][0] == board[1][1] && board[1][1] == board[2][2] && board[0][0] != ' ') {
return 1;
}
if (board[0][2] == board[1][1] && board[1][1] == board[2][0] && board[0][2] != ' ') {
return 1;
}
for ( i = 0; i < 3; i++) {
for ( j = 0; j < 3; j++) {
if (board[i][j] == ' ') {
is_draw = 0;
break;

8
}
}
}
if (is_draw) {
return 2;
}
return 0;
}
void main()
{
char board[3][3];
int row, col, player = 1, game_status = 0;
clrscr();
initialize_board(board);
do
{
display_board(board);
if (player == 1) {
printf("Player X's turn\n");
}
else
{
printf("Player O's turn\n");
}
printf("Enter row (1, 2, or 3) and column (1, 2, or 3) separated by a space: ");
scanf("%d %d", &row, &col);
if(row < 1 || row > 3 || col < 1 || col > 3 || board[row - 1][col - 1] != ' ') {
printf("Invalid move! Try again.\n");
continue;
}

9
if (player == 1)
{
board[row - 1][col - 1] = 'X';
player = 2;
}
else
{
board[row - 1][col - 1] = 'O';
player = 1;
}
game_status = is_game_over(board);
}
while(game_status == 0);
display_board(board);
if(game_status == 1) {
printf("Player %c wins!\n", (player == 1) ? 'O' : 'X');
}
else
{
printf("It's a draw!\n");
}
getch();
}

● OUTPUT :-

10
11
● CONCLUSION :-

12
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 algorithmof playing Tic Tac Toe has been presented and tested that works in
efficient way. Overall thesystem works without any bugs .

● REFERENCE :-

 https://www.academia.edu/36672411/_Tic_Tac_Toe_Game_Project
 https://www.geeksforgeeks.org/tic-tac-toe-game-in-c/
 https://www.researchgate.net/publication/316534681_Tic-Tac-Toe

13

You might also like