2020/discotek.r

001/************************
002 *                      *
003 *  D I S C O T E K .r  *
004 *                      *
005 ************************
006 
007 Michelangelo Messina                        
008 
009MicroRobot senza nessuna pretesa, che deriva da Colour.r del 2015.
010E' composto solo di routine f2f, che usa una versione ridotta della classica boom()
011 
012 
013*/
014 
015 
016int     deg, /*angolo di sparo*/
017        rng, /*distanza*/
018        dir; /*direzione*/
019        int orng;
020    int x,y,b,dam;
021 
022 
023spara()
024{
025    drive(dir,100);
026        if ((orng=scan(deg, 10)) ) {
027                if (scan(deg-15,10)) {
028                        if (scan(deg-=13,4)) {
029                                if(scan(deg-8,10)) deg-=6;
030                                else ++deg;
031                        else if (scan(deg-10,10)) deg-=5;
032                } else if(scan(deg+14,10)) {
033                        if (scan(deg+=13,5)) deg+=5;
034                        else --deg;
035                else if(scan(deg+9,10)) deg+=6;
036                else deg-=5;
037 
038        else if ((orng=scan(deg-=21,10))) {
039                if (scan(deg-9,10)) {
040                        if (scan(deg-=13,5)) deg-=5;
041                        else ++deg;
042                } else if(scan(deg+9,10)) deg+=6;
043        else if ((orng=scan(deg+=42,10))) {
044                if (scan(deg+9,10)) deg+=12;
045        else if ((orng=scan(deg+=21,10)));
046    else return radar();
047        if (rng=scan(deg,10)){ 
048                cannon (deg, rng*135/(135+orng-rng) );
049        else radar();
050}
051radar(){while (!(orng=scan(deg+=21,10))); return cannon(deg,orng);}
052 
053 
054main()
055{
056    if(loc_y(x=(loc_x()>500))>500) {
057                if(x) spara(dir=deg=195);
058                else spara(dir=deg=285);
059        } else {
060                if(x) spara(dir=deg=105);
061                else spara(dir=deg=375);
062        }
063    spara();
064            while(1) {
065        if(orng>550) dir=deg+25+(b^=1)*290;
066        else if(orng<152) dir=(deg/90)*90;
067        else dir=deg+80+(b^=1)*200;                              
068                if ((x=loc_x(y=loc_y()))>870) dir=165+30*(y>500);
069                else if (x<130) dir=345+30*(y<500);
070                else if (y>870) dir=255+30*(x<500);
071                else if (y<130) dir=75+30*(x>500);
072        else if(dam>80) dir+=180;
073                dam=damage(spara());
074        if(scan(deg-15,10)) deg-=4;
075        if(scan(deg+15,10)) deg+=4;
076        spara();               
077            }
078}
079 
080/*
081Hi, Discotek People
082It's time to move your body (it's time to move your body)
083It's now time to jump it to the left (it's time to jump it to the left)
084And jump it to the right (and jump it to the right)
085Are you ready? (are you ready?)
086Now dance, dance to the left, to the left
087Now dance, dance to the right, to the right.
088Dance, move to the left, to the left,
089Dance, move to the right, to the right,
090Dance, move to the left, to the left
091Dance, move to the right, to the right
092Dance, move to the left, to the left,
093Dance, move to the right, to the right,
094Dance, move to the left, to the left
095Dance, move to the right, to the right.
096It's now time to move your body
097It's now time to jump it to the left (left)
098And now, jump it to the right, right, right, right...
099Move it, move it, move it
100Dance, move to the left, to the left,
101Dance, move to the right, to the right,
102Dance, move to the left, to the left
103Dance, move to the right, to the right
104Dance, move to the left, to the left,
105Dance, move to the right, to the right,
106Dance, move to the left, to the left
107Dance, move to the right, to the right
108CIAO, BABY!
109*/