none
Artificial Intelligence. RRS feed

  • Question

  • Hello;

    I'm thinking of entering the world of AI, so I thought of starting googling it, and also asking here about it.

    So I want to use it in my programs.

    And I thought of starting with AI in my tic tac toe game, that I've made from a long time using cases.

    So any help? :)

    thanks in advance. 

    Thursday, December 19, 2013 2:05 PM

Answers

  • There are 3 methods for AI

    1) Make move base on past history

    2) Make move based on algorithm and probablility.  Can try every possible move.

    3) Make move on combination of 1 & 2

    The simpliest method is use 1.  You should keep a history of all previous games with each move and if the game one or loss.  AI should check if there was a winning game base on current postion and then make same move as previous game.  If there isn't  a winning game then randomly pick any available box.

    Remember the game board is multi-symmetrical and you can consider each symetrical layout the same.


    jdweng

    • Proposed as answer by Cor Ligthert Thursday, December 19, 2013 10:39 PM
    • Marked as answer by Titanium man11 Friday, December 20, 2013 6:03 PM
    Thursday, December 19, 2013 3:23 PM
  • Method 2 is just a recursive algorithm that starts a current position and tries each move until the game ends.  then count the number of different attempts and which ones win or lose.  So if you put an X into one square and then there are 20 ways to end the game and 5 of the ways your win and 15 of the ways you loose then the probablitly of wining to 5/20 = .25.  Then try putting an X in a different square and see probablity of winnning.

    Method 3 is just a quicker method of determing the next move where you have lots of combinations.  Tic-Tac-Toe is simple.  Where you have a situation where you have lots of combinations usually past history is quicker and more reliable than going through future combinations.  So where you have a history that matches current conditions you usually use history rather than future predication.  Some cases you may use a combination of 60% history and 40% future predication. 


    jdweng

    • Marked as answer by Titanium man11 Friday, December 20, 2013 6:03 PM
    Thursday, December 19, 2013 5:52 PM
  • I'm really talking in general terms and not necessarily about tic-tac-toe.  Any gaming system must have rules programmed  which include are valid moves and what determines a WIN. Tic-Tac-toe the Win code is probably simplier if you have 4 cases

                1) diagonal upper left to bottom right  - one case

                2) diagnol upper right to lower left  - one case

                3) vertical row   - 3 cases which can be a for loop

                4) horizontal row. - 3 cases which can be a for loop

    The are 8 differrent wining postions

    With an AI gamming system has multiple moves that a user can make.  The move you make can be either a random move or a move that gives you the best probability of winning.  I was talking about the 2nd type which gives you the best chance of winning.  Probability of winning can be a combination of past history and future out come.

    If you go to a casino and gamble when do you leave?  When you run out of money, When you are wininng, When your are loosing, or when you are too tired to stay awake. When you run out of money is based on past history.  The other 3 are based on current conditions.  When you are winning or loosing you are considering future conditions like I'm going to start loosing or I'm going to start winning.  So based on future consideration you are going to determine if you arre going to stay or if you are going to leave.   These decisions are all based on probablities.  You are not making random decisions.

    When you are writing an AI system to play Tic-Tac-Toe the decision making is very similar to gambling in the fact that you are trying to predict the future.  Instead of deciding to stop gambling or continue you are trying to determine the next move to make on the Tic-Tac-Toe board. 


    jdweng

    • Marked as answer by Titanium man11 Friday, December 20, 2013 6:03 PM
    Thursday, December 19, 2013 7:10 PM

