Dec 072017
 
C-Robots robot - the undefeated BEAR.R.
File CRB_BEAR.ZIP from The Programmer’s Corner in
Category Games and Entertainment
C-Robots robot – the undefeated BEAR.R.
File Name File Size Zip Size Zip Type
BEAR.DOC 1221 498 deflated
BEAR.R 110 98 deflated

Download File CRB_BEAR.ZIP Here

Contents of the BEAR.DOC file


/* Bear */

Written by Anthony Li for use with CROBOTS. 8/30/88
In its current format, BEAR.R is only 110 bytes in size, but a formidable
opponent despite its simplicity. In an expanded format, BEAR.R might be:

/*-------------------------------------------------------------------------*/
/* Bear.R: A CRobot program */

main ()
{
int Enemy_Range;
int Heading;

Heading = 0; /* Initialize Heading, facing Bear towards coord 0 */
while (1) /* Perform a continuous loop */
{
Enemy_Range = scan (Heading, 5); /* Look for an enemy straight ahead */
if (Enemy_Range > 40)
{ /* If there is an enemy in range, */
cannon (Heading, Enemy_Range); /* then fire at it */
}
else
{ /* If no enemy was detected, */
if (Heading < 360) /* then turn around a little */
Heading += 5;
else
Heading = 0;
drive (Heading, 50); /* and move forward slowly */
}
}
}
/*-------------------------------------------------------------------------*/


 December 7, 2017  Add comments

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)