Tic Tac Toe game in Flex
SELVAKUMAR’S Learn fun thru Flex
Hi guys !!!!!!!! PLAY AND WIN THIS GAME TO GET FABULOUS PRIZES !!!!
Idea of the game is “Learn fun thru Flex”
But we have to follow certain rules for the game .
ABOUT GAME
1.This game consists of a 3*3 board.
2.U r allocated a symbol ‘U’
3.computer is allocated a symbol ‘C’
4.what to do is put ur symbol in any of the boxes and wait for computer’s turn
5.if any of the row or column is flooded with ur symbol then u r said to be the winner
DONT’s
1.dont try to modify the code and win
.
Please see my funny flexe sample program.
Fun Title : A funny TIC-TAC-TOE program in flex
Aim : DEFEND THE MOVES
List of Components:
1. GRID
Package
mx.containers
Class
public class Grid
Inheritance
Grid Box -> Container-> UIComponent -> FlexSprite-> Sprite-> DisplayObjectContainer -> InteractiveObject-> DisplayObject-> EventDispatcher-> Object
A Grid container lets you arrange children as rows and columns of cells, similar to an HTML table. The Grid container contains one or more rows, and each row can contain one or more cells, or items. You use the following tags to define a Grid control:
The <mx:Grid> tag defines a Grid container.
The <mx:GridRow> tag defines a grid row, which has one or more cells. The grid row must be a child of the <Grid> tag.
The <mx:GridItem> tag defines a grid cell, and must be a child of the <GridRow> tag. The <mx:GridItem> tag can contain any number of children.
2. MOUSE EVENTS
Package
flash.events
Class
public class MouseEvent
Inheritance
MouseEvent -> Event -> Object
Subclasses
AutomationDragEvent, ChartEvent, ChartItemEvent, DragEvent, FlexMouseEvent, LegendMouseEvent, NativeDragEvent, ScreenMouseEvent
Language Version:
ActionScript 3.0
Runtime Versions:
AIR 1.0, Flash Player 9
A MouseEvent object is dispatched into the event flow whenever mouse events occur. A mouse event is usually generated by a user input device, such as a mouse or a trackball, that uses a pointer.
How my Program works ?
The idea of the program is to defend the user moves.
I have a row array and column array if the user enters in to first row the first element of row array is incremented indicating that a element has been inserted in the first row and the corresponding element in the col array is also incremented.like wise all elements are incremented withrespect to the place where the user enters.
First we check the row elements to have a element “2” which indicates that there are two user symbols in a row and then the computer symbol “C” is put in the respective place to defend user from winning.
Else we check for column element to have a element “1” and put the Computer’s symbol “C” in any of the vaccant place in the column.
I have a count to count the number of user moves which is checked at the result to find whether game is leveled.
To view the source code click here :
http://live4blogs.wordpress.com/2009/07/21/a-funny-flexe-try-%e2%80%a6-catch-program-in-flex/
Wanna join Chipkidz Galatta ????
I welcome you to join our chipkidz galatta Mega Magazine Zone to
have fun,gain knowledge,share ideas. Let us make our Roadshow a milestone in our life! ..also to make more and more memorable event in our career !!!!!
Chipkidz Galatta !!! Keep uz Alertaa !!!!
Galatta Goal : Never fail to pass your ideas !!!
I invite you to join in this chipkidz galatta group
http://groups.google.com/group/chipkidzgalatta/
ABOUT GAME
1.This game consists of a 3*3 board.
2.U r allocated a symbol ‘U’
3.computer is allocated a symbol ‘C’
4.what to do is put ur symbol in any of the boxes and wait for computer’s turn
5.if any of the row or column is flooded with ur symbol then u r said to be the winner
–
List of Components:
1. GRID
A Grid container lets you arrange children as rows and columns of cells, similar to an HTML table. The Grid container contains one or more rows, and each row can contain one or more cells, or items. You use the following tags to define a Grid control:
The <mx:Grid> tag defines a Grid container.
The <mx:GridRow> tag defines a grid row, which has one or more cells. The grid row must be a child of the <Grid> tag.
The <mx:GridItem> tag defines a grid cell, and must be a child of the <GridRow> tag. The <mx:GridItem> tag can contain any number of children.
–
–
2. MOUSE EVENTS
A MouseEvent object is dispatched into the event flow whenever mouse events occur. A mouse event is usually generated by a user input device, such as a mouse or a trackball, that uses a pointer.
–
–
How my Program works ?
The idea of the program is to defend the user moves.
I have a row array and column array if the user enters in to first row the first element of row array is incremented indicating that a element has been inserted in the first row and the corresponding element in the col array is also incremented.like wise all elements are incremented withrespect to the place where the user enters.
–
–
First we check the row elements to have a element “2” which indicates that there are two user symbols in a row and then the computer symbol “C” is put in the respective place to defend user from winning.
Else we check for column element to have a element “1” and put the Computer’s symbol “C” in any of the vaccant place in the column.
I have a count to count the number of user moves which is checked at the result to find whether game is leveled.
Does it check only for the rows and columns? Not the diagonals?
hai mani its great to hear from you.
i checked only for rows and column because u cant
win by the diagonal.note that the computer starts its game by putting it symbol at the center