Thread: creating an AI engine for a simple game

  1. #1
    Registered User
    Join Date
    Apr 2007
    india->tamil nadu

    Exclamation creating an AI engine for a simple game

    hya friends,
    i have created a number based game called 'numfun'. it is a very
    simple game of course. firstly ther is a buffer array 4x4(level 1).

    1 2 3 4
    5 6 7 8
    9 10 11 12
    13 14 15 *

    the 16th square is blank represented by a *. i use another array 4x4,
    in which all the numbers have jumbled positions say

    1 4 8 6
    7 3 10 14
    * 11 9 2
    12 5 13 15

    the user has to move numbers into the empty '*' location and finally
    approach the positions of buffer array.

    the game works perfectly fine, but the thing is i am trying to upgrade it with an AI engine. i have few idea for construction of the AI
    engine and i need some help.

    thanks in advance..
    "Quotes don't make a man great- deeds do..."

  2. #2
    Registered User
    Join Date
    Jan 2009


    You can use something like this one.
    states are game states. llike the grid you want to solve
    operations look like state operation(state ) and are for example "rook goes to e,3" ...
    data structures {
        states already solved
        states to be solved
    code {
      add first state to to be solved  // EDIT: the one you want to solve
      until to be solved != empty
            pop first
                    apply each operation // get new state
                           if solution // you have to know how to recognize solution
                               done and done ;)    
                           if not in already solved
                                    add to already solved
                                    add to to be solved
    Also make it little dumb and slow. Supersmart AI is frustrating & boring.
    Last edited by hribek; 01-26-2009 at 01:21 PM. Reason: forgot about something

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Looking for coder: Simple C++ Client / Server game
    By kocho in forum Projects and Job Recruitment
    Replies: 1
    Last Post: 02-04-2006, 02:34 PM
  2. Game Engine Link Prob
    By swgh in forum Game Programming
    Replies: 2
    Last Post: 01-26-2006, 12:14 AM
  3. Simple driving game
    By VirtualAce in forum Game Programming
    Replies: 6
    Last Post: 07-06-2004, 09:34 AM
  4. Help with a simple game
    By jjj93421 in forum Game Programming
    Replies: 1
    Last Post: 03-28-2004, 03:52 PM
  5. Resource ICONs
    By gbaker in forum Windows Programming
    Replies: 4
    Last Post: 12-15-2003, 07:18 AM