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

Green University of Bangladesh Department of Computer Science and Engineering (CSE)

The document outlines a lab project for a structured programming course at Green University of Bangladesh, focusing on the development of a Tic Tac Toe game. It includes sections on the game's objectives, design, implementation requirements, and performance evaluation. The project aims to provide an engaging, non-violent gaming experience while teaching programming concepts.

Uploaded by

Sabbir Ahmed
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)
4 views13 pages

Green University of Bangladesh Department of Computer Science and Engineering (CSE)

The document outlines a lab project for a structured programming course at Green University of Bangladesh, focusing on the development of a Tic Tac Toe game. It includes sections on the game's objectives, design, implementation requirements, and performance evaluation. The project aims to provide an engaging, non-violent gaming experience while teaching programming concepts.

Uploaded by

Sabbir Ahmed
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

Green University of Bangladesh

Department of Computer Science and Engineering


(CSE)
Faculty of Sciences and Engineering
Semester: (Summer, Year:2022), B.Sc. in CSE (Day)

Course Title: structured programming


Course Code: CSE 103 Section:DB

Assigment for CT 3

Student Details

Name ID
Sabbir Ahmed 222903015

Submission Date :
Course Teacher’s Name :

Lab Project Status

Marks: ………………………………… Signature: .....................

Comments: .............................................. Date: ..............................


Table of Contents

Chapter
1

Introduc

tion

1.1 Introduction

TIC-TAC-TOE is a simple, two-player game that, if played


optimally by both players, will always result in a tie. The game is
also called noughts and crosses or Xs and Os

1.2 OBJECTIVE
Objectives of the Gaming System
The game is developed for full-time entertainment and enthusiasms. It teaches
the Gamer to bealert at every situation he/she faces, because if the Gamer is not
fully alert and notice the saucerfire he/she must be hit by the saucer-bombs.
Though the proposed game is an action game, it doesn’t involve direct violence.
No zombie killing,
Animal killing, or human killing is performed in the game. So it can also be
viewed as a non-violence game.Kids can also play this game, because the
design of the game is very simple, controlling the gameis very easy

Pressing some neighboring keys of the keyboard

1.3 Why This Project?


Since the 1970s [10], people started to take interest in using their computers as
an entertainmentenvironment, thus, the multi billion game industry [3] was
starting to take shape. Having presentedearlier the sum of money this industry
produces, I decided to have a go and create a game of myown. As a kid, I was
always fascinated by the idea of becoming a game developer, but, as yearswent
by, I have realized this is not exactly what programming and computer science,
as a practice,are about and I dropped the idea. However, the third year project
offered me the possibility to tryand achi
Eve one of my childhood’s dreams and I couldn’t resist the
Temptation
Chapter 2
Design/Development/Implementation of the
Project
2.1DESIGN OF TIC TAC TOE
1. player 1
2. player 2
3. Game board
4. Move

DESIGN OF TIC TAC TOE


player 1 win
1

2.1.1 SYSTEM REQUIREMENTS


Most of the computer games require high configurations of computer. But in the case of theproposed gaming system, the
system requirements is not that much.The minimum
Systems requirements for the proposed project “
Tic Tac Toe” game is mentioned
Following.
(a) Operating System: Android 4.0
(b) Processor: 1.2 GHz
(c) RAM: 512MB
(d) Storage: 100 MB

2.1.1.1 NON FUNCTIONAL REQUIREMENTS


 Product Requirements
EFFICIENCY REQUIREMENT
When a library management system will be implemented librarian and user will
easily acess library as searching and book transaction will be very faster .

RELIABILITY REQUIREMENT
The system should accurately performs book information,auther information,count of the books.

USABILITY REQUIREMENT

The system is designed for a user friendly environment so that everyone play this easyly

IMPLEMENTATION REQUIREMNTS

In implementing whole system it uses c

DELIVERY REQUIREMENTS

The whole system is expected to be delivered in six months of time with a weekly
evaluation by the project guide.
2.1.2 SOFTWARE AND HARDWARE REQUIREMENTS
2.1.2.1 SOFTWARE REQUIREMENTS

 Operating system- Windows 8.1 is used as the operating system as it is stable and
supports more features and is more user friendly

 Development tools and Programming language- c is used to write the whole


code

2.1.2.2 HARDWARE REQUIREMENTS


Intel core i5 3rd generation is used as a processor because it is fast than other
processors an provide reliable and stable and we can run our pc for longtime.
By using this processor we can keep on developing our project without any
worries.

 Ram 8 gb is used as it will provide fast reading and writing capabilities


and will in turn support in processing.
Existing System:.

(a) Operating System: Android 4.0


(b) Processor: 1.2 GHz
(c) RAM: 512MB
(d) Storage: 100 MB

Code:

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <time.h>

char board[3][3];
const char PLAYER = 'X';
const char COMPUTER = 'O';

void resetBoard();
void printBoard();
int checkFreeSpaces();
void playerMove();
void computerMove();
char checkWinner();
void printWinner(char);

int main()
{
char winner = ' ';
char response = ' ';

do
{
winner = ' ';
response = ' ';
resetBoard();

while(winner == ' ' && checkFreeSpaces() != 0)


{
printBoard();

playerMove();
winner = checkWinner();
if(winner != ' ' || checkFreeSpaces() == 0)
{
break;
}

computerMove();
winner = checkWinner();
if(winner != ' ' || checkFreeSpaces() == 0)
{
break;
}
}

printBoard();
printWinner(winner);

printf("\nWould you like to play again? (Y/N): ");


scanf("%c");
scanf("%c", &response);
response = toupper(response);
} while (response == 'Y');

printf("Thanks for playing!");

return 0;
}

void resetBoard()
{
for(int i = 0; i < 3; i++)
{
for(int j = 0; j < 3; j++)
{
board[i][j] = ' ';
}
}
}
void printBoard()
{
printf(" %c | %c | %c ", board[0][0], board[0][1], board[0][2]);
printf("\n---|---|---\n");
printf(" %c | %c | %c ", board[1][0], board[1][1], board[1][2]);
printf("\n---|---|---\n");
printf(" %c | %c | %c ", board[2][0], board[2][1], board[2][2]);
printf("\n");
}
int checkFreeSpaces()
{
int freeSpaces = 9;

for(int i = 0; i < 3; i++)


{
for(int j = 0; j < 3; j++)
{
if(board[i][j] != ' ')
{
freeSpaces--;
}
}
}
return freeSpaces;
}
void playerMove()
{
int x;
int y;

do
{
printf("Enter row #(1-3): ");
scanf("%d", &x);
x--;
printf("Enter column #(1-3): ");
scanf("%d", &y);
y--;

if(board[x][y] != ' ')


{
printf("Invalid move!\n");
}
else
{
board[x][y] = PLAYER;
break;
}
} while (board[x][y] != ' ');

}
void computerMove()
{
//creates a seed based on current time
srand(time(0));
int x;
int y;
if(checkFreeSpaces() > 0)
{
do
{
x = rand() % 3;
y = rand() % 3;
} while (board[x][y] != ' ');

board[x][y] = COMPUTER;
}
else
{
printWinner(' ');
}
}
char checkWinner()
{
//check rows
for(int i = 0; i < 3; i++)
{
if(board[i][0] == board[i][1] && board[i][0] == board[i][2])
{
return board[i][0];
}
}
//check columns
for(int i = 0; i < 3; i++)
{
if(board[0][i] == board[1][i] && board[0][i] == board[2][i])
{
return board[0][i];
}
}
//check diagonals
if(board[0][0] == board[1][1] && board[0][0] == board[2][2])
{
return board[0][0];
}
if(board[0][2] == board[1][1] && board[0][2] == board[2][0])
{
return board[0][2];
}

return ' ';


}
void printWinner(char winner)
{
if(winner == PLAYER)
{
printf("YOU WIN!");
}
else if(winner == COMPUTER)
{
printf("YOU LOSE!");
}
else{
printf("IT'S A TIE!");
}
}

Chapter 3

Performance Evaluation

3.1 Simulation Environment/ Simulation Procedure


When we input a number 1to 9 its call its 1st move for player 1.

Fig:3.1

We again input a number its call its 2nd move for player 2.
Fig:3.2

3.2 Results and Discussion


Early days Libraries are managed manually. It required lot of time to record or to retrieve
the details. The employees who have to record the details must perform their job very
carefully. Even a small mistake would create a lot of problems. Security of information is
very less. Report generations of all the information is very tough task. Maintenance of Library catalogue and arrangement of
the books to the catalogue is very complex task. In addition to its maintenance of member details, issue dates and return
dates etc. manually is a complex task. All the operations must be performed in perfect manner for the maintenance of the
library with out any degradation which may finally result in the failure of the entire system.

Chapter 4

Conclusion

4.1 Introduction
The Tic Tac Toe game is most familiar among all the age groups.
Intelligence can be a property ofany

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

4.1 Scope of Future Work

This Report describes all the requirements for the project. The purpose of this research is to
providea 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 willprogress through levels which require precise manipulation of the environment,
though the gameEncourages creativity and daring via branching pathways. The episodic
structure of the gamefacilitates the pace of the story. I demonstrate the action flow between
inputs, script, display(output).

References

Websites:
www.google.com
www.academia.edu
www.daitm.org.in
www.freeprojectz.com
www.javatpoint.com
www.youtube.com

books:
C Programming Absolute Beginner's Guide
C Programming Language
C: The Complete Reference
Head First C: A Brain-Friendly Guide
C Programming in easy steps, 5th Edition:
let us c by yashavant kanetkar

You might also like