//CC6 - "Simon Says" /*definition 3 | 2-bl-gr | | 1-ye-gy */ #define showtime 50 #define limit 739 #define levelmax 26 #define __NOTETIME 10 #define __WAITTIME 12 int level=1,l,idle, simon[levelmax], taste, highscore=0, z; task main () { //init SetSensorType (SENSOR_1, SENSOR_TYPE_TOUCH); SetSensorType (SENSOR_2, SENSOR_TYPE_TOUCH); SetSensorType (SENSOR_3, SENSOR_TYPE_LIGHT); SetSensorMode (SENSOR_1, SENSOR_MODE_BOOL); SetSensorMode (SENSOR_2, SENSOR_MODE_BOOL); SetSensorMode (SENSOR_3, SENSOR_MODE_RAW); idle=1; SetUserDisplay(highscore,0); //the spiral of live... while(true) { //idle! while (idle==1) { if (SENSOR_1 == 1 || SENSOR_2 == 1) idle=0; } //simon's ideas... for (l=0;l limit && z == 0) { taste = taste - 1; z=1; } } while (SENSOR_1 == 1 || SENSOR_2 == 1); if (taste!=simon[l]) { //bad kitten... PlayTone(44,2*__NOTETIME); Wait(2*__WAITTIME); PlayTone(44,2*__NOTETIME); Wait(2*__WAITTIME); idle=1; l=level; } else { //lucker!! PlayTone(1865,4*10); Wait(4*12); } } if (idle==0) { //lucker deluxe!! PlaySound (SOUND_DOUBLE_BEEP); if (level > highscore) { highscore = level; PlaySound (SOUND_FAST_UP); } level=level+1; Wait(100); } } } //the death... } void showme (int color) { if (color == 0) OnFwd(OUT_A); //blue if (color == 1) OnRev(OUT_A); //green if (color == 2) OnFwd(OUT_C); //yellow if (color == 3) OnRev(OUT_C); //grey Wait(showtime); Off(OUT_A+OUT_C); }