Review your favorite Linux distribution.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 03-29-2004, 01:24 PM   #1
Registered: Dec 2003
Location: NC, US
Distribution: Novell Linux Eval (2.6.5)
Posts: 240

Rep: Reputation: 30
A.I. Programming, following by my previous thread aobut turning an airplane

ok, i got my little airplane turning and and shooting bullets and all that. Works great. Now it's time to program the a.i. plane.

What's the generic algorithm to programing the a.i. plane which includes:
1. when it turn its direction to user
2. when it shoots its bullets
3. when it speed up / slow down

i know it somehow has to relate back to the user plane with a certain amount of randomness in it. Can anyone with previous a.i. experience to tell a little more about what's to consider in programming a.i. object?
Old 03-29-2004, 03:26 PM   #2
Senior Member
Registered: Apr 2003
Location: Lancaster, England
Distribution: Debian Etch, OS X 10.4
Posts: 1,263

Rep: Reputation: 51
my ai experience is pretty limited but i would consider using a finite state machine. its a bit difficult to explain but ive looked for a simple article on the subject and cant find one so here goes:

lets take the example of a guy looking for gold in a maze, there are a few things he can do, he can
a) wonder randomly
b) go to a location he's already been to
c) wonder systematically(turn right continuously, etc)
d) etc...

these are the different states the ai can be in

a finite state machine is nothing more than a finite set of states (3 in this example) and some rules that dictate switching between them

so here are a simplistic set of rules

1 if see gold - get and goto exit
2 explore randomly

slightly better rules

1 if see gold - get and goto exit
2 if in new location - explore randomly
3 goto unexplored location

so basically you need to come up with some simple things your ai can do -

chase ship
run away

then come up with some rules to choose going from one state to another

if patrol and see ship then chase ship
if chase ship and ship bigger than you then run away

you could try looking at some of the ai articles on


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Next - Previous Page Buttons / Search this Thread Button JZL240I-U LQ Suggestions & Feedback 5 11-09-2005 07:40 AM
Thread programming Megasms Programming 2 11-05-2005 12:09 AM
POSIX Thread programming problem... rajsun Programming 0 10-07-2005 11:18 PM
POSIX thread Programming msriram_linux Programming 4 11-21-2004 03:14 PM
Thread Programming on KDevelop 1.4 Nguyen Hai Nam Programming 0 11-13-2001 02:41 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:46 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration