Would you like to do your very own AI project ??
But you are discouraged by the enormity of such tasks as programming a computer mind (whatever that means), understanding natural language, or learning.
What you need to a small, but challenging project to get you started !!
I think that games are a good place to start. They have a well defined set of rules and it is easy to see how well your project is going by simply looking at how well it is playing the game. You can choose from a huge range of games. You can program the AI for computer games. You can go for the classical board games like chess, checkers, backgammon, or card games like bridge or canasta, or even solotaire card games like FreeCell. For my simple AI project I am going to use FreeCell, but any game of your choosing would do.
So, where do you start. Well first find some card bitmaps - unless you particularly want to produce those yourself - I have a set of bitmaps so contact me if you can't find any. Then write the code to shuffle a pack of cards and deal the FreeCell layout. Now you will need to work out what moves are legal. It is handy to allow the user to input moves - this makes debugging easier and will give a program which does much the same as Microsoft's FreeCell. Now comes the interesting bit. What are you going to do to make the program intelligent ??
A number of possibilities come to mind:
There are without doubt many more possibilities, but these will do for now. Let's look at some of them in more detail.
Well, this should be easy enough. You do know how you play FreeCell don't you ??
Actually, coding up your own knowledge of even a simple game turns out to be quite difficult. But we can do it !! I find that it is easiest to express my knowledge in concise, explicit English - normally as rules. Then I code it up in whatever language I am using. First wrote a rule to describe which cards can be moved to the foundations. (This is the bit which Microsoft FreeCell does for you automatically. You could just code it up the way that M$ FreeCell does it, but if you think about it you will find that this can be improved.)
Now what ?? I know that when I play I try to see if there is a way to clear a column without using up more than 2 freecells. If I can't do this then I try to just use just 3 freecells. If I can't do that either then I just sorta shuffle the cards around a bit to see if I can make things look more hopeful. Try to express these ideas in concise, explicit English then code them up. Don't worry about getting it wrong. For me the best way is to code up a rule then see how well it works in the game, then I refine/improve the rule. To work out what rule to code up next see where the program gets stuck, work out what you would do, try to generalise what you would do, then code it up and try it out.
I use Prolog for writing my AI software because it is good for prototyping and for writing rule based systems. I use WinProlog from LPA. If you want a free Prolog then I would recommend SWI.
If I need my programs to run fast then a functional programming language like Haskell or Caml (O'Caml if you want objects) is my preference.
Last updated 30 July, 2002