Results 1 to 19 of 19

Thread: AI Program v0.2 BETA Testing

  1. #1
    ChuckB
    Guest

    AI Program v0.2 BETA Testing

    Hi,

    I have just spent over 4 weeks writing an Artificial Intelligence Program in VB6.0. The program can be taught to play simple games. The games are not hard-coded like most games. You will act as a teacher and play games that you create.

    The games are grid based (3x3, 4x4 and 5x5). For example, you can select a 3x3 grid and teach the program to play tic-tac-toe. Try creating multiple pattern games for the 5x5. My wife taught it to play "L" shape patterns with four blocks. After four games the program began winning.

    The AI Engine is explained with lots of comments and the help files explain the theory. The program displays global variables realtime, shows the knowledge base as it is being manipulated and allows for the saving and retrieval of games.

    This program requires some OCX files for the MSFlexGrid, Status Bar and a Tab Strip. You can download these from my site if you do not have them but I suspect you will.

    The link is http://www.clg-net.com/ai/aip.htm The download file includes HTML help files, graphics and all source code. It is 180K in size due to graphics.

    Please download and test. I would like to get a lot of feedback regarding the AI Engine, suggestions for improvements , list of bugs, etc.

    Regards,
    ChuckB

  2. #2
    ChuckB
    Guest
    Hi,
    I appreciate all of the feedback I received thus far. Only 1 bug unrelated to AI has been reported. This bug occurs if you Exit the program while in the middle of game play. The result is you must use Task manager to free up the resources. In VB editor mode, you must press Control Pause. I will include the fix for this in a later update (v0.2b).

    I am building a program specification for v0.4. Let me list the highlights for these various versions. Please submit any and all ideas you may have.

    Version 0.2a (completed)
    ==================
    - Can be taught simple square grid games, 3x3,4x4,5x5
    - Plays Type I games. These games start out with no pieces on the board. Pieces are added one at a time as the computer/teacher alternates turns. Goal is to fill the gameboard until a winning pattern is achieved.
    - Game parameters and knowledge are saved in an ASCII text file using a scripting language.

    Version 0.3 (to be released)
    ====================
    - Plays Type I games using different bit pattern strategy. v0.2 uses Long Integers to store info about board. v0.3 will incorporate bit pattern strategy that will support larger grids that are not square up to say 15x15...12x7, etc...most likely arrays(1 dimensional)
    -Backwards compatiable with v0.2 game files (*.AIP).

    Version 0.4 (to be released)
    ====================
    -Plays Type II games. Game such as checkers in which the board can be checkerboarded, pieces placed on board at beginnng of game, pieces are captured by jumping, piece transform into more powerful pieces (kings), etc. Pattern matching is no longer the key to winning. The key is to capture all pieces or a particular piece.
    -Supports multiple game pieces (symbols)..2 for checkers, 6 for chess, etc.
    -Individual pieces are told how to move.
    -Increases scripting vocabular set to handle individual piece movements, game strategy, initial setup of gameboard, etc.
    -Backwards compatiable with v0.2 game files (*.AIP).

    That is the future plan as long as my wife permits me to program on rainy days. Please pray for rain. :-)

    Regards,
    ChuckB

  3. #3
    Zaei
    Guest
    I did actually get a chance to test AIP, but, because of my Virtual PC, it froze my system when I attempted to play a game. This is NOT the fault of the program itself, but seems to be common because I am using a Virtual PC. Many of my own programs behave the same, so I think that it is VBs fault =). I will try downloading it again on my main PC at some point, but I will be out of town for a few days, starting tomorrow.

    Sorry this took so long to get to you =). Ive had a lot of work to do =).

    Z.

  4. #4
    Frenzied Member /\/\isanThr0p's Avatar
    Join Date
    Jul 2000
    Location
    They can't stop us! We're on a misson from God.
    Posts
    1,181
    well I did take a look at the program and I really have to say that I am very impressed. I would have never believed you would succeed so fast!
    Sanity is a full time job

    Puh das war harter Stoff!

  5. #5
    ChuckB
    Guest
    Hi M,
    Thanks. The program presented some new challenges to me. I had never programmed a Tab Strip...once I figured out Z order then that was smooth.

    I had never done so much bit manipulation of long integers before. I found myself working backwards sometimes...especially when I was overdue for a break. You know, getting the least significant bit confused with the most significan bit.

    I wrote GetFactBasedMove function four different times because I kept confusing myself. My suggestion, is work it on paper one step at a time...write really clear notes to self...and then begin coding.

    Regarding time, I did stop taking naps and watching videos with the family...which freed up a lot of time. :-) Lots of coffee...

    Regards,
    ChuckB

  6. #6
    Frenzied Member /\/\isanThr0p's Avatar
    Join Date
    Jul 2000
    Location
    They can't stop us! We're on a misson from God.
    Posts
    1,181
    I have always dreamed about doing this:
    I wrote GetFactBasedMove function four different times because I kept confusing myself. My suggestion, is work it on paper one step at a time...write really clear notes to self...and then begin coding.
    but every time I started I started coding at some point... I think it is really hard to do everything on paper when you are not even sure about how to do some of the single parts...
    I really need to get some practice with that...
    Sanity is a full time job

    Puh das war harter Stoff!

  7. #7
    ChuckB
    Guest
    AIP v0.2a Bug.

    The program, when terminated improperly, does not release system resources. To correct this in the VB code, go to the frmMain_Terminate event and cut out the line of cut and paste it inside the frmMain_QueryUnload event.

    This works much better.

    Regards,
    ChuckB

  8. #8
    Addicted Member ChuckB's Avatar
    Join Date
    Jul 2002
    Location
    South Carolina, USA
    Posts
    157

    AIP v0.3 Information

    Hi,
    I have a nearly functioning v0.3. It is similar to v0.2 with these notable improvements:

    1) Increased its vocabulary significantly to accommodate learning chess.
    2) Grid sizes up to 15x15.
    3) Colorized cells (checkerboard or random)
    4) Colorized game pieces.
    5) Define grid cells that are playable and NOT playable.
    6) All steps above are configurable at run time by teacher.
    7) Handles bit manipulation (shifting left/right), logic operations such as AND, XOR, OR, etc.

    v0.3 is the next step v0.4...meaning it still cannot play checkers but the architecture of the software is just about ready.

    Hey, I have a standalone program that demonstrates nearly 10 functions I wrote to handle binary numbers that have up to 32000 bits each. I demonstrate 100 bit binary numbers. Available at this link:

    http://www.clg-net.com/ai Click on SLNumber.zip (SL stands for super long ;-) Incidently, I could use some help to get the ADD feature working correctly.
    Regards,
    ChuckB

  9. #9
    Addicted Member
    Join Date
    Jul 2002
    Location
    Toronto, ON Canada
    Posts
    153
    Can I get the code ???

  10. #10
    Addicted Member ChuckB's Avatar
    Join Date
    Jul 2002
    Location
    South Carolina, USA
    Posts
    157
    Hi,
    Use the above URL. It contains most of the AI related projects.
    Regards,
    ChuckB

  11. #11
    Fanatic Member sql_lall's Avatar
    Join Date
    Jul 2002
    Location
    Up Above (i.e. AUS)
    Posts
    571

    Talking Two things

    1) firstly, you have as a bug that the program eventually plays the same thing. However, this is not really a bug. Infact, it is just saying that the Computer is 'bored' with the game, it has become too simple, and is time it learnt a new, harder one. (Just like real humans). It is actually a good thing to see that it reaches a state of 'perfection', when it started with nothing. However, mabye you could program the computer to 'challenge' itself by making it's first move random.

    2) Does AIP use rotations?? As in, does it look at each of the four rotations each board has?? 'cos i was trying to do the same thing (didn't quite work), but i more than halved memory needed by saving all rotations as one board pattern, not 4 (or 2 or 1)
    sql_lall

  12. #12
    Addicted Member ChuckB's Avatar
    Join Date
    Jul 2002
    Location
    South Carolina, USA
    Posts
    157
    Hi,
    the 5x5 limit was a target that I though I could reach in a limited amount of time. I didn't want to write for my first AI program, for example, a program that could be taught to play great chess...as I am sure I would have lost interest.

    The next version does the rotations, flips and inversing. Hard to describe...but if you draw a letter 'L' with 4 blocks, you can represent that pattern 8 ways...and it can be moved anywhere on the board. I know the brain was good at this mental recognition of patters so that was one of the goals of the program.

    I have an almost complete next version which is 15x15, has the ability to be configured or customized as a checkerboard in which you can select spaced that cannot be played. Additionally, multiple symbols can be used to represent several pieces. The goal is for this version to be able to learn checkers and chess..with the exception of castling an 'en passant'. I don't want to hardcode the chess rules, so I need an abstract way to represent those moves...of course that will be a goal in even a later version.


    For the AI Engine I need to be able to process 225 bit binary numbers...quite large, but I wrote a dozen functions to handle that.

    I have been distracted by C++ and OpenGL for the past couple of months. Once the novely wears off ;-), I'll get back to the program.

    I have this lattest incomplete version if you or anyone is interested. I am really pleased with the customizable game board.

    Regards,
    ChuckB
    I learn Robotics, Electronics and Game Programming at http://www.gameinstitute.com

  13. #13
    Fanatic Member sql_lall's Avatar
    Join Date
    Jul 2002
    Location
    Up Above (i.e. AUS)
    Posts
    571

    Talking Just one thing...

    Ok, i just had to add one thing.
    If you do get to the chess/checkers thing, then the 'pattern recognition' thing that makes it learn faster (the thing that allows it to see a solution and guess at others) will not really work, 'cos say you had a back-rank mate, then moving this up one square will not result in mate
    Just a though, but it will probably work, cos it is a great program anyway
    sql_lall

  14. #14
    Addicted Member ChuckB's Avatar
    Join Date
    Jul 2002
    Location
    South Carolina, USA
    Posts
    157
    Hi sql_lall,
    You're right about the current algorithm not solving the chess/checker problem. What's required is another algorithm. Then the program will have to decide which algorithm to apply. It does get difficult.

    Thanks for the feedback.
    Regards,
    ChuckB
    I learn Robotics, Electronics and Game Programming at http://www.gameinstitute.com

  15. #15
    Addicted Member ChuckB's Avatar
    Join Date
    Jul 2002
    Location
    South Carolina, USA
    Posts
    157
    Hi,
    Just a note to all interested that I shifted from this AIP program to dig into C++ and OpenGL. Here is a link to my page with my first 3D game.

    My game page

    The top link is the most recent and includes an error log. The program works on WinME, Win98 with some problems on certain Win2K and WinXP platforms. If it runs...great! If an error occurs, please post/email me log.txt file. I need this for debugging.

    Thanks,
    ChuckB
    I learn Robotics, Electronics and Game Programming at http://www.gameinstitute.com

  16. #16
    Hyperactive Member
    Join Date
    Jan 2003
    Location
    The Netherlands
    Posts
    386
    My OS is windows XP so I get an error when double clicking on the program and I doubt that log.txt will help, because it doesn't show any error there.

  17. #17
    Addicted Member ChuckB's Avatar
    Join Date
    Jul 2002
    Location
    South Carolina, USA
    Posts
    157
    Hi,
    I had a problem with XP and a C++ program I wrote last winter. I noticed that XP seemed to be far less tolerant to programming sloppiness than the other versions such as Win2K, 98, ME, etc. I had to rewrite the way I was managing objects and freeing memory. Can't explain it well because I don't understand it myself.

    Regarding AIP, if you run it several times, I am curious if it faults out at the same place: i.e. opening, saving, playing, etc. I may have not captured an error but perhaps the log file indicates an action that may correspond to an object using memory. Just a guess.

    I have had this version run on XP locally...so I am not sure that it is definitely an XP compatiability thing.

    Thanks for the feedback.

    Regards,
    ChuckB
    I learn Robotics, Electronics and Game Programming at http://www.gameinstitute.com

  18. #18
    Addicted Member ChuckB's Avatar
    Join Date
    Jul 2002
    Location
    South Carolina, USA
    Posts
    157
    Hi,
    I have moved this AIP v0.2 zipped file to AIP v0_2 .

    Regards,
    ChuckB
    I learn Robotics, Electronics and Game Programming at http://www.gameinstitute.com

  19. #19
    Hyperactive Member
    Join Date
    Mar 2003
    Location
    Greece, Salonica
    Posts
    473
    Hello.
    Can you post your project here, because i cant find it on your website...

    Thanks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width