Thread: tic tac toe (arggg, I really need help!)

  1. #1
    Unregistered Leeman_s's Avatar
    Join Date
    Oct 2001
    Posts
    753

    tic tac toe (arggg, I really need help!)

    Ok, im trying to just write a simple program to make a tic tac toe game. Ok, I think i need to use arrays and the like. I'm totally confused on how to start, all i have is a big mess. Here is what I have so far, and there are tons of errors:

    #include <iostream.h>
    #include <conio.h>
    #include <windows.h>
    #include <stdlib.h>
    #include <stdio.h>
    #include <math.h>
    #include <iomanip.h>
    #include <string>
    #include <fstream.h>

    int main() //Line 10
    {
    char marker[10];
    int array[3][3];
    int array1[10];
    int move1[10];
    int move2[10];

    cout<<"1 2 3"<<endl;
    cout<<"4 5 6"<<endl;
    cout<<"7 8 9"<<endl;

    int *ptr1;
    int *ptr2;

    int x=1;
    do
    {
    ptr1=move1[x];
    ptr2=move2[x];
    cout<<"Where do you want to move? "; //Line 20
    cin>>move[x];
    cin>>move2[x];
    array[ptr1][ptr2]=marker[x];
    x=x+1;
    }while(x<10);
    }
    return 0;
    }


    Alright, will someone please tell me if im even close to the right kind of idea? Also, since i know im wrong, how would i go about doing a tic tac toe game? ANY HELP WILL HELP ME!!!

  2. #2
    Registered User
    Join Date
    Aug 2001
    Posts
    155
    array[3][3] is correct for the board. I would have user input both the x and y coordinates as in battleship although you can convert the numbers 1-9 to appropriate x and y coordinates if you really want to. Fill the array with 9 asterisks or some other symbol to start with. They will indicate open moves. Assign user one to use a second symbol and user two to use a third symbol as markers. display empty board. Ask user one to select their move by x and y ( or 1-9 if you insist). Assign appropriate symbol to that location on the board. check for winning solution. if game won so indicate. display board. ask user two to enter move by entering appropriate x and y. check validity of choice. if valid assign appropriate symbol for winning solution. if so so indicate. otherwise repeat loop until nine choices made and no solution at which time declare draw.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help me with my simple Tic tac toe prog
    By maybnxtseasn in forum C Programming
    Replies: 2
    Last Post: 04-04-2009, 06:25 PM
  2. tic tac toe crashes :(
    By stien in forum Game Programming
    Replies: 4
    Last Post: 05-13-2007, 06:25 PM
  3. tic tac toe
    By holden in forum A Brief History of Cprogramming.com
    Replies: 8
    Last Post: 05-09-2004, 09:59 AM
  4. Help with Tic Tac Toe game
    By snef73 in forum C++ Programming
    Replies: 1
    Last Post: 04-25-2003, 08:33 AM
  5. tic tac toe (arggg, I really need help!)
    By Leeman_s in forum Game Programming
    Replies: 3
    Last Post: 10-14-2001, 04:03 PM