Release v3.0

This commit is contained in:
Koen Yskout
2018-04-17 13:54:17 +02:00
parent 295c510d73
commit d5cbb646ed
81 changed files with 5752 additions and 15 deletions

View File

@@ -0,0 +1,35 @@
// Worm that turns towards nearest worm, fires, and moves; or turns and tries to jump if no worm is in sight.
def updateNearestWorm: {
delta := 0;
nearestWorm := null;
turnToNearest := 0;
while delta < 6.28: {
obj := searchobj delta;
if (obj != null && isworm obj):
if !sameteam obj:
if (nearestWorm == null) || (distance obj < distance nearestWorm): {
nearestWorm := obj;
turnToNearest := delta;
}
delta := delta + 0.2;
}
}
// main program
while true: {
invoke updateNearestWorm;
if nearestWorm != null: {
print nearestWorm;
print distance nearestWorm;
turn turnToNearest;
fire;
move;
}
else {
turn 0.2;
jump;
}
}

View File

@@ -0,0 +1,20 @@
def controlled_move:
if getap self > 100.0:
{ jump;
print getx self;
print gety self; }
else move;
max_distance := 10.0;
while true: {
w := searchobj 0.0;
if isworm w: {
if sameteam w:
invoke controlled_move;
else if distance w < max_distance:
fire;
else
{ turn d;
max_distance := max_distance + 0.1; }
}
}

View File

@@ -0,0 +1,3 @@
turn 0.2;
fire;
move;

View File

@@ -0,0 +1,54 @@
// don't execute this :-)
def test_proc: {
x := +1;
while true:
print false;
if x == 1: {
print x * x;
} else: {}
invoke test_proc;
break;
if 0-x/y*z - y * z - 2*x + 3 == 2 && true != false: {}
move;
jump;
eat;
fire;
}
def secondProc: {
invoke test_proc;
if getx self > 0:
invoke secondProc;
}
x := ( 3 * 4 ); // comment
// comment
y := (-33.5 * (+55 / 1.22));
jump;
turn 5;
turn 0.2;
turn -0.2;
fire;
if (x >= 5):
{ }
else
fire;
while y:
{ turn (0.01);
y := (y - 1); }
while y:
{ move;
y := (y - 1);
if (true): { turn y; }
else {
while (false):
{print y;}
}
}
if (true): { } else { invoke test_proc; }