All replies

  • There are 3 methods for AI

    1) Make move base on past history

    2) Make move based on algorithm and probablility.  Can try every possible move.

    3) Make move on combination of 1 & 2

    The simpliest method is use 1.  You should keep a history of all previous games with each move and if the game one or loss.  AI should check if there was a winning game base on current postion and then make same move as previous game.  If there isn't  a winning game then randomly pick any available box.

    Remember the game board is multi-symmetrical and you can consider each symetrical layout the same.


    jdweng

    • Proposed as answer by Cor Ligthert Thursday, December 19, 2013 10:39 PM
    • Marked as answer by Titanium man11 Friday, December 20, 2013 6:03 PM
    Thursday, December 19, 2013 3:23 PM
  • Can you explain methods 2 and 3 also?
    Thursday, December 19, 2013 4:45 PM
  • Method 2 is just a recursive algorithm that starts a current position and tries each move until the game ends.  then count the number of different attempts and which ones win or lose.  So if you put an X into one square and then there are 20 ways to end the game and 5 of the ways your win and 15 of the ways you loose then the probablitly of wining to 5/20 = .25.  Then try putting an X in a different square and see probablity of winnning.

    Method 3 is just a quicker method of determing the next move where you have lots of combinations.  Tic-Tac-Toe is simple.  Where you have a situation where you have lots of combinations usually past history is quicker and more reliable than going through future combinations.  So where you have a history that matches current conditions you usually use history rather than future predication.  Some cases you may use a combination of 60% history and 40% future predication. 


    jdweng

    • Marked as answer by Titanium man11 Friday, December 20, 2013 6:03 PM
    Thursday, December 19, 2013 5:52 PM
  • Hello Joel;

    For method 2 I understood it a little, while for the 3, I didn't at all.

    And one more thing;when you said possibilities for winning and loosing, how my program should know how to win or loose, is it an If Case? Or what?

    Thursday, December 19, 2013 6:34 PM
  • I'm really talking in general terms and not necessarily about tic-tac-toe.  Any gaming system must have rules programmed  which include are valid moves and what determines a WIN. Tic-Tac-toe the Win code is probably simplier if you have 4 cases

                1) diagonal upper left to bottom right  - one case

                2) diagnol upper right to lower left  - one case

                3) vertical row   - 3 cases which can be a for loop

                4) horizontal row. - 3 cases which can be a for loop

    The are 8 differrent wining postions

    With an AI gamming system has multiple moves that a user can make.  The move you make can be either a random move or a move that gives you the best probability of winning.  I was talking about the 2nd type which gives you the best chance of winning.  Probability of winning can be a combination of past history and future out come.

    If you go to a casino and gamble when do you leave?  When you run out of money, When you are wininng, When your are loosing, or when you are too tired to stay awake. When you run out of money is based on past history.  The other 3 are based on current conditions.  When you are winning or loosing you are considering future conditions like I'm going to start loosing or I'm going to start winning.  So based on future consideration you are going to determine if you arre going to stay or if you are going to leave.   These decisions are all based on probablities.  You are not making random decisions.

    When you are writing an AI system to play Tic-Tac-Toe the decision making is very similar to gambling in the fact that you are trying to predict the future.  Instead of deciding to stop gambling or continue you are trying to determine the next move to make on the Tic-Tac-Toe board. 


    jdweng

    • Marked as answer by Titanium man11 Friday, December 20, 2013 6:03 PM
    Thursday, December 19, 2013 7:10 PM
  • When you where born you had instinct, you knew how to get food from a tit. The rest you had to learn.

    The same is with AI. I've not much to add which helps you further on the message from Joel

     


    Success
    Cor

    Thursday, December 19, 2013 10:39 PM
  • Hello;

    I'm thinking of entering the world of AI, so I thought of starting googling it, and also asking here about it.

    So I want to use it in my programs.

    And I thought of starting with AI in my tic tac toe game, that I've made from a long time using cases.

    So any help? :)

    thanks in advance. 

    I would suggest you use a search engine to learn as much about programming using AI with Visual Basic as you can. As well as any Tic Tac Toe games written in Visual Basic that pit a user against the computer. And once you've done all that for a week or two then come back with questions relevant to code.

    It seems to me you have not bothered to do any homework on any of this ahead of time as Cor Ligthert tends to imply IMO in his post.

    As this links suggests How to Use this Forum & FAQ (Read Before Making Your First Thread) I see no research having been performed prior to asking a question in a forum for questions about issues with Visual Basic code. Nor do I see a question regarding an issue with Visual Basic code. Which seems to be the case more and more lately.

    "Be precise and informative about your problem

    • Describe the symptoms of your problem or bug carefully and clearly.
    • Describe the environment in which it occurs (machine, OS, application, whatever).
    • Describe the research you did to try and understand the problem before you asked the question.
    • Describe the diagnostic steps you took to try and pin down the problem yourself before you asked the question.
    • Describe any recent changes in your computer or software configuration that might be relevant."

    I would think you would be asking question like this on an approriate forum like one from this search for Artificial Intelligence forums and then come back here when you have an issue with the code you've written.


    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.

    Friday, December 20, 2013 5:32 AM
  • Hey, Mr.  Monkeyboy, if you read what I've said, you would have understood that I'm new, so I started searching, and one of them is this forum that I wanted to have some extra information from. So you can't blame me

    Friday, December 20, 2013 2:02 PM