Need help with Tic Tac Toe

This is a discussion on Need help with Tic Tac Toe within the C++ Programming forums, part of the General Programming Boards category; I d'loaded that TTT game posted previously and was overwhelmed to find 1900+lines of code. Holy frijoles!! Is that a ...

  1. #16
    Registered User
    Join Date
    Jun 2002
    Posts
    14

    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
    Posts
    892
    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:
    http://sern.ucalgary.ca/courses/CPSC...Boyd/game.html

    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 wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,337
    Mmm, here's an AI-free version in 150 lines
    Attached Files Attached Files

  4. #19
    Seeking motivation... endo's Avatar
    Join Date
    May 2002
    Posts
    537
    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
    Posts
    2,879
    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.

    http://www.geocities.com/hunterguy_2/
    Just Google It. √

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

Page 2 of 2 FirstFirst 12
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 Cprogramming.com
    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

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