http://www.YouTube.com/watch?v=E1wt5ywUo9M
De Lego-code (ontworpen in Bricx Command Center):
#define power 75
#define downTime 200
#define upTime 200
#define TimePerTarget 2000taak main()
{lang draaien; / * de variabele voor opname hoek * /
lange nothit;
int welke;
int m;
int score;
lange tijd, time2;TextOut (0, LCD_LINE2, "Hoek op PortA");
Score = 0;
TextOut(0,LCD_LINE7,"Score:");
NumOut(40,LCD_LINE7,score);terwijl (waar) {}
OnFwd(OUT_ABC,Power);
Wait(DownTime);
Off(OUT_ABC);Wait(2000);
welke = Random(3);
NumOut(0,LCD_LINE4,welke);Als (welke == 0) {m = OUT_A;}
Als (welke == 1) {m = OUT_B;}
Als (welke == 2) {m = OUT_C;}OnRev(m,Power);
Wait(UpTime);
Off(m);Wait(400);
nothit = MotorRotationCount (m);
draaien = nothit;
NumOut(0,LCD_LINE6,nothit);tijd = CurrentTick();
terwijl (nothit == draaien) {}
draaien = MotorRotationCount (m); / * Lees Motor hoek [deg] * /
TextOut (0, LCD_LINE5,"");
NumOut(0,LCD_LINE5,rotate);
TextOut(40,LCD_LINE5,"deg");Als ((time+TimePerTarget) < CurrentTick())
{draaien = draaien + 10;}}
OnFwd(m,Power);
Wait(DownTime);
Off(m);Score = score + 1;
TextOut(0,LCD_LINE7,"Score:");
NumOut(40,LCD_LINE7,score);}
}