Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 49

ACKNOWLEDGEMENT

Accomplishing this task would not have been possible without the support of a number of people. First and foremost we would like to thank the Almighty for giving us courage to bring up this project successfully. We are thankful to the Principal Dr. (Mrs.) Charanjit Mahal and Head of department Mrs. Kamlesh Gupta for their support, motivation and encouragement. At the outset , we would like to propose a word of thanks to our Project Guide, Mrs.Pawanjot Kaur who gave us unending support and help in numerous ways from the time when the idea of this project was conceived. We will also like to pay a special thanks to our family members for their unending co-operation and emotional support. Last but not the least a word of gratitude to all our friends and classmates.

Simran Kaur Jaspreet Kaur Jasleen Kaur


[

Date:

CERTIFICATE
This is to certify that this project entitled Tic Tac Toe submitted to Panjab University ,Chandigarh in the partial fulfillment of the requirements for the degree of Masters of Science in the subject of Information Technology is a bonafide work carried out by Simran Kaur , Jaspreet Kaur and Jasleen Kaur under our supervision and no part of this work has been submitted for any other degree. The assistance and help received during the course of work has been fully acknowledged.

Project Guide Mrs.Pawanjot Kaur

Head of Department Mrs.Kamlesh gupta

Principal Dr.(Mrs.)Charanjit Mahal Guru Nanak Girls College Model Town , Ludhiana.

STUDENT DECLARATION
We hereby declare that the project entitled TIC TAC TOE submitted by Simran Kaur , Jaspreet Kaur and Jasleen Kaur in the partial fulfillment of the requirements for the degree of Masters of Science in the subject of Information Technology(Ist Semester, Session 2012-13) is our original work and has not been submitted for the reward of any other degree/ diploma/ scholarship or any other similar title or prize.

Place :Ludhiana Date:

Simran Kaur Jaspreet Kaur Jasleen Kaur

Project Guide: Mrs.Pawanjot Kaur

Head of Department: Mrs.Kamlesh Gupta

LIST OF CONTENTS

Introduction Types of Computer Graphics Applications of Interactive Computer Graphics Advantages of Interactive Computer Graphics Functions of Interactive Computer Graphics Introduction of Project Objective of Project System feasibility report Coding and testing Hardware and Software requirements Coding Output Bibliography

INTRODUCTION OF COMPUTER GRAPHICS


Today there are very few aspects of our lives not affected by computers. Practically every cash or monetary transaction that takes place daily involves a computer. In many cases, the same is true of computer graphics. Whether you see them on television, in newspapers, in weather reports or while at the doctors surgery, computer images are all around you. A picture is worth a thousand words is a well-known saying and highlights the advantages and benefits of the visual presentation of our data.A well known choosen graph is able to transform a complex table of numbers into meaningful results.A range of tools and facilities are available to enable the users to visualize their data. Basically Computer graphics is concerned with all aspects of producing images using a computer. It contains with the pictorial synthesis of real and imaginary objects from their computer based models, It refers to the different things such as representation and manipulation of image data by computer. The various technologies that are used to create and manipulate is also called computer graphics. The images produce for various study purposes that are further used for digital synthesis is termed as computer graphics. Images can be produce either in 2D , 3D or by used in animated graphics. These images are then converted into digital representation i.e. that is in the form of 0 and 1. Computer graphics is the creation and manipulation of pictures with the aid of computer. There are two types of computer graphics.

Interactive computer graphics Non-interactive graphics or passive computer graphics

Computer graphics can be used in many disciplines. Charting, Presentations, Drawing, Painting and Design, Image Processing and Scientific Visualizations.

APPLICATIONS OF GRAPHICS
Computers have become powerful tool for the rapid and economical production of pictures. Computer graphics are used in several areas such as

Science Engineering Business Industry Government Art Entertainment Advertising Education and training

TYPES OF COMPUTER GRAPHICS


There are two types of computer graphics.

Interactive computer graphics Non-interactive graphics or passive computer graphics

Interactive Computer Graphics: Interactive Computer Graphics involves


a two way communication between computer and user. Here the observer is given some control over the image by providing him with an input device for example the video game controller of the ping pong game. This helps him to signal his request to the computer. The computer on receiving signals from the input device can modify the displayed picture appropriately. To the user it appears that the picture is changing instantaneously in response to his commands. He can give a series of commands, each one generating a graphical response from the computer. In this way he maintains a conversation, or dialogue, with the computer. Interactive computer graphics affects our lives in a number of indirect ways. For example, it helps to train the pilots of our airplanes. We can create a flight simulator which may help the pilots to get trained not in a real aircraft but on the grounds at the control of the flight simulator. Flight simulators have many advantages over the real aircrafts for training purposes,

Non Interactive Computer Graphics: In non interactive computer


graphics otherwise known as passive computer graphics. it is the computer graphics in which user does not have any kind of control over the image. Image is merely the product of static stored program and will work according to the instructions given in the program linearly. The image is totally under the control of program instructions not under the user. Example: screen savers.

APPLICATIONS OF COMPUTER GRAPHICS


Computer Aided Design: An important use of computer graphics is in the field of engineering for design puposes.All products in any industy are computer designed and process is referred to as computer aided design (CAD).With this advantage,automobile makers can animated the parts and test them to make sure these parts do not interface with anything else. Graphical User Interface: Every software package these days are GUI based. With a pointing device such as mouse ,we can click select any option in the menu of the window.It makes operating computer very easy ,because it contain more graphical pictures than text. Entertainment: Computer graphics can be seen commonly used in music videos , television , animated pictures and various movies. Computer graphics techniques are used in these applications to produce transformation of one object into another. Simulation and training: Computer graphics are used to dsign special system for training or practice of aircraft pilots , air traffic controllers , spaceship astronauts and othe equipment operators. Education and Presentation : Computer animation can be used to make very existing and fun videos into which education can easily be incorporated .It is much easy to learn math when the letter are nice an colorful flying around your TV screen instead of solving problems in the paper. Data Visualization: In a general sense, all of computer graphics is based on some underlying data to display. The term data visualization refers to the use of visualization techniques

to represent, manipulate, and analyze content from some data source. Two general types of data visualization are often referred to. Scientific visualization: refers to physical data that is obtained through measurement or simulation and is used to better understand underlying structure and relationships. Examples are visualizing airflow over a surface to understand the effect of different airfoil designs, displaying the temperature across a mechanical part as color, or modeling and animating air particles to visualize how a tornado is formed. Such visualization is useful for dealing with the vast amounts of physical data collected or generated through experiments, sensors, or computer models. Information visualization: is the other general category that refers to more abstract or derived data such as stock prices, network traffic, or gene sequences. Visualization of this type of data generally requires a more abstract technique, such as data graphing, versus trying to represent it with a physical interpretation. CAD : Computer Aided Design was one of the early applications of interactive computer graphics to assist engineers and designers in the modeling and analysis of automobiles, mechanical parts, and building structures. The auto industry is a good example of the benefits derived from using CAD. New car designs used to be created by hand with a full sized clay model built to see what it looked like in 3D. The model could take days or weeks to produce. Today, with the assistance of interactive graphics, all models are created in the computer.

ADVANTAGES OF INTERACTIVE COMPUTER GRAPHICS


Graphics provides one of the most natural means of communicating with a computer,
Since our highly developed 2D and 3D pattern-recognition abilities allow us to perceive and process pictorial data rapidly and efficiently. In Many design, implementation, and construction processes today, the information pictures can give is virtually indispensable. Scientific visualization became an important field. Scientists and engineers realized that they could not interpret the data and prodigious quantities of data produced in supercomputer runs without summarizing the data and highlighting trends and phenomena in various kinds of graphical representations.

Interactive computer graphics is the most important means of producing pictures.


Since the invention of photography and television; with the computer, we can make pictures not only of concrete, "real-world" objects but also of abstract, synthetic objects, such as mathematical surfaces in 4D and of data that have no inherent geometry, such as survey results. Furthermore, we are not confined to static images. Although static pictures are a good means of communicating information, Thus, a movie can show changes over time more graphically than can a sequence of slides. Thus, a sequence of frames displayed on a screen at more than 15 frames per second can convey smooth motion or changing form better than can a jerky sequence,

Interactive graphics offers a large number of usercontrollable modes with which to encode and communicate information.
The 2D or 3D shape of objects in a picture, their gray scale or color, and the time variations of these properties. With the recent development of digital signal processing (DSP) and audio synthesis chips, audio feedback can now be provided to augment the graphical feedback and to make the simulated environment even more realistic.

Interactive computer graphics thus permits extensive, highbandwidth user-computer interaction.


This significantly enhances our ability to understand data, to perceive trends, and to visualize real or imaginary objects.

By making communication more efficient, graphics make possible higher-quality and more precise results or products, greater productivity, and lower analysis and design costs.

GRAPHIC FUNCTIONS
Initgraph():
Purpose: It is used to initialize the graphics system. It initializes the graphics driver from the disk and then puts the system into graphics mode. It also reset the graphics setting like colors, fonts . Syntax: Void initgraph(int *gdriver,int* gmode,char* path); Gdriver is an integer that specifies the graphics driver to be used. Gmode is an integer that specifies the initial graphics mode. Path specifies the directory path where initgraph() fist look fo graphics driver.

Closegraph():
Purpose: Closegraph function closes the graphics mode, deallocates all memory allocated by graphics system and restores the screen to the mode it was in before you called initgraph. Syntax: Void closegraph();

Cleardevice() :
Purpose: Cleardevice function clears the screen in graphics mode and sets the current position to (0,0). Clearing the screen consists of filling the screen with current background color.

Syntax: void cleardevice();

Arc():
Purpose: Arc function is used to draw an arc with center (x,y) and stangle specifies starting angle, endangle specifies the end angle and last parameter specifies the radius of the arc. arc function can also be used to draw a circle but for that starting angle and end angle should be 0 and 360 respectively. Syntax: void arc(int x, int y, int stangle, int endangle, int radius);

Circle():
Purpose: Circle function is used to draw a circle with center (x,y) and third parameter specifies the radius of the circle. The code given below draws a circle. Syntax: void circle(int x, int y, int radius);

Getbkcolor() :
Purpose: Getbkcolor function returns the current background color Syntax : int getbkcolor();

Getcolor():
Purpose: Getcolor function returns the current drawing color. Syntax : int getcolor();

Getmaxcolor():
Purpose: Getmaxcolor function returns maximum color value for current graphics mode and driver. Total number of colors available for current graphics mode and driver are ( getmaxcolor() + 1 ) as color numbering starts from zero. Syntax: int getmaxcolor();

Getmaxx():
Purpose: Getmaxx function returns the maximum X coordinate for current graphics mode and driver. Syntax: int getmaxx();

Getmaxy():
Purpose: Getmaxy function returns the maximum Y coordinate for current graphics mode and driver. Syntax : int getmaxy();

Getpixel():
Purpose: Getpixel function returns the color of pixel present at location(x, y). Syntax: int getpixel(int x, int y);

Line():
Purpose: Line function is used to draw a line from a point(x1,y1) to point(x2,y2) i.e. (x1,y1) and (x2,y2) are end points of the line.The code given below draws a line. Syntax: void line(int x1, int y1, int x2, int y2);

Rectangle():
Purpose: Rectangle function is used to draw a rectangle. Coordinates of left top and right bottom corner are required to draw the rectangle. left specifies the X-coordinate of top left corner, top specifies the Y-coordinate of top left corner, right specifies the X-coordinate of right bottom corner, bottom specifies the Ycoordinate of right bottom corner. The code given below draws a rectangle. Syntax: void rectangle(int left, int top, int right, int bottom);

Outtext():
Purpose: Outtext function displays text at current position. Syntax: void outtext(char *string);

Outtextxy():
Purpose: Outtextxy function display text or string at a specified point(x,y) on the screen. Syntax: void outtextxy(int x, int y, char *string);

Setbkcolor():
Purpose: Setbkcolor function changes current background color e.g.

setbkcolor(YELLLOW) changes the current background color to YELLOW. Remember that default drawing color is WHITE and background color is BLACK. Syntax: void setbkcolor(int color);

Setcolor():
Purpose: In Turbo Graphics each color is assigned a number. Total 16 colors are available. Strictly speaking number of available colors depends on current graphics mode and driver.For Example :- BLACK is assigned 0, RED is assigned 4 etc. setcolor function is used to change the current drawing color.e.g. setcolor(RED) or setcolor(4) changes the current drawing color to RED. Remember that default drawing color is WHITE. Syntax: void setcolor(int color);

Setfillstyle():
Purpose: Setfillstyle function sets the current fill pattern and fill color.

Syntax: void setfillstyle( int pattern, int color);

Settextstyle():
Purpose: Settextstyle function is used to change the way in which text appears, using it we can modify the size of text, change direction of text and change the font of text. Syntax: void settextstyle( int font, int direction, int charsize);

Settextjustify():
Purpose: Sets text justification fo graphics function.The default justification settings are LEFT_TEXT(for horizontal) and TOP_TEXT(fo vertical). Syntax: Void settextjustify(int hoiz,int vert);

Setfillpattern():
Purpose: Selects a use-defined fill patten. Syntax: Void setfillpattern(char* upattern,int color);

OUTPUT PRIMITIVES
Line() :- This function draws a line in graphics mode between two specify end points. It draws the line using the current color,line setting and style. Syntax: void line(int x1,int y1,int x2,int y2); Whereas x1 and y1 are the starting points of the line.x2 and y2 are the ending points of the line. Linerel():-Draws the line a relative distance from the current position. Syntax: void linerel(int dx,int dy); The parameters dx and dy is the horizontal and vertical distance. Lineto():-This function draws the line from current position to x,y position specified in the function. Syntax:void lineto(int x,int y); Circle():-This function draws the circle on the graphic screen with a centre given by x,y coordinates and the radius. Syntax:void circle(int x,int y,int radius); Rectangle():-This function draws the rectangle in graphics mode using current line style and color. Syntax:void rectangle(int left,int top,int right,int bottom); The first two parameters specified the coordinates of one corner of rectangle and other two parameters gives the opposite corner. Cleardevice():-This function clears the entire graphics screen and moves the current position to(0,0). Syntax: void cleardevice(); Closegraph():-This function shut down the graphics system and deallocates all memory allocated by graphics system. Syntax: void closegraph();

Ellipse():- This function draws an elliptical arc on the graphics screen. Syntax: void ellipse(int x, int y, int startangle, int endangle, int x radius, int y radius); This function draws an ellipitical arc in the current drawing color with its center(x,y) and the horizontal and vertical axes given by (xradious &yradious).The start angle and end angles of arc in decreases. Getmaxx():-This function gives the maximum horizontal screen co-ordinates as the return value. The horizontal screen co-ordinate specify x co-ordinate values. Syntax: int getmaxx(); Getmaxy():- This fynction returns the maximum vertical screen co-ordinates. The vertical screen co-ordinates specify the y co-ordinate value. Syntax: int getmaxy(); Putpixel():- This function plots a pixel at a specified point. Syntax: void putpixel(int x, int y, int color); Arc():- This function draws a circular arc on the graphics screen using current drawing color and line styles. Syntax: void arc(int x, int y, int startangle, int endangle, int radius); Bar():- This function draws a bar on the graphics screen by filling the specified rectangular area with the current fill color and fill pattern. Syntax: void bar(int left, int top, int right, int bottom); Bar3d():-This function draws a 3-dimentional bar, then fills it using the current fill pattern and fill color. Syntax: void bar3d( int left, int top,int right, int bottom, int depth, int flag); The parameters left,top specifies the upper left corner of the bar. The parameters right ,bottom specifies the lower right corner of the bar. The depth specifies the bars depth in pixels. The flag parameter governs whether a 3-dimensional top is put on the bar or not.

INTRODUCTION OF PROJECT

Tic-tac-toe (or noughts

and

crosses)

is

a pencil-paper-game for

two

players, X and O, who take turns marking the spaces in a 33 grid. The player who succeeds in placing three respective marks in a horizontal, vertical,diagonal row wins the game. The following example game is won by the first player, X:

Players soon discover that best play from both parties leads to a draw (often referred to as cat or cat's game). Hence, tic-tac-toe is most often played by young children.

Despite its apparent simplicity, Tic-tac-toe requires detailed analysis to determine even some elementary combinatory facts, the most interesting of which are the number of possible games and Naive counting leads to 19,683 possible board layouts (39 since each of the nine spaces can be X, O or blank), and 362,880 (i.e. 9!) possible games (different sequences for placing the Xs and Os on the board). However, two matters much reduce these numbers: The game ends when three-in-a-row is obtained. The number of Xs is always either equal to or exactly 1 more than the number of Os (if X starts the number of possible positions. Tic-tac-toe is a good choice for an example program. Its a simple yet still non trivial game, so its interesting. Everyone knows the rules, which makes it easy to understand the architecture and code design.

PURPOSE
This project is developed using C and Computer Graphics.
This project provides us a mutual environment for playing the game.It provides us a 3x3 grid box in which two players can easily play.This is a pencil paper game which consists of two options (crosses and zeros). It is a childish game and is considered to be the best for passing time. It is very entertaining game and can be played by anyone. It is the most simple and interesting game to be played with. It also helps us for increasing the skills of the person.

SYSTEM FEASIBILITY
Before developing the system feasibility study was conducted. It was found that the proposed system is technically,economically and operationally feasible. TECHNICAL FEASIBILITY: The system was developed with window as an operating system. The system is user friendly,thus report generation of data entry is made easy. Easy retrieval and access to data is provided. Further development such as developing the software, so that automatic will can be printed. ECONOMIC FEASIBILITY: Economically feasibility basically is a good analysis.Keeping this in view the system is economically feasible.Possible questions raised in economic analysis are:

Is the system cost effective?

The cost of doing full system study.


Estimated cost of hardware. Estimated cost of software/software development. Is the project possible, given the resource constraints?

OPERATIONAL FEASIBILITY: Proposed system is beneficial only if they can be turned into information system that will meet the organization operating requirements.As the system is user friendly , throughout , the system is well linked and approved by users showing

no resistance what so ever at all. If the user want more facitity,that can be provided. The system has been prepared keeping in mind the users current requirements. However further modifications can be made in the system in case the users requirements change in further.The proposed system will cause no harm to the organization but instead . It will enhance the result better respect.

CODING
Coding: the code and unit-testing phase entails converting the design language into program code and most important,designing and carrying out test of individual units.One individual modules or units have been tested and accepted,the integration and test begins. 1. Program language: Selecting a programming language according to the need of project i.e.compiler status,availability of training etc. 2. Simple style rule: Making identifying names as meaningful as to programming style and programming quality. Possible using local definitions etc. Comments statements e.g. using prologue an explanatory comment statement very efficient , providing important executable code neatly. 3. Program quality: Readability, understandability . Reuseable code.

TESTING

The basic levels of testing are unit testing ,integration testing ,system testing and acceptance testing. Unit Testing: Once the code is generated , the software program testing begins.Different testing methodologies are available to unravel the bugs that were commited during the previous phases.Different testing tools and methodologies are already available. Integation and unit testing: In this the different units are integrated and the overall system is tested.Integration testing is performed after the units testing of the components. Acceptance Testing Testing the system with the intent of confirming the product and customer acceptance. After passing Unit Testing and Sytem Testing project ia adjusted and Checked so that it can be accepted by the user.

IMPLEMENTATION, EVALUATION AND MAINTENANCE


Implementation is the process of having system personnel check out and put not equipment into use, train users install the new application and construct any files data to needed to use it. This phase is less creative than system design. Depending on the size of the organization that will be involved may choose to test the operation in only one area of the firm with only one or two persons. Sometimes, they will run old and new system in parallel way to compare the results. In still others situations, system developers stop using the old system one day and start using the new one the next. Evaluation of the system is performed to identified its strengths and weaknesses. The actual evaluation can occur along any of the following dimensions: I. Operational Evaluation: Assessment of the manner in which the system functions, including case of use, response time, overall reliability and level of utilization. II. Organization Impact: Identification and measurement of benefits to the organization in such areas as financial concerns, operational efficiency and competitive impact III. User Manager Assessment Evaluation of the attitudes of senior and user manger within the organization, as well as end-users. IV. Development Performance: Evaluation of the development process in accordance with such yardsticks as overall development time and effort, conformance to budgets and standards and other project management criteria.

Maintenance is necessary to eliminate errors in the working system during its working life and to tune the system to any variations in its working environment often small system deficiencies are found as a system is brought into operations and changes are made to remove them. System planners must always plan for resource availability to carry out these maintenance functions. The importance of maintenance is to continue to bring the new system to standards

HARDWARE AND SOFTWARE REQUIREMENTS


MINIMUM HARDWARE REQUIREMENTS:. Minimum 20MB or more Hard Disk. Mouse VGA Monitor Keyboard Minimum 60MB RAM.

MINIMUM SOFTWARE REQUIREMENTS: Window 3.0,Window XP or higher Operating System. C,C++,Graphics The above discussed system requirements are the minimum requirements that are need to run this system . The user may have more than the above discussed system requirements.

CODING:
#include<stdio.h> #include<conio.h>

void Board(); void PlayerX(); void PlayerO(); void Player_win(); void check(); int win=0,wrong_X=0,wrong_O=0,chk=0;

char name_X[30]; char name_O[30]; int pos_for_X[3][3]; int pos_for_O[3][3]; int pos_marked[3][3];

void main() { int i,ch,j; char ans; /*clrscr(); printf("\n\t\t\t\tTIC TAC TOE"); printf("\n\t\t\t\t");

for(i=1;i<=11;i++) { delay(10000); printf("*"); }*/ do { clrscr(); printf("\n\t\t\t\tTIC TAC TOE"); printf("\n\t\t\t\t"); for(i=1;i<=11;i++) { delay(10000); printf("*"); } printf("\n1.Start The Game"); printf("\n2.Quit The Game"); printf("\nEnter your choice(1-2) : "); scanf("%d",&ch); switch(ch) { case 1: chk=0; win=0;

for(i=1;i<=3;i++) { for(j=1;j<=3;j++) { pos_for_X[i][j]=0; pos_for_O[i][j]=0; pos_marked[i][j]=0; } } printf("\n\n"); clrscr(); printf("\nEnter the name of the player playing for \'X\': "); fflush(stdin); gets(name_X); printf("\nEnter the name of the player playing for \'O\': "); fflush(stdin); gets(name_O); Board(); for(;;) { if(win==1) break; check(); if(chk==9)

{ printf("\n\t\t\tMATCH DRAWS!!"); printf("\nPress any key...."); break; } else chk=0; printf("\nTURN FOR %s:",name_X); PlayerX(); do { if(wrong_X!=1) break; wrong_X=0; printf("\nTURN FOR %s:",name_X); PlayerX(); }while(wrong_X==1); check(); if(chk==9) { printf("\n\t\t\tMATCH DRAWS"); printf("\nPress any key...."); break; }

else chk=0; printf("\nTURN FOR %s:",name_O); PlayerO(); do { if(wrong_O!=1) break; wrong_O=0; printf("\nTURN FOR %s:",name_O); PlayerO(); } while(wrong_O==1); } Board(); if(win!=1) { printf("\n\t\t\tMATCH DRAWS!!"); printf("\nPress any key......."); } getch(); break; case 2: printf("\n\n\n\t\t\tThank You For Playing The Game.");

printf("\n\t\t\t###############################"); getch(); exit(1); break; } printf("\nWant To Play(Y/N) ? "); fflush(stdin); scanf("%c",&ans); }while(ans=='y' || ans=='Y'); } void Board() { int i,j; clrscr(); printf("\n\t\t\t\tTIC TAC TOE BOARD"); printf("\n\t\t\t\t*****************"); printf("\n\n\n"); printf("\n\t\t\t 1\t for(i=1;i<=3;i++) { printf("\n \t\t\t _____________________________"); printf("\n \t\t\t\t \t \t printf("\n\t\t%d\t",i); for(j=1;j<=3;j++) "); 2\t 3");

{ if(pos_for_X[i][j]==1) { printf(" X"); printf(" } else if(pos_for_O[i][j]==1) { printf(" O"); printf(" } else { printf(" continue; } } printf("\n\t\t\t\t \t \t } printf("\n\t\t\t------------------------------"); Player_win(); } void PlayerX() { "); "); "); ");

int row,col; if(win==1) return; printf("\nEnter the row no. : "); fflush(stdin); scanf("%d",&row); printf("Enter the column no. : "); fflush(stdin); scanf("%d",&col); if(pos_marked[row][col]==1 || row<1 || row>3 || col<1 || col>3) { printf("\nWRONG POSITION!! Press any key....."); wrong_X=1; getch(); Board(); } else { pos_for_X[row][col]=1; pos_marked[row][col]=1; Board(); } } void PlayerO()

{ int row,col; if(win==1) return; printf("\nEnter the row no. : "); scanf("%d",&row); printf("Enter the column no. : "); scanf("%d",&col); if(pos_marked[row][col]==1 || row<1 || row>3 || col<1 || col>3) { printf("\nWRONG POSITION!! Press any key...."); wrong_O=1; getch(); Board(); } else { pos_for_O[row][col]=1; pos_marked[row][col]=1; Board(); } } void Player_win() {

int i; for(i=1;i<=3;i++) { if(pos_for_X[i][1]==1 && pos_for_X[i][2]==1 && pos_for_X[i][3]==1) { win=1; printf("\n\nRESULT: %s wins!!",name_X); printf("\nPress any key............"); return; } } for(i=1;i<=3;i++) { if(pos_for_X[1][i]==1 && pos_for_X[2][i]==1 && pos_for_X[3][i]==1) { win=1; printf("\n\nRESULT: %s wins!!",name_X); printf("\nPress any key............"); return; } } if(pos_for_X[1][1]==1 && pos_for_X[2][2]==1 && pos_for_X[3][3]==1) { win=1;

printf("\n\nRESULTL: %s wins!!",name_X); printf("\nPress any key......"); return; } else if(pos_for_X[1][3]==1 && pos_for_X[2][2]==1 && pos_for_X[3][1]==1) { win=1; printf("\n\nRESULT: %s wins!!",name_X); printf("\nPress any key....."); return; } for(i=1;i<=3;i++) { if(pos_for_O[i][1]==1 && pos_for_O[i][2]==1 && pos_for_O[i][3]==1) { win=1; printf("\n\nRESULT: %s wins!!",name_O); printf("\nPress any key....."); return; } } for(i=1;i<=3;i++) {

if(pos_for_O[1][i]==1 && pos_for_O[2][i]==1 && pos_for_O[3][i]==1) { win=1; printf("\n\nRESULT: %s wins!!",name_O); printf("\nPress any key....."); return; } } if(pos_for_O[1][1]==1 && pos_for_O[2][2]==1 && pos_for_O[3][3]==1) { win=1; printf("\n\nRESULT: %s wins!!",name_O); printf("\nPress any key....."); return; } else if(pos_for_O[1][3]==1 && pos_for_O[2][2]==1 && pos_for_O[3][1]==1) { win=1; printf("\n\nRESULT: %s wins!!",name_O); printf("\nPress any key....."); return; } }

void check() { int i,j; for(i=1;i<=3;i++) { for(j=1;j<=3;j++) { if(pos_marked[i][j]==1) chk++; else continue; } } }

BIBLIOGRAPHY

References: 1. Interactive Computer Graphics 2. Theory & Problems of Computer Graphics 3. Computer Graphics 4. Computer Graphics and Multimedia Application 5.Mastering Turbo C 6.Fundamentals of Interactive Computer Graphics

Authors Name: Giloi, W.K. Schaum Series Hearn,D.,Baker P.M

John Dimacro Kelly Bootle Foley,J.D

PROJECT REPORT ON TIC TAC TOE


Submitted to PANJAB UNIVERSITY,CHANDIGARH in partial fulfillment of the requirement for the degree of
MASTERS OF SCIENCE IN INFORMATION TECHNOLOGY (M.Sc.(IT) 1st Semester)

By Simran Kaur Jaspreet Kaur Jasleen Kaur

Department of Computer Science

GURU NANAK GIRLS COLLEGE MODEL TOWN,LUDHIANA


Session: 2012-13

PROJECT REPORT ON TIC TAC TOE


Submitted to PANJAB UNIVERSITY,CHANDIGARH in partial fulfillment of the requirement for the degree of
MASTERS OF SCIENCE IN INFORMATION TECHNOLOGY (M.Sc.(IT) 1st Semester)

Project Guide: Mrs.Pawanjot Kaur

Submitted by: Jaspreet Kaur Rollno. Simran Kaur Rollno. Jasleen Kaur Rollno.

Department of Computer Science

GURU NANAK GIRLS COLLEGE MODEL TOWN, LUDHIANA


Session: 2012-13

You might also like