### Re: Graphics Problem

```On Mon, 10 Mar 1997 13:23:35 +0000 ROGER <rwd2 at COVENTRY.AC.UK> writes:
>---------------------- Information from the mail header
> I have coded the shape to move a certain number of pixels each
>turn in a loop.  But the speed is dictated by how fast the computer
>can run the instructions, is there any other way to determine (to set),
>the speed at which the a shape moves, because at the moment the speed
the
>shape is moving at is machine depandant.
>Now for the question, is there anyway to code it so that the shape
>moves at a set speed, and is does not change speed, (to much), on
different
>range of systems.

>               Roger

You have to create a loop to go Either a specific distance and
time how long it took OR.
You have to create a loop that goes for a specific amount of time
and count how far it got.

PRO's & CON's

In the first case the distance might not be large enough on really fast
machines to effectively time the distance.
Also the distance might seem to take an eternity on really slow machines.

With the second case you have to put the counter inside the timed loop.
This counter slows down the loop. This means that when you go to
using this loop without the counter inside that it may run faster than
you
anticipated.

Either case.  After you have timed them.  The equation should be
something
like:  count / seconds = count per second OR seconds / count = seconds
per count.
Simple enough?

After you have the counts per second you would pass these values to a
procedure

These functions use the secon method.

function cnts_per_sec()
atom t, cnt
--running this function should take less than a second.
--It should also be relatively accurate.
t = time()
while t = time() do
end while-- I used this loop to initialize the timer.  NOTE: I don't
trust timers much.

t = time()
while t = time() do
cnt = cnt + 1
end while
return cnt / time
end function

procedure my_delay(atom dly)
for A = 1 to dly
dly = A-- This is used for slowing the loop down.
end for
end procedure

atom  one_sec

one_sec = cnts_per_sec()
my_delay(one_sec)
puts(1, "one second\n")
my_delay(5 * one_sec)
puts(1, "five seconds\n")

You can create variations that may be even more accurate.
```