It works. But I didn't do it the way they said to. #yolo
Fork of GradientSolver by
main.cpp@3:b2d61294966e, 2014-06-05 (annotated)
- Committer:
- mmpeter
- Date:
- Thu Jun 05 14:09:13 2014 +0000
- Revision:
- 3:b2d61294966e
- Parent:
- 2:49565c1ff0bf
- Child:
- 4:9dd1477111da
cheater method works
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mmpeter | 0:6b067dcbab9d | 1 | #include "mbed.h" |
mmpeter | 0:6b067dcbab9d | 2 | #include "m3pi_ng.h" |
mmpeter | 0:6b067dcbab9d | 3 | #include "cmath" |
mmpeter | 0:6b067dcbab9d | 4 | #include "iostream" |
mmpeter | 0:6b067dcbab9d | 5 | #include <string> |
mmpeter | 0:6b067dcbab9d | 6 | |
mmpeter | 0:6b067dcbab9d | 7 | m3pi thinggy; |
mmpeter | 0:6b067dcbab9d | 8 | |
mmpeter | 0:6b067dcbab9d | 9 | void turn_right(); |
mmpeter | 1:48163ae9fe4d | 10 | void turn_left(); |
mmpeter | 1:48163ae9fe4d | 11 | void victors(); |
mmpeter | 0:6b067dcbab9d | 12 | int darkest=0; |
mmpeter | 0:6b067dcbab9d | 13 | int dark; |
mmpeter | 0:6b067dcbab9d | 14 | int previousdark; |
mmpeter | 0:6b067dcbab9d | 15 | int v1=0,v2=0,v3=0,v4=0,v5=0,v6=0; |
mmpeter | 0:6b067dcbab9d | 16 | bool found; |
mmpeter | 0:6b067dcbab9d | 17 | int x; |
mmpeter | 0:6b067dcbab9d | 18 | |
mmpeter | 0:6b067dcbab9d | 19 | |
mmpeter | 0:6b067dcbab9d | 20 | using namespace std; |
mmpeter | 0:6b067dcbab9d | 21 | int sensor[5]; |
mmpeter | 0:6b067dcbab9d | 22 | |
mmpeter | 0:6b067dcbab9d | 23 | int main() { |
mmpeter | 1:48163ae9fe4d | 24 | thinggy.raw_sensor(sensor); |
mmpeter | 0:6b067dcbab9d | 25 | while(1){ |
mmpeter | 1:48163ae9fe4d | 26 | |
mmpeter | 0:6b067dcbab9d | 27 | while(found!=1){ |
mmpeter | 1:48163ae9fe4d | 28 | //Reading on north |
mmpeter | 1:48163ae9fe4d | 29 | thinggy.cls(); |
mmpeter | 1:48163ae9fe4d | 30 | thinggy.raw_sensor(sensor); |
mmpeter | 1:48163ae9fe4d | 31 | thinggy.printf("1: "); |
mmpeter | 1:48163ae9fe4d | 32 | thinggy.printf("%i",sensor[2]); |
mmpeter | 0:6b067dcbab9d | 33 | v1=sensor[2]; |
mmpeter | 0:6b067dcbab9d | 34 | thinggy.stop(); |
mmpeter | 0:6b067dcbab9d | 35 | wait(0.5); |
mmpeter | 1:48163ae9fe4d | 36 | turn_right(); |
mmpeter | 1:48163ae9fe4d | 37 | |
mmpeter | 1:48163ae9fe4d | 38 | //Turn 60 degrees from north |
mmpeter | 0:6b067dcbab9d | 39 | thinggy.cls(); |
mmpeter | 1:48163ae9fe4d | 40 | thinggy.raw_sensor(sensor); |
mmpeter | 1:48163ae9fe4d | 41 | thinggy.printf("2: "); |
mmpeter | 1:48163ae9fe4d | 42 | thinggy.printf("%i",sensor[2]); |
mmpeter | 0:6b067dcbab9d | 43 | v2=sensor[2]; |
mmpeter | 0:6b067dcbab9d | 44 | thinggy.stop(); |
mmpeter | 0:6b067dcbab9d | 45 | wait(0.5); |
mmpeter | 1:48163ae9fe4d | 46 | turn_right(); |
mmpeter | 1:48163ae9fe4d | 47 | |
mmpeter | 1:48163ae9fe4d | 48 | //120 degrees from north |
mmpeter | 0:6b067dcbab9d | 49 | thinggy.cls(); |
mmpeter | 1:48163ae9fe4d | 50 | thinggy.raw_sensor(sensor); |
mmpeter | 1:48163ae9fe4d | 51 | thinggy.printf("3: "); |
mmpeter | 1:48163ae9fe4d | 52 | thinggy.printf("%i",sensor[2]); |
mmpeter | 0:6b067dcbab9d | 53 | v3=sensor[2]; |
mmpeter | 0:6b067dcbab9d | 54 | thinggy.stop(); |
mmpeter | 0:6b067dcbab9d | 55 | wait(0.5); |
mmpeter | 1:48163ae9fe4d | 56 | turn_right(); |
mmpeter | 1:48163ae9fe4d | 57 | |
mmpeter | 1:48163ae9fe4d | 58 | //180 degrees from north |
mmpeter | 0:6b067dcbab9d | 59 | thinggy.cls(); |
mmpeter | 1:48163ae9fe4d | 60 | thinggy.raw_sensor(sensor); |
mmpeter | 1:48163ae9fe4d | 61 | thinggy.printf("4: "); |
mmpeter | 1:48163ae9fe4d | 62 | thinggy.printf("%i",sensor[2]); |
mmpeter | 0:6b067dcbab9d | 63 | v4=sensor[2]; |
mmpeter | 0:6b067dcbab9d | 64 | thinggy.stop(); |
mmpeter | 0:6b067dcbab9d | 65 | wait(0.5); |
mmpeter | 1:48163ae9fe4d | 66 | turn_right(); |
mmpeter | 1:48163ae9fe4d | 67 | |
mmpeter | 1:48163ae9fe4d | 68 | //240 degrees from north |
mmpeter | 0:6b067dcbab9d | 69 | thinggy.cls(); |
mmpeter | 1:48163ae9fe4d | 70 | thinggy.raw_sensor(sensor); |
mmpeter | 1:48163ae9fe4d | 71 | thinggy.printf("5: "); |
mmpeter | 1:48163ae9fe4d | 72 | thinggy.printf("%i",sensor[2]); |
mmpeter | 0:6b067dcbab9d | 73 | v5=sensor[2]; |
mmpeter | 0:6b067dcbab9d | 74 | thinggy.stop(); |
mmpeter | 0:6b067dcbab9d | 75 | wait(0.5); |
mmpeter | 1:48163ae9fe4d | 76 | turn_right(); |
mmpeter | 1:48163ae9fe4d | 77 | |
mmpeter | 1:48163ae9fe4d | 78 | //300 degrees from north |
mmpeter | 0:6b067dcbab9d | 79 | thinggy.cls(); |
mmpeter | 1:48163ae9fe4d | 80 | thinggy.raw_sensor(sensor); |
mmpeter | 1:48163ae9fe4d | 81 | thinggy.printf("6: "); |
mmpeter | 1:48163ae9fe4d | 82 | thinggy.printf("%i",sensor[2]); |
mmpeter | 0:6b067dcbab9d | 83 | v6=sensor[2]; |
mmpeter | 0:6b067dcbab9d | 84 | thinggy.stop(); |
mmpeter | 0:6b067dcbab9d | 85 | wait(0.5); |
mmpeter | 3:b2d61294966e | 86 | turn_right(); |
mmpeter | 3:b2d61294966e | 87 | thinggy.stop(); |
mmpeter | 1:48163ae9fe4d | 88 | |
mmpeter | 1:48163ae9fe4d | 89 | //Chill the fuck out |
mmpeter | 0:6b067dcbab9d | 90 | thinggy.cls(); |
mmpeter | 1:48163ae9fe4d | 91 | thinggy.printf("Relax"); |
mmpeter | 1:48163ae9fe4d | 92 | wait(1); |
mmpeter | 1:48163ae9fe4d | 93 | thinggy.cls(); |
mmpeter | 1:48163ae9fe4d | 94 | thinggy.printf("I got it"); |
mmpeter | 1:48163ae9fe4d | 95 | thinggy.stop(); |
mmpeter | 1:48163ae9fe4d | 96 | wait(1); |
mmpeter | 0:6b067dcbab9d | 97 | |
mmpeter | 0:6b067dcbab9d | 98 | //Determine which direction is darkest |
mmpeter | 1:48163ae9fe4d | 99 | //If the darkest spot is found, stop, play victory sound |
mmpeter | 1:48163ae9fe4d | 100 | if(v1==2000){ |
mmpeter | 1:48163ae9fe4d | 101 | thinggy.stop(); |
mmpeter | 1:48163ae9fe4d | 102 | thinggy.cls(); |
mmpeter | 1:48163ae9fe4d | 103 | thinggy.printf("Found it"); |
mmpeter | 1:48163ae9fe4d | 104 | thinggy.forward(0.2); |
mmpeter | 1:48163ae9fe4d | 105 | wait(0.1); |
mmpeter | 1:48163ae9fe4d | 106 | thinggy.stop(); |
mmpeter | 1:48163ae9fe4d | 107 | wait(1); |
mmpeter | 1:48163ae9fe4d | 108 | victors(); |
mmpeter | 1:48163ae9fe4d | 109 | return found=1; |
mmpeter | 1:48163ae9fe4d | 110 | } |
mmpeter | 1:48163ae9fe4d | 111 | if(v2==2000){ |
mmpeter | 1:48163ae9fe4d | 112 | thinggy.stop(); |
mmpeter | 1:48163ae9fe4d | 113 | thinggy.cls(); |
mmpeter | 1:48163ae9fe4d | 114 | thinggy.printf("Found it"); |
mmpeter | 1:48163ae9fe4d | 115 | turn_right(); |
mmpeter | 1:48163ae9fe4d | 116 | thinggy.forward(0.2); |
mmpeter | 1:48163ae9fe4d | 117 | wait(0.1); |
mmpeter | 1:48163ae9fe4d | 118 | thinggy.stop(); |
mmpeter | 1:48163ae9fe4d | 119 | wait(1); |
mmpeter | 1:48163ae9fe4d | 120 | victors(); |
mmpeter | 1:48163ae9fe4d | 121 | return found=1; |
mmpeter | 1:48163ae9fe4d | 122 | } |
mmpeter | 1:48163ae9fe4d | 123 | |
mmpeter | 1:48163ae9fe4d | 124 | if(v3==2000){ |
mmpeter | 1:48163ae9fe4d | 125 | thinggy.stop(); |
mmpeter | 1:48163ae9fe4d | 126 | thinggy.cls(); |
mmpeter | 1:48163ae9fe4d | 127 | thinggy.printf("Found it"); |
mmpeter | 1:48163ae9fe4d | 128 | turn_right(); |
mmpeter | 1:48163ae9fe4d | 129 | turn_right(); |
mmpeter | 1:48163ae9fe4d | 130 | thinggy.forward(0.2); |
mmpeter | 1:48163ae9fe4d | 131 | wait(0.1); |
mmpeter | 1:48163ae9fe4d | 132 | thinggy.stop(); |
mmpeter | 1:48163ae9fe4d | 133 | wait(1); |
mmpeter | 1:48163ae9fe4d | 134 | victors(); |
mmpeter | 1:48163ae9fe4d | 135 | return found=1; |
mmpeter | 1:48163ae9fe4d | 136 | } |
mmpeter | 1:48163ae9fe4d | 137 | |
mmpeter | 1:48163ae9fe4d | 138 | if(v4==2000){ |
mmpeter | 1:48163ae9fe4d | 139 | thinggy.stop(); |
mmpeter | 1:48163ae9fe4d | 140 | thinggy.cls(); |
mmpeter | 1:48163ae9fe4d | 141 | thinggy.printf("Found it"); |
mmpeter | 1:48163ae9fe4d | 142 | turn_right(); |
mmpeter | 1:48163ae9fe4d | 143 | turn_right(); |
mmpeter | 1:48163ae9fe4d | 144 | turn_right(); |
mmpeter | 1:48163ae9fe4d | 145 | thinggy.forward(0.2); |
mmpeter | 1:48163ae9fe4d | 146 | wait(0.1); |
mmpeter | 1:48163ae9fe4d | 147 | thinggy.stop(); |
mmpeter | 1:48163ae9fe4d | 148 | wait(1); |
mmpeter | 1:48163ae9fe4d | 149 | victors(); |
mmpeter | 1:48163ae9fe4d | 150 | return found=1; |
mmpeter | 1:48163ae9fe4d | 151 | } |
mmpeter | 1:48163ae9fe4d | 152 | |
mmpeter | 1:48163ae9fe4d | 153 | if(v5==2000){ |
mmpeter | 1:48163ae9fe4d | 154 | thinggy.stop(); |
mmpeter | 1:48163ae9fe4d | 155 | thinggy.cls(); |
mmpeter | 1:48163ae9fe4d | 156 | thinggy.printf("Found it"); |
mmpeter | 1:48163ae9fe4d | 157 | turn_left(); |
mmpeter | 1:48163ae9fe4d | 158 | turn_left(); |
mmpeter | 1:48163ae9fe4d | 159 | thinggy.forward(0.2); |
mmpeter | 1:48163ae9fe4d | 160 | wait(0.1); |
mmpeter | 1:48163ae9fe4d | 161 | thinggy.stop(); |
mmpeter | 1:48163ae9fe4d | 162 | wait(1); |
mmpeter | 1:48163ae9fe4d | 163 | victors(); |
mmpeter | 1:48163ae9fe4d | 164 | return found=1; |
mmpeter | 1:48163ae9fe4d | 165 | } |
mmpeter | 1:48163ae9fe4d | 166 | |
mmpeter | 1:48163ae9fe4d | 167 | if(v6==2000){ |
mmpeter | 1:48163ae9fe4d | 168 | thinggy.stop(); |
mmpeter | 1:48163ae9fe4d | 169 | thinggy.cls(); |
mmpeter | 1:48163ae9fe4d | 170 | thinggy.printf("Found it"); |
mmpeter | 1:48163ae9fe4d | 171 | turn_left(); |
mmpeter | 1:48163ae9fe4d | 172 | thinggy.forward(0.2); |
mmpeter | 1:48163ae9fe4d | 173 | wait(0.1); |
mmpeter | 1:48163ae9fe4d | 174 | thinggy.stop(); |
mmpeter | 1:48163ae9fe4d | 175 | wait(1); |
mmpeter | 1:48163ae9fe4d | 176 | victors(); |
mmpeter | 1:48163ae9fe4d | 177 | return found=1; |
mmpeter | 1:48163ae9fe4d | 178 | } |
mmpeter | 1:48163ae9fe4d | 179 | //Continue the search |
mmpeter | 0:6b067dcbab9d | 180 | //North is darkest |
mmpeter | 0:6b067dcbab9d | 181 | if(v1>v2 and v1>v3 and v1>v4 and v1>v5 and v1>v6){ |
mmpeter | 0:6b067dcbab9d | 182 | x=1; |
mmpeter | 0:6b067dcbab9d | 183 | dark=v1; |
mmpeter | 0:6b067dcbab9d | 184 | thinggy.cls(); |
mmpeter | 0:6b067dcbab9d | 185 | thinggy.printf("It's 1"); |
mmpeter | 0:6b067dcbab9d | 186 | } |
mmpeter | 0:6b067dcbab9d | 187 | //60 degrees from north is darkest |
mmpeter | 0:6b067dcbab9d | 188 | else if(v2>v1 and v2>v3 and v2>v4 and v2>v5 and v2>v6){ |
mmpeter | 0:6b067dcbab9d | 189 | x=2; |
mmpeter | 0:6b067dcbab9d | 190 | dark=v2; |
mmpeter | 0:6b067dcbab9d | 191 | thinggy.cls(); |
mmpeter | 0:6b067dcbab9d | 192 | thinggy.printf("It's 2"); |
mmpeter | 0:6b067dcbab9d | 193 | } |
mmpeter | 0:6b067dcbab9d | 194 | //120 degrees from north is darkest |
mmpeter | 0:6b067dcbab9d | 195 | else if(v3>v1 and v3>v2 and v3>v4 and v3>v5 and v3>v6){ |
mmpeter | 0:6b067dcbab9d | 196 | x=3; |
mmpeter | 0:6b067dcbab9d | 197 | dark=v3; |
mmpeter | 0:6b067dcbab9d | 198 | thinggy.cls(); |
mmpeter | 0:6b067dcbab9d | 199 | thinggy.printf("It's 3"); |
mmpeter | 0:6b067dcbab9d | 200 | } |
mmpeter | 0:6b067dcbab9d | 201 | //180 degrees from north is darkest |
mmpeter | 0:6b067dcbab9d | 202 | else if(v4>v1 and v4>v2 and v4>v3 and v4>v5 and v4>v6){ |
mmpeter | 0:6b067dcbab9d | 203 | x=4; |
mmpeter | 0:6b067dcbab9d | 204 | dark=v4; |
mmpeter | 0:6b067dcbab9d | 205 | thinggy.cls(); |
mmpeter | 0:6b067dcbab9d | 206 | thinggy.printf("It's 4"); |
mmpeter | 0:6b067dcbab9d | 207 | } |
mmpeter | 0:6b067dcbab9d | 208 | //240 degrees from north is darkest |
mmpeter | 0:6b067dcbab9d | 209 | else if(v5>v1 and v5>v2 and v5>v3 and v5>v4 and v5>v6){ |
mmpeter | 0:6b067dcbab9d | 210 | x=5; |
mmpeter | 0:6b067dcbab9d | 211 | dark=v5; |
mmpeter | 0:6b067dcbab9d | 212 | thinggy.cls(); |
mmpeter | 0:6b067dcbab9d | 213 | thinggy.printf("It's 5"); |
mmpeter | 0:6b067dcbab9d | 214 | } |
mmpeter | 0:6b067dcbab9d | 215 | //300 degrees from north is darkest |
mmpeter | 0:6b067dcbab9d | 216 | else if(v6>v1 and v6>v2 and v6>v3 and v6>v4 and v6>v5){ |
mmpeter | 0:6b067dcbab9d | 217 | x=6; |
mmpeter | 0:6b067dcbab9d | 218 | dark=v6; |
mmpeter | 0:6b067dcbab9d | 219 | thinggy.cls(); |
mmpeter | 0:6b067dcbab9d | 220 | thinggy.printf("It's 6"); |
mmpeter | 0:6b067dcbab9d | 221 | } |
mmpeter | 0:6b067dcbab9d | 222 | |
mmpeter | 0:6b067dcbab9d | 223 | switch(x){ |
mmpeter | 0:6b067dcbab9d | 224 | case 1: |
mmpeter | 0:6b067dcbab9d | 225 | //Go forward |
mmpeter | 1:48163ae9fe4d | 226 | thinggy.forward(0.3); |
mmpeter | 1:48163ae9fe4d | 227 | wait(0.1); |
mmpeter | 0:6b067dcbab9d | 228 | break; |
mmpeter | 0:6b067dcbab9d | 229 | case 2: |
mmpeter | 0:6b067dcbab9d | 230 | //Go 60 degrees from north |
mmpeter | 0:6b067dcbab9d | 231 | turn_right(); |
mmpeter | 1:48163ae9fe4d | 232 | thinggy.forward(0.3); |
mmpeter | 1:48163ae9fe4d | 233 | wait(0.1); |
mmpeter | 0:6b067dcbab9d | 234 | break; |
mmpeter | 0:6b067dcbab9d | 235 | case 3: |
mmpeter | 0:6b067dcbab9d | 236 | //Go 120 degrees from north |
mmpeter | 0:6b067dcbab9d | 237 | turn_right(); |
mmpeter | 0:6b067dcbab9d | 238 | turn_right(); |
mmpeter | 1:48163ae9fe4d | 239 | thinggy.forward(0.3); |
mmpeter | 1:48163ae9fe4d | 240 | wait(0.1); |
mmpeter | 0:6b067dcbab9d | 241 | break; |
mmpeter | 0:6b067dcbab9d | 242 | case 4: |
mmpeter | 0:6b067dcbab9d | 243 | //Go 180 degrees from north |
mmpeter | 0:6b067dcbab9d | 244 | turn_right(); |
mmpeter | 0:6b067dcbab9d | 245 | turn_right(); |
mmpeter | 0:6b067dcbab9d | 246 | turn_right(); |
mmpeter | 1:48163ae9fe4d | 247 | thinggy.forward(0.3); |
mmpeter | 1:48163ae9fe4d | 248 | wait(0.1); |
mmpeter | 0:6b067dcbab9d | 249 | break; |
mmpeter | 0:6b067dcbab9d | 250 | case 5: |
mmpeter | 0:6b067dcbab9d | 251 | //Go 240 degrees from north |
mmpeter | 1:48163ae9fe4d | 252 | turn_left(); |
mmpeter | 1:48163ae9fe4d | 253 | turn_left(); |
mmpeter | 1:48163ae9fe4d | 254 | thinggy.forward(0.3); |
mmpeter | 1:48163ae9fe4d | 255 | wait(0.1); |
mmpeter | 0:6b067dcbab9d | 256 | break; |
mmpeter | 0:6b067dcbab9d | 257 | case 6: |
mmpeter | 0:6b067dcbab9d | 258 | //Go 300 degrees from north |
mmpeter | 1:48163ae9fe4d | 259 | turn_left(); |
mmpeter | 1:48163ae9fe4d | 260 | thinggy.forward(0.3); |
mmpeter | 1:48163ae9fe4d | 261 | wait(0.1); |
mmpeter | 0:6b067dcbab9d | 262 | break; |
mmpeter | 0:6b067dcbab9d | 263 | } |
mmpeter | 0:6b067dcbab9d | 264 | |
mmpeter | 0:6b067dcbab9d | 265 | } |
mmpeter | 0:6b067dcbab9d | 266 | } |
mmpeter | 0:6b067dcbab9d | 267 | } |
mmpeter | 0:6b067dcbab9d | 268 | |
mmpeter | 0:6b067dcbab9d | 269 | //EFFECTS: turns the robot right |
mmpeter | 0:6b067dcbab9d | 270 | void turn_right(){ |
mmpeter | 0:6b067dcbab9d | 271 | int n=0; |
mmpeter | 0:6b067dcbab9d | 272 | wait(.08); |
mmpeter | 3:b2d61294966e | 273 | while (n<272){ |
mmpeter | 0:6b067dcbab9d | 274 | thinggy.left_motor(0.2); |
mmpeter | 0:6b067dcbab9d | 275 | thinggy.right_motor(-0.2); |
mmpeter | 0:6b067dcbab9d | 276 | n++; |
mmpeter | 0:6b067dcbab9d | 277 | } |
mmpeter | 0:6b067dcbab9d | 278 | wait(0.15); |
mmpeter | 1:48163ae9fe4d | 279 | } |
mmpeter | 1:48163ae9fe4d | 280 | //EFFECTS: turns the robot left |
mmpeter | 1:48163ae9fe4d | 281 | void turn_left(){ |
mmpeter | 1:48163ae9fe4d | 282 | int n=0; |
mmpeter | 1:48163ae9fe4d | 283 | wait(.08); |
mmpeter | 3:b2d61294966e | 284 | while (n<272){ |
mmpeter | 1:48163ae9fe4d | 285 | thinggy.left_motor(-0.2); |
mmpeter | 1:48163ae9fe4d | 286 | thinggy.right_motor(0.2); |
mmpeter | 1:48163ae9fe4d | 287 | n++; |
mmpeter | 1:48163ae9fe4d | 288 | } |
mmpeter | 1:48163ae9fe4d | 289 | thinggy.forward(0.2); |
mmpeter | 1:48163ae9fe4d | 290 | wait(0.15); |
mmpeter | 1:48163ae9fe4d | 291 | } |
mmpeter | 1:48163ae9fe4d | 292 | |
mmpeter | 1:48163ae9fe4d | 293 | //EFFECTS: Play victory tune |
mmpeter | 1:48163ae9fe4d | 294 | void victors(){ |
mmpeter | 1:48163ae9fe4d | 295 | // V=volume max is 15::O5=octave5::G16=G16th note::R24=rest24th note...a rest is needed between any two note that are the same |
mmpeter | 1:48163ae9fe4d | 296 | char hail[]={'V','1','0', |
mmpeter | 1:48163ae9fe4d | 297 | //hail to the victors valiant |
mmpeter | 1:48163ae9fe4d | 298 | 'O','5', |
mmpeter | 1:48163ae9fe4d | 299 | 'C','2', |
mmpeter | 1:48163ae9fe4d | 300 | |
mmpeter | 1:48163ae9fe4d | 301 | 'O','4', |
mmpeter | 1:48163ae9fe4d | 302 | 'G','#','4', |
mmpeter | 1:48163ae9fe4d | 303 | 'A','#','4', |
mmpeter | 1:48163ae9fe4d | 304 | |
mmpeter | 1:48163ae9fe4d | 305 | 'O','5', |
mmpeter | 1:48163ae9fe4d | 306 | 'C','4', |
mmpeter | 1:48163ae9fe4d | 307 | |
mmpeter | 1:48163ae9fe4d | 308 | 'O','4', |
mmpeter | 1:48163ae9fe4d | 309 | 'G','#','4', |
mmpeter | 1:48163ae9fe4d | 310 | 'A','#','4', |
mmpeter | 1:48163ae9fe4d | 311 | |
mmpeter | 1:48163ae9fe4d | 312 | 'O','5', |
mmpeter | 1:48163ae9fe4d | 313 | 'C','4', |
mmpeter | 1:48163ae9fe4d | 314 | |
mmpeter | 1:48163ae9fe4d | 315 | |
mmpeter | 1:48163ae9fe4d | 316 | //hail to the conquering heros |
mmpeter | 1:48163ae9fe4d | 317 | 'C', '#','2', |
mmpeter | 1:48163ae9fe4d | 318 | 'O','4', |
mmpeter | 1:48163ae9fe4d | 319 | 'A','#','4', |
mmpeter | 1:48163ae9fe4d | 320 | |
mmpeter | 1:48163ae9fe4d | 321 | 'O','5', |
mmpeter | 1:48163ae9fe4d | 322 | 'C','4', |
mmpeter | 1:48163ae9fe4d | 323 | 'C','#','4', |
mmpeter | 1:48163ae9fe4d | 324 | |
mmpeter | 1:48163ae9fe4d | 325 | 'O','4', |
mmpeter | 1:48163ae9fe4d | 326 | 'A','#','4', |
mmpeter | 1:48163ae9fe4d | 327 | |
mmpeter | 1:48163ae9fe4d | 328 | 'O','5', |
mmpeter | 1:48163ae9fe4d | 329 | 'C','4', |
mmpeter | 1:48163ae9fe4d | 330 | 'C','#','4', |
mmpeter | 1:48163ae9fe4d | 331 | }; |
mmpeter | 2:49565c1ff0bf | 332 | |
mmpeter | 1:48163ae9fe4d | 333 | //the number of characters in the array |
mmpeter | 1:48163ae9fe4d | 334 | int numb=strlen(hail); |
mmpeter | 1:48163ae9fe4d | 335 | thinggy.playtune(hail,numb); |
mmpeter | 1:48163ae9fe4d | 336 | thinggy.cls(); |
mmpeter | 1:48163ae9fe4d | 337 | thinggy.printf("I win!"); |
mmpeter | 1:48163ae9fe4d | 338 | wait(3); |
mmpeter | 1:48163ae9fe4d | 339 | } |