2020/discotek.r
001 | /************************ |
002 | * * |
003 | * D I S C O T E K .r * |
004 | * * |
005 | ************************ |
006 |
007 | Michelangelo Messina |
008 |
009 | MicroRobot senza nessuna pretesa, che deriva da Colour.r del 2015. |
010 | E' composto solo di routine f2f, che usa una versione ridotta della classica boom() |
011 |
012 |
013 | */ |
014 |
015 |
016 | int deg, /*angolo di sparo*/ |
017 | rng, /*distanza*/ |
018 | dir; /*direzione*/ |
019 | int orng; |
020 | int x,y,b,dam; |
021 |
022 |
023 | spara() |
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 | } |
051 | radar(){ while (!(orng=scan(deg+=21,10))); return cannon(deg,orng);} |
052 |
053 |
054 | main() |
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 | /* |
081 | Hi, Discotek People |
082 | It's time to move your body (it's time to move your body) |
083 | It's now time to jump it to the left (it's time to jump it to the left) |
084 | And jump it to the right (and jump it to the right) |
085 | Are you ready? (are you ready?) |
086 | Now dance, dance to the left, to the left |
087 | Now dance, dance to the right, to the right. |
088 | Dance, move to the left, to the left, |
089 | Dance, move to the right, to the right, |
090 | Dance, move to the left, to the left |
091 | Dance, move to the right, to the right |
092 | Dance, move to the left, to the left, |
093 | Dance, move to the right, to the right, |
094 | Dance, move to the left, to the left |
095 | Dance, move to the right, to the right. |
096 | It's now time to move your body |
097 | It's now time to jump it to the left (left) |
098 | And now, jump it to the right, right, right, right... |
099 | Move it, move it, move it |
100 | Dance, move to the left, to the left, |
101 | Dance, move to the right, to the right, |
102 | Dance, move to the left, to the left |
103 | Dance, move to the right, to the right |
104 | Dance, move to the left, to the left, |
105 | Dance, move to the right, to the right, |
106 | Dance, move to the left, to the left |
107 | Dance, move to the right, to the right |
108 | CIAO, BABY! |
109 | */ |