tic tac toe

I am making(attempting) a tic tac toe game.
I know this is just the basics, but can someone help me with the next step?
I really dont know where to start. Any Ideas would help. thanks!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <iostream>
#include <string>
using namespace std;
int newgameboard();

int main()
{

    newgameboard();

}

int newgameboard()
{

    char rows[3][3]={{' ',' ',' '},{' ',' ',' '},{' ',' ',' '}};
    cout << rows[0][0] << "|" << rows[0][1] << "|" << rows[0][2] << endl
         << "-----" << endl //middle row
         << rows[1][0] << "|" << rows[1][1] << "|" << rows[1][2] << endl
         << "-----" << endl //middle row
         << rows[2][0] << "|" << rows[2][1] << "|" << rows[2][2] << endl;
}
When your writing a program, Make a list of what you want it to do:

TIC TAC TOE

Draw game board

Get player input

Update board

Redraw board

etc...

You can go back over your list breaking everything down to even smaller steps.

This link will give you some info:

http://www.liutilities.com/how-to/make-a-computer-program/
if you want to program tic tac toe, there are 2 solutions:

you get the player input and then switch
this requires kind of a list or array, where your program can see what to do next
example: user inputs "X to 1|1"
then your program switches
switch(input)
{
case 11://reaction of your program
case 12://reaction of your program
//and so on: 13,21,22,23,31,32,33
}
this is the easy way

the difficult way(my solution) is that you make kind of an AI(artificial intelligence)
the AI thinks over how the program COULD react, and what the user COULD do then
then the AI decides what to do to have the highest chance to win
this is the VERY difficult way

practise makes perfect
i am not sure...
do you mean a tic tac toe game for two players or a game against your computer?
Topic archived. No new replies allowed.