Cant get my TICTACTOE to work

This is a discussion on Cant get my TICTACTOE to work within the Game Programming forums, part of the General Programming Boards category; So I ask you to look my lille newbie code through to find my scope bugs or whatever is the ...

  1. #1
    Registered User
    Join Date
    Jan 2006
    Location
    Denmark
    Posts
    16

    Unhappy Cant get my TICTACTOE to work

    So I ask you to look my lille newbie code through to find my scope bugs or whatever is the problem! because Iam having a hard time to find it myself with the little knowlegde og scopes and local and globel variables...


    The problem is when you choose a number where to place your brick (1-9) then it aint saving it in the array gTable or at least it is not printing the X or O which I ask for in the gPrint method


    http://pastebin.com/530074 tictactoe.cpp
    http://pastebin.com/530076 main.h (tictactoes header file)
    http://pastebin.com/530079 gameon.h
    http://pastebin.com/530080 gameon.cpp
    http://pastebin.com/530084 options.h
    http://pastebin.com/530085 options.cpp

  2. #2
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,475
    If you are doing a simple tic - tac - toe game, you dont need so many files to make it work. If you can, place the whole program into one source file and post the entire code. Then we could be able to see your problem.

    To be honest, you only need losts of files if you are creating a very large application like a big game for example. Even then, the majority of the files are classes and text files for
    fstream.h

  3. #3
    Registered User
    Join Date
    Jan 2006
    Location
    Denmark
    Posts
    16
    yes but I want to seperate it so that it easier to view! But I know its not very structured atm but please try to do so! else my code wont work.. I think at lesat

  4. #4
    Registered User
    Join Date
    Jan 2005
    Posts
    106
    A) Splitting source into multiple files is a good idea. Nice that he's starting early.

    B) Headers and their related .cpp should have the same name.

    C) Don't have a header that just contains other headers. That's silly.

    D) Shouldn't the class definition be OUTSIDE of the #endif preprocess thinger?

  5. #5
    GA ichijoji's Avatar
    Join Date
    Nov 2002
    Posts
    179
    Quote Originally Posted by suzakugaiden
    Shouldn't the class definition be OUTSIDE of the #endif preprocess thinger?
    Why would you want to risk getting redefine errors on the class definition?
    Illusion and reality become impartiality and confidence.

  6. #6
    Registered User
    Join Date
    Jan 2006
    Location
    Denmark
    Posts
    16
    ok I merged the tictactoe.cpp and the main.h file into just the tictactoe.cpp only so that main.h have been deleted!

  7. #7
    Me pwn you.
    Join Date
    Feb 2006
    Location
    At my computer or in my bed.
    Posts
    46
    Now That that's done, show some code so we can help! You said something about
    an array not storing numbers, let's get to that...

  8. #8
    Registered User
    Join Date
    Jan 2006
    Location
    Denmark
    Posts
    16
    Quote Originally Posted by Dagger
    Now That that's done, show some code so we can help! You said something about
    an array not storing numbers, let's get to that...
    http://pastebin.com/535090

    only thing i did was deleting main.h and putting the important info into the tictactoe.cpp nothing else.. but I dont know much about global variables.. so if anyone can check if any of my instances are redefinded?

  9. #9
    Registered User
    Join Date
    Jan 2006
    Location
    Denmark
    Posts
    16
    I found my error today Yipiii so end of problem

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Why don't the tutorials on this site work on my computer?
    By jsrig88 in forum C++ Programming
    Replies: 3
    Last Post: 05-15-2006, 10:39 PM
  2. Problems in getting OpenGL to work
    By zonf in forum C Programming
    Replies: 5
    Last Post: 02-13-2006, 03:48 AM
  3. help getting program to work
    By jlmac2001 in forum C Programming
    Replies: 2
    Last Post: 11-13-2002, 10:04 PM
  4. fopen();
    By GanglyLamb in forum C Programming
    Replies: 8
    Last Post: 11-03-2002, 11:39 AM
  5. DLL __cdecl doesnt seem to work?
    By Xei in forum C++ Programming
    Replies: 6
    Last Post: 08-21-2002, 04:36 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21