Move toward the spiders that are out of shooting range.
\t;Program
The program will look like the previous one, but before you shoot, use the instruction \c;\l;move\u cbot\move;();\n; in order to get close enough.
The question is just how many meters the bot must move. The instruction \c;\l;distance\u cbot\dist;( , )\n; calculates the distance between two positions. In this case, we need to know the distance between the bot and the target. The position of the target is given by \c;item.position\n;, the position of the bot is give by \c;position\n;. The distance between the bot and the target is given by \c;\l;distance\u cbot\dist;(position, item.position)\n;. The range of a fireball cannon is 40 meters. In order to get close enough, the bot must move forward \c;\l;distance\u cbot\dist;(position, item.position)-40\n; meters. The following line will do this: