# How to make generic AI?

In the future, I would like to have a function in my
game loop, that check’s for the next run through the
game loop, scrambles some numbers, and moves about the
screen either left/right or up or down for a certain
number of cycles through the game loop. counting the
cycles is important, so we can move right for 6
instances and down for 1 or 2. If anyone has a second
or two, do you have any quick thoughts on what might
be a good way to do this? It sounds good in psuedo code.__________________________________________________
Do You Yahoo!?
Send instant messages & get email alerts with Yahoo! Messenger.

instead of having sprites move in random erratic patterns,
you could try movement along curves…
a sine or cosine curve would be extremely easy to

NeilOn Wed, 17 May 2000, GEM Products wrote:

Date: Wed, 17 May 2000 13:41:41 -0700 (PDT)
To: sdl at lokigames.com
From: GEM Products
Subject: [SDL] How to make generic AI?

In the future, I would like to have a function in my
game loop, that check’s for the next run through the
game loop, scrambles some numbers, and moves about the
screen either left/right or up or down for a certain
number of cycles through the game loop. counting the
cycles is important, so we can move right for 6
instances and down for 1 or 2. If anyone has a second
or two, do you have any quick thoughts on what might
be a good way to do this? It sounds good in psuedo code.

Do You Yahoo!?
Send instant messages & get email alerts with Yahoo! Messenger.
http://im.yahoo.com/

Spruce: come fly the friendly internet

In article <200005172315.SAA00589 at mail.athenet.net>, Neil Brandon
wrote:

instead of having sprites move in random erratic patterns, you could try
movement along curves… a sine or cosine curve would be extremely easy

Neil

Any examples of this in SDL?

## Craig Maloney (@Craig_Maloney) http://ic.net/~craig In an orderly world, there’s always a place for the disorderly.

something like:

while (y >= 0 || y =< Screen_Height) {

``````int x_pos, y_pos;

for (x_pos = SomeValue; x_pos <= Screen_Width; x_pos++) {
y_pos = sin(x_pos);

dest.x = x_pos;
dest.y = y_pos;
dest.w = image_w;
dest.h = image_h;
SDL_BlitSurface(image, NULL, screen, &dest);
}
``````

}

don’t quote me on that… there are better ways to do it

NeilOn Wed, 17 May 2000, “csm” wrote:

Date: Wed, 17 May 2000 20:13:26 -0500
To: sdl at lokigames.com
From: “csm”
Subject: [SDL] Re: How to make generic AI?

In article <200005172315.SAA00589 at mail.athenet.net>, Neil Brandon
<@Neil_Brandon> wrote:

instead of having sprites move in random erratic patterns, you could try
movement along curves… a sine or cosine curve would be extremely easy