• entries
    707
  • comments
    1173
  • views
    434030

My first attempt at AI

Sign in to follow this  
Programmer16

585 views

Wow, I went to PlanetSourceCode.com and found some of my old code, including my first attempt at AI. It was done two years ago, so I don't think its so bad (especially since I've never read any articles or actually tried to learn AI.)

Here's a link (7/13/05 doesn't work)

I just want to point out that this is old code and uses coding techniques and naming conventions that I DO NOT. I have greatly improved both since I uploaded this code to PSC (2/16/2003).

Any comments other than about the coding and naming, please go ahead and post them.
Sign in to follow this  


6 Comments


Recommended Comments

haha, PlanetSourceCode was halarious. I used it for everything about four years ago. When I decided to finish up with Visual Basic and move onto C++, I put up some of my stuff: for shame!

Share this comment


Link to comment
I think you're missing the point of a state machine. You use them so you don't have that use hugely ugly case statement. You pretty much have a base class named State (or something like that) and have all states that you plan on having derived from this base state class. Therefore when you do an update all you do is call CurrentState->SomeFunction and it manages calling the correct function for you instead of having to do something like:
switch(*Dtrmnr)	

{
case Hungry:
{
....

Share this comment


Link to comment
Yeah, this was when I was just starting though. I've got a class based state machine that I use now (maybe I'll update the code using my new state machine. Maybe add a few states... hmm gives me something to do.)

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now