ACCELERATE
==============
float: #43 instructions
q x - dup
r y - dup 2 roll
dist 10 / 1 + #determine acceleration
15 min #limit acceleration
w' sto
arctan dup
w sin speedx' sto
w cos chs speedy' sto
chronon 3 + chronon' setparam
rti
===============
float: is actually the big brother of a simple float you might find
easier to swallow since it's smaller. It won't decelerate gracefully,
though.
===============
float:
q x - r y - arctan dup
8 sin speedx' sto
-8 cos speedy' sto
chronon 3 + chronon' setparam
rti
===============
Here's an example robot. He sometimes hits walls. To get rid of
that, just turn off NNE. However, the movement looks cooler with NNE on.
==========================================
#processor: 50
#NNE: On
float chronon' setint
10 chronon' setparam
newpath call
inton
main:
q x - r y - dist 15 < newpath if
main jump
newpath:
a 4 * newpath2 + jump
newpath2:
150 150 inca jump
12 12 inca jump
150 150 inca jump
12 288 inca jump
150 150 inca jump
288 288 inca jump
150 150 inca jump
288 12 inca jump
inca:
r' sto q' sto
a 1 + 8 mod a' sto return
{also try this robot after replacing the following code with the smaller
version of float from above}
float: #43 instructions
q x - dup
r y - dup 2 roll
{dupn would be cool here. I could replace the above with
q x - r y - 2 dupn}
dist 10 / 1 + #love that DIST operator!
15 min #limit acceleration
w' sto
arctan dup
w sin speedx' sto
w cos chs speedy' sto
chronon 3 + chronon' setparam
rti
=========================================
This routine is Not smart enough to check its own dist from the
target, so you must do that manually. Look at main: to see how.
Now, remember, if you want to use this, it is best used as a
secondary movement pattern. If you need to dodge an attack, or launch one
of your own, remember to use -1 chronon' setint or 9999 chronon' setparam
to switch this off first.
Bryant Brandon