ref: f0c1d251cbf8bc1213c192fc3afcc0fe566bafb5
parent: bc5ac3d46558512971ba8c0f6be02382d91d17f1
author: rodri <rgl@antares-labs.eu>
date: Sat Oct 7 03:34:14 EDT 2023
remove debug prints.
--- a/andy.c
+++ b/andy.c
@@ -43,7 +43,7 @@
}
static void
-doanotherpass(Andy *a)
+turnaround(Andy *a)
{
if(--a->passes > 0){
a->passdir = mulpt2(a->passdir, -1);
@@ -71,7 +71,6 @@
do
cell = Pt2(ntruerand(MAPW), ntruerand(MAPH), 1);
while(gettile(a, cell) != Twater);
- fprint(2, "[%d] search shot\n", getpid());
break;
case ACalibrating:
do
@@ -78,25 +77,21 @@
cell = addpt2(a->firsthit, nwes[--a->ntries&3]);
while(gettile(a, cell) != Twater && a->ntries > 1);
if(a->ntries < 1 && gettile(a, cell) != Twater){
- fprint(2, "[%d] neverland\n", getpid());
a->disengage(a);
goto Retry;
}
- fprint(2, "[%d] calibrating shot\n", getpid());
break;
case ABombing:
cell = addpt2(a->lastshot, a->passdir);
if(gettile(a, cell) != Twater){
- doanotherpass(a);
+ turnaround(a);
goto Retry;
}
- fprint(2, "[%d] bombing shot\n", getpid());
break;
}
m->body = smprint("shoot %s", cell2coords(cell));
sendp(a->ego->battle->data, m);
a->lastshot = cell;
- fprint(2, "[%d] shot enemy\n", getpid());
}
static void
@@ -106,7 +101,6 @@
a->state = ACalibrating;
a->ntries = nelem(nwes);
a->passes = 2;
- fprint(2, "[%d] enemy engaged\n", getpid());
}
static void
@@ -113,13 +107,11 @@
andy_disengage(Andy *a)
{
a->state = ASearching;
- fprint(2, "[%d] enemy disengaged\n", getpid());
}
static void
andy_registerhit(Andy *a)
{
- fprint(2, "[%d] hit enemy\n", getpid());
settile(a, a->lastshot, Thit);
if(a->state == ASearching)
a->engage(a);
@@ -126,7 +118,6 @@
else if(a->state == ACalibrating){
a->passdir = subpt2(a->lastshot, a->firsthit);
a->state = ABombing;
- fprint(2, "[%d] began bombing\n", getpid());
}
}
@@ -133,14 +124,11 @@
static void
andy_registermiss(Andy *a)
{
- fprint(2, "[%d] missed enemy\n", getpid());
settile(a, a->lastshot, Tmiss);
if(a->state == ACalibrating && a->ntries < 1)
a->disengage(a);
- else if(a->state == ABombing){
- doanotherpass(a);
- fprint(2, "[%d] bombing pass #%d dir %v\n", getpid(), a->passes, a->passdir);
- }
+ else if(a->state == ABombing)
+ turnaround(a);
}
Andy *