Skip to main content

Posts

Showing posts from July, 2012

Tic-Tac-Toe Game Design

Tic - Tac - Toe Game Design Algorithm: Take a 2 D Array of size 3X3 initialized to NULL value. Take position for input. Input should be alter automatically as input taken one by one. count number of X and O in the Array if any count of X or O is equal to 3 then go to step 5 check continuity of X or O row-wise, if found go to step 10  check continuity of X or O column-wise, if found go to step 10 check continuity of X or O in Diagonal or Counter Diagonal wise, if found go to step 10 if total input is less than 9 go to step 2 Conclude:: Totally messed up..... go to Step 11 Display the Owner..... The End Program Design (in JAVA): import java.io.*; class Game {     public static void main (String args[]) throws IOException     {         BufferedReader inp=new BufferedReader (new InputStreamReader (System.in));     int z=0;     int flag=0;     int xcount=0, ocount=0;     char game[][]=new char[3][3];     char ch;     int i,j;