2007/pippo07a.r

001/*
002 Pippo7a
003 Torneo: Micro
004 
005 Per la strategia, un attimo che vado a vedere sotto, visto che non la ricordo.
006 Prima cosa che fa, come oramai fanno in molti, si mette vicino al lato piu' prossimo.
007 Li comincia ad oscillare a destra e sinistra in tutta tranquillita'.
008 
009 Passato uno certo numero di oscillazioni, si mette ad oscillare DX/SX sulla
010 verticale al centro del campo, rispetto a Pippo07b, fa delle oscillazioni piu' ampie.
011 
012 La funzione di fuoco e' quella di pippo04, che era di pippo03, che era......
013 che sicuramente ho copiato da qualcuno :).....
014 
015 ciao
016 
017 Andrea Creola
018 
019*/
020int rng,
021    deg, 
022    orng,
023    odeg,
024    dir,
025    un1,
026    tt;
027     
028main()
029{
030 tt=40;
031 if(loc_y()>500) up(900);
032 else dw(100);
033 while(--tt)
034 {
035  sx(200,180);
036  dx(800,0);
037 }
038    
039 while(1)
040 {
041  while(loc_y()<800)
042  {
043   dx(600,5);
044   sx(400,175);
045  }
046  while(loc_y()>200)
047  {
048   dx(600,355);
049   sx(400,185);
050 
051  }
052 }
053  
054}
055 
056 
057 
058fuoco()
059{
060 if (orng=scan(deg,10));
061 else if (orng=scan(deg-=20,10));
062 else if (orng=scan(deg+=40,10));
063 else return deg+=41;
064 
065 if (!scan(deg+=354,6)) deg+=12;
066 fnd();
067 if (orng=scan(odeg=deg,10))
068  {
069   fnd();
070   if (rng=scan(deg,10))
071    {
072     cannon(deg+((deg-odeg)*((700+rng))>>9)-(sin(deg-dir)>>14),
073                       rng*179/(179+orng-rng-(cos(deg-dir)>>12)));
074     if (orng>850)  deg+=41;
075     return;
076    }
077  }
078 else
079  {
080   while(!(orng=scan(deg+=35,10)));
081   cannon (deg, 2*scan(deg,10)-orng);
082  }
083  
084}
085 
086 
087 
088fnd()
089{
090 if(scan(deg-7,3)) deg-=7;
091 if(scan(deg+7,3)) deg+=7;
092 if(scan(deg-4,1)) deg-=4;
093 if(scan(deg+4,1)) deg+=4;
094 if(scan(deg-2,1)) deg-=2;
095 if(scan(deg+2,1)) deg+=2;
096}
097 
098 
099up(xx) {   while(loc_y()<xx) vs(90);   stop(); }
100dw(xx) {  while(loc_y()>xx) vs(270);  stop(); }
101dx(xx,dd) {  while(loc_x()<xx) vs(dd);  stop(); }
102sx(xx,dd) {  while(loc_x()>xx) vs(dd);  stop(); }
103vs(xx) {  fuoco(drive(dir=xx,100)); }
104stop() {  while(speed(drive(dir,0))>50);/* Fire(0);*/ }