You are on page 1of 18

ANNA UNIVERSITY :: TIRUNELVELI

CS-47 COMPUTER GRAPHICS LABORATORY RECORD
Submitted By PRASANTH O.R L RATHINA PRABHU ALOK J SUDHAKAR

DEPARTMENT OF INFORMATION TECHNOLOGY MEPCO SCHLENK ENGINEERING COLLEGE, MEPCO NAGAR, SIVAKASI-626 005 200 ! 20"0
1

S$6.) M'4&.:$.( 200 -20"07 779799999999999 S).** I.. -.:$. L.:$.) $% )#' B-.*$+' /-(0 +-.5 C-33'5'..CERTIFICATE T#$% $% &'()$*$'+ )#.3 E.3 E.R.():'.RATHINA PRABHU.%$7 D8($.)-(2 .&)$&.5 C-33'5'.5$.0.)'(.) S81:$))'+ *-( )#' P(.' 12 PRASANTH O.S&#3'.(5' 7999999999997 H'.ALOK J SUDHAKAR $. 999999999999999 77999999999977 I.'( 999999999997 E.)$-.)'(.3 E.0 E.) M'4&.''($.''($...+ -* )#' D'4. &#.S&#3'. )#' CS47 OPERATING SYSTEM 3.1-(.. #'3+ .0 E.5 )#' Y'.5$...'( 2 .

<TIC TAC TOE= TABLE OF CONTENTS 3 .

) P.S7N- C-.)'.& T-' 4 .5' " 2 ? 4 5 6 7 > ABSTRACT INTRODUCTION SPECIFICATION STUDY OF E@ISTING SYSTEM PROPOSED SYSTEM SOFTAARE REBUIREMENTS HARDAARE REBUIREMENTS DINING PHILOSOPHER SCHEMA IMPLEMENTATION > "2 "2 "? "? "4 "5 "6 "6 24 26 27 7 "0 "" "2 "? CODING SNAP SHOT CONCLUSION BIBILOGRAPHY T$& T.

5 .The various prespective orthogonal views are also provided .There is a board of #X# and there are $ places to keep the object.Once a player gets his own object thrice in a hori%ontal or vertical or diagonal manner he has won the game.The smooth shading is also done on the objects and the lighting is also used in the gaming area.The game is played between the user and the computer and the result depends on the game being played as computer winning or player winning and it may also lead to tie which occurs mostly.The game needs the mind to play in an effective manner for winning.The game also consists of X and O and each select the required X or O and the game starts with each given a chance to place their object X or O! in the bo"es provided .This is one of the familr and popular game in the world."7 ABSTRACT: This project is mainly based on the all known game called as the tic tac and toe.One of important concept implemented here is that the game is designed in OpenGL Open Graphics Library where the major graphics properties are being implemented.

&-)-'& also called /$&0 /.+ &(-%%'% is a pencil'and'paper game for two players& @ and O& who take turns marking the spaces in a #(# grid. +ence& tic'tac'toe is most often played by young children.3 4-%$)$-. N8:1'( -* )'(:$.27INTRODUCTION T$&-)..&1#2 possible games up to rotations and reflections the game tree comple"ity! on this space.t is straightforward to write a computer program to play tic'tac'toe perfectly& to enumerate the -./ essentially different positions the state space comple"ity!& or the 0. 5ssuming that X makes the first move every time) 6 .e. The player who succeeds in placing three respective marks in a hori%ontal& vertical& or diagonal row wins the game.% 3hen considering only the state of the board& and after taking into account board symmetries i.&0 /-' and .. . The @ player usually goes first. The friendliness of tic'tac'toe games makes them ideal as a pedagogical tool for teaching the concepts of good sportsmanship and the branch of artificial intelligence that deals with the searching ofgame trees. The following e"ample game is won by the first player& X) *layers soon discover that best play from both parties leads to a draw. rotations and reflections!& there are only 4#1 terminal board positions.-85#)% .

A$. 5ssuming that X makes the first move every time)    4#4&416 finished games are won by X! --&$26 finished games are won by O! 6. has two in a row& play the third to block them.&1#2. . 3ith the use of computer& 7teve 7chaeffer determined in 0220 that the number of games in these conditions is 0.1 possible games. B3-&0) . 7 . 9ote that only two sequences of moves by O both starting with center& top'right& left'mid! lead to a draw& with the remaining sequences leading to wins from X.f the :opponent. STRATEGY : Optimal strategy for player X.:'% 3ithout taking symmetries into account& the number of possible games can be determined by hand with an e"act formula that leads to 0//&4.) . 0. 4.&212 finished games are drawn .n each grid& the shaded red X denotes the optimal move& and the location of O8s ne"t move gives the ne"t subgrid to e"amine.f the player has two in a row& play the third to get three in a row.   $4 unique positions are won by X! 66 unique positions are won by O! # unique positions are drawn N8:1'( -* 4-%%$13' 5. 5 player can play perfect tic'tac'toe win or draw! given they move according to the highest possible move from the following table.f board symmetries are taken into account& two games are considered the same if the sequence of board modulo the symmetries is the same.

