Two robots are parachuted onto a spot of a discrete number line that stretches infinitely in either direction. They are an unknown distance apart. Where they land, they drop their parachute. They begin executing the same set of instructions at the same time. Unfortunately, these are not very good robots, and they only understand commands in character form. There is only room for 10 instructions.
Possible instructions are as follows:
L: Move left one space
R: Move right one space
S: Skip the next instruction if and only if there is a parachute at my feet
0-9: Move to this position in the instructions (If the instructions are LRS1, the 1 would move the robot back to the 'R')
Every step takes the same amount of time to execute, including parachute skips and moving through the instructions. There is no variable storage. The robots begin executing from step 0. What set of instructions will result in the two robots ultimately finding each other on the infinite number line in every case? There are multiple possible answers.
Question
BMAD
Link to comment
Share on other sites
2 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.