HI,

Today im tying to build a game program,im not really stuck on the coding aspect but its the concept of the 2 players in the game that is confusing me.

For a starters, the game has 2 players.Player one goes first,after their go its player twos turn and so on until the game has been won(x's and o's).

Im having trouble on how to model the game so that the players turns are sequenced and on that players turn,their input is either an X or an O.

Im designing it using OOP so im going to create 2 instances of a class,i just can figure out how each instance will have a seperate input.

Can anyone point me in the right direction?

many thanks.

Could you describe it a bit more? like what kind of game it is and, importantly, what methods etc the classes have?
If there is any input method, you could always declare two instances, p1 and p2, and first get input for p1 like:

p1.getInput()

Then when player 1 is done, do the same for player 2 ;p

Could you describe it a bit more? like what kind of game it is and, importantly, what methods etc the classes have?
If there is any input method, you could always declare two instances, p1 and p2, and first get input for p1 like:

p1.getInput()

Then when player 1 is done, do the same for player 2 ;p

Hi,its a tic tac toe game.I've yet to make a class file as i want to get this down first.This is how my input will shape the game

// assigns X or O to array depending on col & row chosen.
        // row 1,col 1-3
        if(col==1 && row==1)
        {
            a[0] = 'X';
        }
        else if(col==2 && row==1)
        {
            a[1] = 'X';
        }
        else if(col==3 && row==1)
        {
            a[2] = 'X';
        }

However,instead of 'X' being all of the time,id like for it to be either an X or O depending on whos go it is.

Also,the user choses the grid location by entering a row and column number,not by entering an X or O.For example

Enter Col & row

i choose col1 row1, and X will appear there.

This article has been dead for over six months. Start a new discussion instead.