'() . The same is true of every edge mark. Once the opening is 8 . F-(0) <reate an opportunity where you can win in two ways. 6.f there is a configuration where the opponent can fork& block that fork. *laying a corner in this scenario creates a fork for >X> to win. 5n edge opening must be answered either with a center mark& a corner mark ne"t to the X& or an edge mark opposite the X. -. The first player& whom we shall designate >X>& has # possible positions to mark during the first turn.  /.)C% F-(0)  O4)$-. 2) .! O4)$-. The second player& whom we shall designate >O>& must respond to X8s opening mark in such a way as to avoid the forced win. *layer X can win or force a draw from any of these starting marks? however& playing the corner gives the opponent the smallest choice of squares which must be played to avoid losing. B3-&0 -44-. 5ny other responses will allow X to force the win. C'.. O44-%$)' &-(. =or e"ample& if >X> has a corner& >O> has the center& and >X> has the opposite corner as well& >O> must not play a corner in order to win. 1. +owever& by rotating the board& we will find that in the first turn& every corner mark is strategically equivalent to every other corner mark. =or strategy purposes& there are therefore only three possible first marks) corner& edge& or center. *layer O must always respond to a corner opening with a center mark& and to a center opening with a corner mark.'() *lay in a corner square. 7uperficially& it might seem that there are $ possible positions& corresponding to the $ squares in the grid.f the opponent is in the corner& play the opposite corner. ") <reate two in a row to force the opponent into defending& as long as it doesn8t result in them creating a fork or winning.#. E:4)2 &-(. .)'() *lay the center. E:4)2 %$+') *lay in a middle square on any of the 6 sides.'.

The board is divided into #X# squares and each square can be occupied by one icon. . @ach player has an icon depicting a nought O ! or a cross @ !.f three icons of same type appear in a row either vertically or hori%antally or diagonally& the user of that icon will be declared winner by the system.. 27" SOFTAARE REBUIREMENT SPECIFICATION Tic'Tac'Toe is a board'game.t also visvali%es the graphics properties such as shading&lighting and as such.completed& O8s task is to follow the above list of priorities in order to force the draw& or else to gain a win if X makes a weak play.f a player quits the game then his opponent will be declared winner by the system. Apon starting the game& the system should allow the players to make moves alternatively or to quit. .f all the squares of the board are filled and no user is the winner then the game is declared as draw by the system. .t has two players. AUDIENCE: 9 . OBDECTIVE: Our objective is to create a gaming environment which encourages the users to play in it . .

t also enhances the views by providing various views and also attractive objects X and O!that enables the small kids to be pulled to it. ORGANIEATION: This document describes the simulation of the tic tac toe game where we use a #X# board where the major graphics and opengl utilities are being used . SCOPE OF THE SOFTAARE: 3e intend to create a project that satisfies the players who have decided and come to play the tic tac toe game .The intended users are administrators in an institution. . The various lighting effects are also used to the objects. 10 .

13' S4. ..O* P3. =inally& if the first player starts in one of the four other possible squares 6B$ odds!& if the second plays ne"t to his #B1 odds! or opposite 4B1 odds! it will be a draw? otherwise& the first player will win. Thus& the odds of the first player winning are 6B$"-B1 C 4B$"6B1 C 6B$"6B1 D 0B#& and the odds of a draw are 4B#.f the first player starts in the center 4B$ odds! and the second doesn8t answer in a corner 6B1 odds! the first will win? otherwise& it will be a draw.?7 SPECIFICATION: Our objective is to create a project that satisfies the players who have decided and come to play the tic tac toe game.3 B-. T-).$3. 11 .'%FA6.2'(% : Two T-).3 N.f the first player starts in a corner 6B$ odds! and the second player doesn8t answer in the center -B1 odds!& the first one will win? otherwise& it will be a draw.t also enables to pass the leisure time by indulging our mind to play the tic tac toe in an effective manner.&'%G : 9ine PROBABILITY: .

