TEN-LINE MINIMAL LUNAR LANDER

=============================

IDEA

----

The simulator objective is to land the spaceship on the word MOON.

The ship has two engines P and Q, in the left+up vector and in the vector

right+up. The engines allow to overcome the lunar gravity and move

left/right the ship.

Landing is valid if the speeds vertical and horizontal are close to zero.

IMPLEMENTATION

--------------

We use the physics of accelerated uniform motion where velocity and space are

v=v0+a*t

e=e0+v*t

We take t=1 obtaining the difference equations

v=v+a,x=x+v

w=w+b,y=y+w

If we activate motor,

b=1

a=1 or a=-1;

otherwise

gravity acts b=-2,a=0.

We transform the X,Y positions into screen coordinates i,j

multiplying by a sensitivity G and applying modulus on

the result to obtain an infinite space of movement.

i=mod(x*G,X)

j=mod(y*G,Y)

print i,j,"*"

Engine has 100 units of fuel.

Your only chance to win is not to play.

bye,zxpope(atgmailcom)

feedback wellcome comentarios bienvenidos http://retrowiki.es/viewtopic.php?f=57&t=200039142&p=200166739&hilit=basic#p2001...

 Status Released Author BASIC 10Liner Genre Action Tags 8-Bit, basic, basic10liner, sinclair, ZX Spectrum