Skip to content

Instantly share code, notes, and snippets.

@newton-migosi
Created March 8, 2018 11:49
Show Gist options
  • Save newton-migosi/07a569fc3ca4fefde9fe28c09c88340f to your computer and use it in GitHub Desktop.
Save newton-migosi/07a569fc3ca4fefde9fe28c09c88340f to your computer and use it in GitHub Desktop.
My solution to the picobot problem at https://www.cs.hmc.edu/picobot/
# State zero, move north if nothing to north else move west
0 x*** -> N 0
0 N*** -> X 1
# Move west state
# If nothing to the west move West
# If end of row move south then east
# If at top left corner move East
# If at bottom left corner do nothing
1 **x* -> W 1
1 x*Wx -> S 2
1 NxWx -> X 2
1 xxWS -> X 1
# Move east state
# If nothing on the East move east
# If end of row move south then west
# If bottom right corner do nothing
2 *x** -> E 2
2 *E*x -> S 1
2 *E*S -> X 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment