tic-tac-toe

This is a discussion on tic-tac-toe within the Game Programming forums, part of the General Programming Boards category; Try it out...I think the AI is unbeatable, but let me know if you're able to beat it Source included. ...

  1. #1
    Registered User abrege's Avatar
    Join Date
    Nov 2002
    Posts
    369

    tic-tac-toe

    Try it out...I think the AI is unbeatable, but let me know if you're able to beat it Source included. (this version is a lot better than the one i released a long time ago)
    I am against the teaching of evolution in schools. I am also against widespread
    literacy and the refrigeration of food.

  2. #2
    Registered User abrege's Avatar
    Join Date
    Nov 2002
    Posts
    369
    doh
    Attached Files Attached Files
    I am against the teaching of evolution in schools. I am also against widespread
    literacy and the refrigeration of food.

  3. #3
    _ Munkey01's Avatar
    Join Date
    Dec 2002
    Posts
    280
    One problem, after you win or lose the first time you start back off with the same board.

  4. #4
    Registered User abrege's Avatar
    Join Date
    Nov 2002
    Posts
    369
    lol...funny i didn't notice that >< thanks!
    I am against the teaching of evolution in schools. I am also against widespread
    literacy and the refrigeration of food.

  5. #5
    Senior Member joshdick's Avatar
    Join Date
    Nov 2002
    Location
    Phildelphia, PA
    Posts
    1,146
    Yeah, you need to re-initialize the board, because, as it stands now, your program can only be used once.

    Otherwise, very good job.
    FAQ

    "The computer programmer is a creator of universes for which he alone is responsible. Universes of virtually unlimited complexity can be created in the form of computer programs." -- Joseph Weizenbaum.

    "If you cannot grok the overall structure of a program while taking a shower, you are not ready to code it." -- Richard Pattis.

  6. #6
    Registered User Caze's Avatar
    Join Date
    Nov 2002
    Posts
    18
    I won the AI with the first try.

  7. #7
    _ Munkey01's Avatar
    Join Date
    Dec 2002
    Posts
    280
    Why do they call it AI when all it does is run on a basic set of rules?

  8. #8
    Registered User abrege's Avatar
    Join Date
    Nov 2002
    Posts
    369
    Originally posted by Caze
    I won the AI with the first try.
    Gah, seriously? How did you do it?
    I am against the teaching of evolution in schools. I am also against widespread
    literacy and the refrigeration of food.

  9. #9
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    Looks pretty good. Also you may want to implement different difficulty settings as well. You can dumb down the checks or something on lower difficulty settings. Or something like..

    Easy - Just randomly moves
    Medium - It will attempt to block you before it checks if it can win.
    Hard - It will check to see if it can win before it checks if it can block.
    "...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

  10. #10
    Registered User abrege's Avatar
    Join Date
    Nov 2002
    Posts
    369
    Ah, I was thinking about that before. I'll try to implement difficulty settings, as well as a 2 player mode!
    I am against the teaching of evolution in schools. I am also against widespread
    literacy and the refrigeration of food.

  11. #11
    Senior Member joshdick's Avatar
    Join Date
    Nov 2002
    Location
    Phildelphia, PA
    Posts
    1,146
    Originally posted by Munkey01
    Why do they call it AI when all it does is run on a basic set of rules?
    Don't humans run on some pretty basic rules? We gotta eat, sleep, go to the bathroom, reproduce, etc. We usually either have to go to school or go to work. We have objectives and goals we wish to meet and in order to do so, we follow certain rules.

    Anyway, on a less etheral level, the AI for this game is really good. I think it's alright to call it artificial intelligence if it's just as good at playing tic-tac-toe as genuine intelligence.
    FAQ

    "The computer programmer is a creator of universes for which he alone is responsible. Universes of virtually unlimited complexity can be created in the form of computer programs." -- Joseph Weizenbaum.

    "If you cannot grok the overall structure of a program while taking a shower, you are not ready to code it." -- Richard Pattis.

  12. #12
    _ Munkey01's Avatar
    Join Date
    Dec 2002
    Posts
    280
    think it's alright to call it artificial intelligence if it's just as good at playing tic-tac-toe as genuine intelligence.
    Yea, it kicks my butt each time . But to my question, we have a basic set of rules which we must use in which to survive. But we can create our own rules and act upon them. I mean this game has very simple 'AI' since it is such a simple game.

  13. #13
    Senior Member joshdick's Avatar
    Join Date
    Nov 2002
    Location
    Phildelphia, PA
    Posts
    1,146
    Originally posted by Munkey01
    But to my question, we have a basic set of rules which we must use in which to survive. But we can create our own rules and act upon them. I mean this game has very simple 'AI' since it is such a simple game.
    Yeah, well really serious AI is supposed to get closer and closer to the way humans think. According to a side note in my textbook, here are the main principles of AI:
    • Search
    • Rules
    • Reasoning
    • Planning
    • Pattern Recognition
    • Knowledge Bases

    The reason humans create new rules is in order to achieve a goal. An AI should be able to achieve a goal by searching through all possible solutions and planning what must be done. During this thinking process, an AI should take into account rules it has been taught, and patterns it has recognized as well as conclusions it has reached from the facts and rules it has been provided.

    Of course, AI can't have free will like humans. This isn't a flaw in AI's design; it's a safeguard. Who knows what computers would do if they had free will? That's why programs must be given certain rules they should follow.

    This reminds me of a sci-fi book I once read, The Positronic Man. That was about a robot who became very human as the novel progressed. Anyway, in that fictional world, all robots were programmed with these three basic rules to be followed in this order:
    [list=1][*]Do not kill humans or allow them to die.[*]Follow humans' orders.[*]Try to preserve yourself.[/list=1]
    Given those simple rules in that order, a robot could be ordered to dismantle itself, but not to kill another human. I don't know about you, but I wouldn't want to be near an AI that would be allowed to do all of the crazy crap humans do.
    FAQ

    "The computer programmer is a creator of universes for which he alone is responsible. Universes of virtually unlimited complexity can be created in the form of computer programs." -- Joseph Weizenbaum.

    "If you cannot grok the overall structure of a program while taking a shower, you are not ready to code it." -- Richard Pattis.

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

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