Professional Documents
Culture Documents
Tic Tac Toe PDF
Tic Tac Toe PDF
PROJECT ASSOCIATES
1. Tanushree.P.Wandkar 4BD09CS114
2. Latesh.R.S 4BD09CS051
PROJECT GUIDES:
2011-12
Bapuji Educational Association (Regd.)
CERTIFICATE
This is to certify that Tanushree.P.Wandkar and Latesh.R.S bearing USN 4BD09CS114 and
4BD09CS051 respectively has satisfactorily completed the project work entitled “TIC TAC
TOE & ROCKET SMASH” and submitted this report for the academic year 2011-12.
Project Guides
------------------------ --------------------
Dr. Poornima B.Ph.D Mr. ABDUL RAZAK M.S.B.E (M. Tech)
Asst. Professor, CS&E DEPT Lecturer, CS&E DEPT
-----------------------
Prof. R. D. ShivanandM.Tech, M.I.S.T.E.I.F.E
Head of Department
CERTIFICATE
This is to certify that Tanushree.P.Wandkar bearing USN 4BD09CS114 respectively has
satisfactorily completed the project work entitled “TIC TAC TOE & ROCKET SMASH”
and submitted this report for the academic year 2011-12.
Project Guides
------------------------ --------------------
Dr. Poornima B.Ph.D Mr. ABDUL RAZAK M.S.B.E (M. Tech)
Asst. Professor, CS&E DEPT Lecturer, CS&E DEPT
-----------------------
Prof. R. D. Shivanand
Head of Department
M.Tech, M.I.S.T.E.I.F.E
CERTIFICATE
This is to certify that Latesh.R.S bearing USN 4BD09CS051 respectively has satisfactorily
completed the project work entitled “TIC TAC TOE & ROCKET SMASH” and submitted
this report for the academic year 2011-12.
Project Guides
------------------------ --------------------
Dr. Poornima B.Ph.D Mr.ABDULRAZAK M.S.B.E (M. Tech)
Asst. Professor, CS&E DEPT Lecturer, CS&E DEPT
-----------------------
Prof. R. D. Shivanand
Head of Department
M.Tech, M.I.S.T.E.F.E.
ACKNOWLEDGEMENTS
“Bapuji Institute of Engineering and Technology” for having well qualified staff and
labs furnished with necessary equipment‟s.
I express our sincere thanks to our guides Dr. Poornima B and Mr. ABDUL RAZAK
M.S for giving us constant encouragement, support and valuable guidance throughout the course
of the project without whose stable guidance this project would not have been achieved.
Our due thanks to Dr. RAMASWAMY, the principal, as we consider ourselves very
lucky to have such excellent computing facilities and their inspiration throughout our
professional course.
We also thank the non-teaching staff of CS Dept. who guided at the time of difficulties.
Finally we thank all those who are involved directly and indirectly in completion of our
project.
-Tanushree.P.Wandkar
-Latesh.R.S
ABSTRACT
Our project which uses OpenGL Technology is a very simple approach towards demonstrating
the use of basic features or functions provided in OpenGL.
The project is associated with two simple games one of which is called as “TIC-TAC-TOE” for
2 players, one for „Red‟ and other for „Blue‟, who takes turns making the spaces in 3x3 grid. The
„Red‟ player goes first. The player who succeeds in placing their respective colours in a
horizontal, vertical or diagonal rows or columns wins the game. If the players do not succeed in
placing their respective colours in a horizontal, vertical or diagonal rows or columns and if there
are no further blocks to be filled then the game is considered to be over!!!
The other one is called as “ROCKET SMASH” which is for a single player in which player
needs to move his rocket up or down to make itself to survive against the incoming obstacles at
different positions. If he collides with the obstacle which is approaching the rocket then the game
is over!!!
CONTENTS
Chapter 1: Introduction
1.1 OpenGL
1.2 Project Problem statement
Chapter 6: Conclusion
Chapter 7: References
CHAPTER 1:INTRODUCTION
1.1 OpenGL:
hardware support. It is designed for use in any graphics applications, from games to modeling to
CAD. Many games use OpenGL for their core graphics-rendering engines.
OpenGL Architecture
The project is associated with two simple games which is called as “Tic-Tac-Toe” for 2 players,
one for „Red‟ and other for „Blue‟, who takes turns making the spaces in 3x3 grid. The „Red‟ player
goes first. The player who succeeds in placing their respective colours in a horizontal, vertical or
diagonal rows or columns wins the game. If the players do not succeed in placing their respective
colours in a horizontal, vertical or diagonal rows or columns and if there are no further blocks to be
filled then the game is considered to be over!!!.
The other one is called as “ROCKET SMASH” which is for a single player in which player needs to
move his rocket up or down to make itself to survive against the incoming obstacles at different
positions. If he collides with the obstacle which is approaching the rocket then the game is over!!!
SOFTWARE REQUIREMENTS:
HARDWARE REQUIREMENTS:
CHAPTER 3: DESIGN
Main Flowchart
Tic-Tac-Toe Flowchart
CHAPTER 4: IMPLEMENTATION
We have used some of the inbuilt functions of the graphics package like
Specifying simple geometry:
o Void glBegin(glEnum mode)
Initiates a new primitive of type mode and starts the collection of vertices.
Values of mode include GL_POINTS,GL_LINES,GL_POLYGON.
o void glEnd()
Terminates a list of vertices.
Attributes:
o void glColorf[b I f d ub us ui](TYPE r, TYPE g, TYPE b, TYPE a)
Sets the present RGB colours. Valid types are byte (b), int (i), float (f),
double (d), unsigned byte (ub), unsigned short (us), and unsigned int
(ui).
o void glClearcolor(GLclampfr,GLclampfg,GLclampfb,GLclampf a)
Sets the present RGBA clear colour used when clearing the colour
buffer. Variables of type GLclampf are floating point numbers
between 0.0 and 1.0.
o intglutCreateWindow(char *title)
Creates a window on the display. The string title can be used to label the window.
The return value provides a reference to the window that can be used when there
are multiple windows.
(GLUT_RGB,GLUT_INDEX)andbuffering
(GLUT_SINGLE,GLUT_DOUBLE).
o void glutWindowPosition(intx,int y)
Specifies the initial position of the top-left corner of the window in pixels.
o void glutMainLoop()
Cause the program to enter an event-processing loop. It should be the last
statement in main.
o void glutSwapBuffers()
Swaps the front and back buffers.
Interaction
o intglutCreateMenu(void (*f)(int value)
Returns an identifier for a top-level menu and registers the call-back function f
that returns an integer value corresponding to the menu entry selected.
Transformations
o void glMatrixMode(GLenum mode)
Specifies which matrix will be affected by subsequent transactions. Mode can be
GL_MODEL_VIEW, GL_PROJECTION orGL_TEXTURES.
o void glLoadIdentity()
Sets the current transformation matrix to an identity matrix.
Viewing
o void gluOrtho2D(GLdoubleleft,GLdoubleright,GLdoublebottom,GLdouble top)
Defines a two dimensional viewing rectangle in the plane z=0.
Adding text
o void glutBitmapCharacter(void *font,int char)
Void draw ()
{
//draw the 3x3 grid on the screen
}
Draw () function draws the green colored 3x3 grid on the screen. This function is called from
display as soon as the key„d‟ is pressed.
Void drawpolygon ()
{
//draws the polygon in red or blue color
}
Drawpolygon() function draws a square at the valid location specified by the mouse pointer in
the grid when the key „r „ or „b‟ is pressed.
Void rocket()
{
/draws a rocket on the screen/
}
Rocket() function draws a rocket looking object on the screen which can be controlled by keys
„a‟ and „s‟ for its movement.
Void obstacle()
{
//defines two obstacles at two different positions on the screen.
}
obstacle function predefines two obstacles which randomly selects one of those two and moves
from right to left .
void moveobst()
{
//changes the position of the selectd obstacle and redisplays on the screen.
}
Moveobst() function moves the selected objects from right end of the screen to left end of the
screen.
Void night()
{
//draws a scene of night with moon and three buildings in the background on the screen.
}
Night() function draws a scene of night with moon and three buildings in the background on the
screen.
Void movenight()
{
//moves the scene drawn by the night() function
}
Movenight() function changes the position of the scene drawn by the night() function and makes
it to move in background from right to left.
1. Start Screen
2.START OF TIC-TAC-TOE
4. Red wins
5. Blue wins
6. Game over
9. GAME OVER
CHAPTER 6: CONCLUSION
Our project aimed at achieving the game of “TIC-TAC-TOE & ROCKET SMASH”
where in the TIC TAC TOE originally cross marks circles are used instead we have made use of
filling colors into selected blocks
We can enhance the same game by changing the grid size from 3x3 to 4x4 or higher sizes
so that we can increase the level of difficulty
CHAPTER 7: REFERENCES
WEBSOURCES
www.google.com
www.OpenGL simple examples.
www.wikipedia.com
www.swiftlesstutorials.com