/*PeriZoom Killer robot by Ralph Seiler 73765,264. An inherent weakness in PeriZoom is that it always passes along a certain path at a constant speed. That makes it easy prey for a robot like this. PZK wins in match play against PeriZoom about 95% of the time. Of course it loses to **any** other robot 100% of the time. */ main() { int range, angle; int flag; /*Not everything worth doing is worth doing well: set course to top center, stop by running into the wall*/ angle=plot_course(); drive(angle,100); flag=0; while (1) { while (flag==0) { /*When PeriZoom is right in front of me. The scan has a problem since it misses PeriZoom if he is firing right in front of me. Could this be raising electronic dust that is fouling my sensors? */ range = scan(270,5); if (range>0) { cannon(261,range); flag=1;}} while (flag==1) { /*When PeriZoom is on left side of arena*/ range = scan(200,5); if (range>400) { range=(103*range)/100; /*1.03 is the ratio of cos(scan angle)*/ cannon(204,range); /*and cos(fire angle) */ flag=2;}} while (flag==2) { /*When PeriZoom is on right side of arena*/ range = scan(330,5); if (range>0) { range=(97*range)/100; cannon(333,range); flag=0;}} }} /* find the heading we need to get to the top. pretty much straight from sniper.r */ plot_course() { int d; int temp_x,temp_y; int scale; scale = 100000; temp_x = loc_x() - 500; temp_y = loc_y() - 1000; if (temp_x == 0) { d = 90; } else { if (temp_x<0) d = atan((scale * temp_y) / temp_x); else d = 180 + atan((scale * temp_y) / temp_x); } return (d); } ÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