moth/lib/tanks/hard/crashmaster

56 lines
1.3 KiB
Plaintext

Name: crashmaster
Author: Neale
Sensor: 50 0 8 1
Sensor: 30 0 50 0
Sensor: 50 0 10 0
Sensor: 100 315 100 1
Sensor: 100 45 100 1
Sensor: 60 180 180 0
( Mem 0: Turn number )
0 fetch
1 +
0 store
( Mem 1: Move turret (procedure) )
{
getturret
-
setturret
} 1 store
0 fetch 30 % 10 / ( [0..2], changes every 10 turns )
dup 0 = { 80 80 move } if
dup 1 = { 60 80 move } if
dup 2 = { 80 60 move } if
pop
0 setturret
fireready
{
( Behavior for when we can shoot )
0 sensoractive { fire } if
1 sensoractive { 10 10 move 0 setturret } if
2 sensoractive { 10 10 move 0 setturret } if
3 sensoractive { 0 60 move -50 1 call } if
4 sensoractive { 60 0 move 50 1 call } if
3 sensoractive 4 sensoractive & { 100 100 move getturret setturret } if
5 sensoractive { 100 40 move } if
}
{
( Behavior for when we can't shoot )
setled
0 sensoractive { 10 20 move } if
1 sensoractive { 10 10 move } if
2 sensoractive { 10 20 move } if
3 sensoractive { 70 50 move } if
4 sensoractive { 50 70 move } if
3 sensoractive 4 sensoractive & { -100 20 move } if
5 sensoractive { 100 50 move } if
}
ifelse