• 7ince it has no e"tra effects and visvuality is less&the probability of the user playing it many times is greatly reduced.t also reduces the attraction of the users. • The game is a simple small game which ends in a couple of minutes. 12 .f he goes second 4B0 odds! he will tie with 4B# odds& and lose with 0B# odds. . 7o& the odds of winning are 4B0"0B#D4B#? tying& 4B0"4B#C4B0"4B#D4B#& and losing& logically also 4B# 47 STUDY OF E@ISTING SYSTEM: The main drawbacks of this normal tic tac toe are • The bo"es get over and it may end in a tie at most cases..f a player goes first 4B0 odds! he will win with 0B# odds& and tie with 4B# odds..

• The game is implemented with views such as perspective and orthogonal which helps the users to view the objects in various views which encourages the users to continue their game.. 13 .SOFTWARE REQUIREMENTS: This project has been implemented with Opengl where we can implement in Linu" using the glut library functions and it can also be implemented in windows where we need the visual studio to enter the code and the glut headers and library to be included into the folder where visual studio is being installed. 6.t also contains the functions for various views and also provides the shading and lighting properties which can be implemented easily using the inbuilt glut functions. 3e have choosen to implement in Opengl as it contains various graphics library functions and glut functions which enables us to create various graphical objects and effects.57 PROPOSED SYSTEM: The advantages of the our implementation are • The game is implemented with greater visual effects such as lighting shading as such which draws the players to play it.

3indows . *erformance is at an all'time high. 3e can now use more programs at the same time and they will run faster than ever.The tool bo" includes system tools that help us set and adjust system resources& Asers and user groups& and scheduled system tasks. 3indows .is dependable and stable& so we can always rely on the performance and effectiveness of our computer 14 .7.5mong the new features available in windows X* or windows -& there are new security tools that we can use to help keep our computer more secure& and new technologies that run in the background& making our computer run more efficiently and reliably. HARDWARE REQUIREMENTS 3indows X* or higher versions like 3indows .provides the tools that we need to work and play in todays high speed communications environment.has improved upon security& including the new 7ecurity <enter& which allows us to check the statusof the important security elements on our computer'3indows =irewall& 5utomatic Apdates& and virus protection software'najubg ut easuer fir us to understand how to keep our computer better protected against viruses and other secutity threats.

$.5 P#$3-%-4#'(% S&#':.>7 D$. M-+'3: 15 .

9.an" %.eft 0ight &o an" 1ottom 'iew!( "07C-+$.  &he % i! u!e" for ortho 'iew an" / for er! ecti'e  &he . i! u!e" for !witching the light! %.0&1 i! u!e" for the .. IMPLEMENTATION  Start the game  Select ‘left click’ to if you want the com uter to !tart fir!t which "raw! #  $n ca!e you want to !tart the game !elect ‘right click’ an" you "raw # an" com uter follow! %  &hen the game rocee"! a! the u!er kee ! the mo'e(  %nce the u!er enter! hi! o!ition the com uter "oe! it!(  %nce any o)*ect # or % i! containe" thrice "iagonally or hori+ontally or 'ertically then the game en"! an" the re!ult i! "i! laye"(  &he .5: SNAP SHOT: 16 .

CONCLUSION &hu! our ro*ect re!ult! in the effecti'e of )oth memory an" time an" thu! we trie" our )e!t to re"uce time an" ! ace com le4itie! an" the error! that are foun" "uring the creation are correcte" an" we ho e that our ro*ect may contain no error! an" in future we will im lement our future enhancement! too($t al!o enhance! the u!a)ility of the game )y ro'i"ing many glut ro ertie! an" al!o 'ariou! 'iew! an" the lightining !ha"ing effect! are al!o u!e" to 'i!'ali+e the game( 11.3S$%10. Future E !" #e$e t%: 5ere we ha'e im lemente" the tic tac toe game for the 343 )oar" an" in future we can e4ten" the )oar" to contain many ! ace! !uch a! 444 545 an" a! !uch which woul" increa!e the length of game(6l!o we can inclu"e !ome cele)ration effect! once a winning moment a 17 ear! an" the )oar" can al!o )e u!e" to 'iew in 37 angle .2%-2.

eter!on9 <ame! .'iew an" al!o the game can )e u!e" for laying )etween two u!er! rather than with the com uter( 1&.BIBLIO'RAPH( 8e woul" like to e4ten" our thank! to !taff9 !tu"ent! for their moral an" technical gui"ance( 8e ha'e referre"  Sil)er!chat+9 6)raham: .( =1988>( Operating Systems Concepts( 6""i!on?8e!ley   htt @AAen(wiki e"ia(orgAwikiA7iningB hilo!o her!B ro)lem htt @AAm!"n(micro!oft(comAen?u!Amaga+ineA""882512(a! 4 18 .