Welcome to BrainDen.com - Brain Teasers Forum

 Welcome to BrainDen.com - Brain Teasers Forum. Like most online communities you must register to post in our community, but don't worry this is a simple free process. To be a part of BrainDen Forums you may create a new account or sign in if you already have an account. As a member you could start new topics, reply to others, subscribe to topics/forums to get automatic updates, get your own profile and make new friends. Of course, you can also enjoy our collection of amazing optical illusions and cool math games. If you like our site, you may support us by simply clicking Google "+1" or Facebook "Like" buttons at the top. If you have a website, we would appreciate a little link to BrainDen. Thanks and enjoy the Den :-)
Guest Message by DevFuse

Robots on an infinite number line.

Best Answer Rainman, 20 November 2013 - 06:54 PM

Spoiler for five characters

Go to the full post

2 replies to this topic

Senior Member

• Members
• 1696 posts
• Gender:Female

Posted 20 November 2013 - 06:15 PM

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.

• 0

#2 Rainman

Rainman

• Members
• 143 posts

Posted 20 November 2013 - 06:54 PM   Best Answer

Spoiler for five characters

• 0

#3 Pickett

Pickett

Senior Member

• Members
• 541 posts
• Gender:Male
• Location:40°N 83°W +/-10'

Posted 20 November 2013 - 07:26 PM

Spoiler for Fun little programming problem...

Edited by Pickett, 20 November 2013 - 07:28 PM.

• 0

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users