Green University of Bangladesh Department of Computer Science and Engineering (CSE)
Green University of Bangladesh Department of Computer Science and Engineering (CSE)
Assigment for CT 3
Student Details
Name ID
Sabbir Ahmed 222903015
Submission Date :
Course Teacher’s Name :
Chapter
1
Introduc
tion
1.1 Introduction
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
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
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
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();
playerMove();
winner = checkWinner();
if(winner != ' ' || checkFreeSpaces() == 0)
{
break;
}
computerMove();
winner = checkWinner();
if(winner != ' ' || checkFreeSpaces() == 0)
{
break;
}
}
printBoard();
printWinner(winner);
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;
do
{
printf("Enter row #(1-3): ");
scanf("%d", &x);
x--;
printf("Enter column #(1-3): ");
scanf("%d", &y);
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];
}
Chapter 3
Performance Evaluation
Fig:3.1
We again input a number its call its 2nd move for player 2.
Fig:3.2
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
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