Thread: Need help with Tic Tac Toe

  1. #16
    Registered User
    Join Date
    Jun 2002

    thats a lotta code...

    I d'loaded that TTT game posted previously and was overwhelmed to find 1900+lines of code. Holy frijoles!!

    Is that a 'typically' sized TTT game?

    In my imagination I was figuring about 4-500 lines would do it. However, I'm a noob, only about halfway thru the SAMS 21 day book.

    I goota say, that file has me a little scared, lol
    -Dev-C++ 5.beta somesuch
    --"Hello world!" (52%)

    "Stupidity - the number one sexually transmitted disease."

  2. #17
    Green Member Cshot's Avatar
    Join Date
    Jun 2002
    Yeah, 1900+ lines is really long for a TTT game.

    Here's a link if you want to get a brief intro on these search trees:

    You may want to do a search on depth first search. This will help you get started.

    Here's a couple of hints:
    Think about the symmetry of the game. Say for example, an opponent's first move is in the middle. You have 2 possibilities: a corner move or a side move. That way you won't have to search for all the possibilities since they're symmetric.

    And if a position you search shows that you win 100% of the time, you can stop searching for any other possibilities.

    Good luck

  3. #18
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    Mmm, here's an AI-free version in 150 lines

  4. #19
    Seeking motivation... endo's Avatar
    Join Date
    May 2002
    My MFC windowed version is only about 500 lines, 1900 lines is huge for tictactoe

  5. #20
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    I made TTT with Windows GDI, with very very limited *ai* (selects a random open spot )... it took 287 lines of code (minus a resource file). I made it in MSVC++, so maybe there's some behind-the-scenes stuff goin' on... anyways, you can take a look if you want.
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

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
    By holden in forum A Brief History of
    Replies: 8
    Last Post: 05-09-2004, 09:59 AM
  3. Help with Tic Tac Toe game
    By snef73 in forum C++ Programming
    Replies: 1
    Last Post: 04-25-2003, 08:33 AM
  4. tic tac toe game
    By Leeman_s in forum Game Programming
    Replies: 9
    Last Post: 04-24-2002, 03:24 AM
  5. my tic tac toe game, please try it
    By Leeman_s in forum C++ Programming
    Replies: 2
    Last Post: 04-14-2002, 05:16 PM