Original Post
I am very new at programming, and am programming in C, and am quite confused by all of this AI stuff. Firstly, i would love for someone to explain about all these pathfinding modes. Are they all just like theories, that you have to make yourself on the same basic principles, like A* there is no actual program or A* code, but its an idea that you use for pathfinding. I have been making a turn-based game, on a grid, and am in the middle of working on pathfinding on it. One problem that is worrying me is that everytime i play the same level the computer will take the same path everytime. From as far as ive worked out, this can be fixed by fuzzy logic or something but ive absolutely no idea of how to do this. I was going to post the source code up on my website and link to it, but im afraid that it would be too confusing for even the most understanding programmer to sort through. Also, there have been many bugs in the code that ive been doing tests to check for, and the extra, seemingly pointless code, would just add to the confusion. But basically my pathfinding code goes like this:
choose a direction towards the player
check if its clear
if so, move there and update
if not, look clockwise to a square thats empty
if that square is empty move there
check if ive reached the goal
if not start again
if so walk the first part of the path (this will change to move 2 or more squares once i get it working
there is a bug in the code that i just cant sort out, if anyone wants to have a look at the code ask and ill post it up and link to it, but be warned that it wont be pretty!