Created
November 15, 2018 23:47
-
-
Save crabdancing/0e003f39956cecce4c57d3511beb19bf to your computer and use it in GitHub Desktop.
Random Walk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyleft (C) Alexandria Pettit GNU GPLv3 | |
# Very very crude random walk program. | |
# For use with NXT-powered robots with standard motor to port wiring. | |
task main() | |
{ | |
while (true) { | |
switch (Random(3)) { | |
case 0: | |
OnFwd(OUT_C, 100); | |
OnFwd(OUT_B, 100); | |
break; | |
case 1: | |
OnFwd(OUT_C, 100); | |
OnFwd(OUT_B, -100); | |
break; | |
case 2: | |
OnFwd(OUT_C, -100); | |
OnFwd(OUT_B, 100); | |
break; | |
case 3: | |
OnFwd(OUT_C, -100); | |
OnFwd(OUT_B, -100); | |
break; | |
} | |
Wait(1000); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment