wu :: forums
« wu :: forums - 2 Robots »

Welcome, Guest. Please Login or Register.
May 4th, 2024, 4:44am

RIDDLES SITE WRITE MATH! Home Home Help Help Search Search Members Members Login Login Register Register
   wu :: forums
   riddles
   medium
(Moderators: william wu, ThudnBlunder, Eigenray, Icarus, Grimbal, SMQ, towr)
   2 Robots
« Previous topic | Next topic »
Pages: 1  Reply Reply Notify of replies Notify of replies Send Topic Send Topic Print Print
   Author  Topic: 2 Robots  (Read 3516 times)
mad
Junior Member
**





   


Posts: 118
2 Robots  
« on: Mar 7th, 2008, 8:11pm »
Quote Quote Modify Modify

Two robots are standing on an infinitely long line at infinte unknown positions. We need to make them meet. To do so, we need to write same program for both of them using statements
MOVL (move 1 step left)
MOVR (move 1 step right)
MOV2L  (move 2 steps left)
MOVR (move 2 steps right)
MARK (make a mark at current position)
if( Mark ) //True if mark is already there.
IP Logged
Icarus
wu::riddles Moderator
Uberpuzzler
*****



Boldly going where even angels fear to tread.

   


Gender: male
Posts: 4863
Re: 2 Robots  
« Reply #1 on: Mar 8th, 2008, 7:26am »
Quote Quote Modify Modify

No negation or Else operators? No branching instructions? That will require infinitely long programs.
IP Logged

"Pi goes on and on and on ...
And e is just as cursed.
I wonder: Which is larger
When their digits are reversed? " - Anonymous
Hippo
Uberpuzzler
*****





   


Gender: male
Posts: 919
Re: 2 Robots  
« Reply #2 on: Mar 8th, 2008, 7:54am »
Quote Quote Modify Modify

It is very simillar to hole in the wall ... one of the robots will stand still mimicking the hole...
 
Yes, some variables will be helpful ... what about unmarking, conditioanl loops, branching ...
« Last Edit: Mar 8th, 2008, 7:55am by Hippo » IP Logged
rmsgrey
Uberpuzzler
*****





134688278 134688278   rmsgrey   rmsgrey


Gender: male
Posts: 2873
Re: 2 Robots  
« Reply #3 on: Mar 8th, 2008, 8:00am »
Quote Quote Modify Modify

on Mar 8th, 2008, 7:54am, Hippo wrote:
It is very simillar to hole in the wall ... one of the robots will stand still mimicking the hole...
 
Yes, some variables will be helpful ... what about unmarking, conditioanl loops, branching ...

You can't have just one robot stand still throughout - each robot has the same program...
 
I'd go for:
 
MOVL
if ( Mark ) MOV2L
MARK
 
repeated infinitely many times...
IP Logged
Hippo
Uberpuzzler
*****





   


Gender: male
Posts: 919
Re: 2 Robots  
« Reply #4 on: Mar 8th, 2008, 10:37am »
Quote Quote Modify Modify

Oops: one letter difference sAme not sOme Wink
 
And yes, your solution works well if the conditions are interpreted the way you use.  
(Suppose originaly there is sufficient number of places with no marks Wink )
« Last Edit: Mar 8th, 2008, 10:41am by Hippo » IP Logged
Grimbal
wu::riddles Moderator
Uberpuzzler
*****






   


Gender: male
Posts: 7527
Re: 2 Robots  
« Reply #5 on: Mar 9th, 2008, 6:16am »
Quote Quote Modify Modify

What is missing in the question is: how are the robots synchronized.  Do they repeat the whole program with each time tick?  Do they repeat one instruction per time tick?  If yes, is if ( ... ) ... executed in one or two ticks when the condition is true?
IP Logged
temporary
Full Member
***





   


Posts: 255
Re: 2 Robots  
« Reply #6 on: Mar 23rd, 2008, 1:24pm »
Quote Quote Modify Modify

Write this program for only one(or possibly both) robot(s):
MOVL
MOV2R
MOV3L
MOV4R
MOV5L
MOV6R...
IP Logged

My goal is to find what my goal is, once I find what my goal is, my goal will be complete.
rmsgrey
Uberpuzzler
*****





134688278 134688278   rmsgrey   rmsgrey


Gender: male
Posts: 2873
Re: 2 Robots  
« Reply #7 on: Mar 24th, 2008, 2:19pm »
Quote Quote Modify Modify

on Mar 23rd, 2008, 1:24pm, temporary wrote:
Write this program for only one(or possibly both) robot(s):
MOVL
MOV2R
MOV3L
MOV4R
MOV5L
MOV6R...

There are two problems with that program. Firstly, it uses instructions that aren't included in the initial set, which only allows for moves of up to 2 steps. Secondly, if both robots execute it at the same speed, there will always be a constant distance between them.
IP Logged
temporary
Full Member
***





   


Posts: 255
Re: 2 Robots  
« Reply #8 on: Mar 25th, 2008, 6:09pm »
Quote Quote Modify Modify

Then I suppose programming both of them wouldn't work, but programming only one of them still works. And I can still use that answer by simply rewriting it with only two steps at a time.
MOVL
MOV2R
MOV2L
MOVL
MOV2R
MOV2R
MOV2L
MOV2L
MOVL
MOV2R
MOV2R
MOV2R
MOV2L...
IP Logged

My goal is to find what my goal is, once I find what my goal is, my goal will be complete.
rmsgrey
Uberpuzzler
*****





134688278 134688278   rmsgrey   rmsgrey


Gender: male
Posts: 2873
Re: 2 Robots  
« Reply #9 on: Mar 26th, 2008, 12:45pm »
Quote Quote Modify Modify

on Mar 25th, 2008, 6:09pm, temporary wrote:
Then I suppose programming both of them wouldn't work, but programming only one of them still works. And I can still use that answer by simply rewriting it with only two steps at a time.
MOVL
MOV2R
MOV2L
MOVL
MOV2R
MOV2R
MOV2L
MOV2L
MOVL
MOV2R
MOV2R
MOV2R
MOV2L...

It's possible for the two robots to be guaranteed to meet, despite both running the same program. The key is the if command that lets the robots behave differently depending on whether they are at marked positions or not.
IP Logged
Hippo
Uberpuzzler
*****





   


Gender: male
Posts: 919
Re: 2 Robots  
« Reply #10 on: Mar 26th, 2008, 3:11pm »
Quote Quote Modify Modify

rmsgrey: Nice to see someone who is able to comment the posts in such a polite way.  Wink
I myself should ignore them not having enough mental powers to be able to ...
IP Logged
marsh8472
Newbie
*





   


Posts: 27
Re: 2 Robots  
« Reply #11 on: Sep 14th, 2012, 1:39am »
Quote Quote Modify Modify

on Mar 7th, 2008, 8:11pm, mad wrote:
Two robots are standing on an infinitely long line at infinte unknown positions. We need to make them meet. To do so, we need to write same program for both of them using statements
MOVL (move 1 step left)
MOVR (move 1 step right)
MOV2L  (move 2 steps left)
MOVR (move 2 steps right)
MARK (make a mark at current position)
if( Mark ) //True if mark is already there.

 
do until MARK
   MOVL
LOOP
do until MARK == false
    MOV2L
loop
 
They both move left until they pick up the other's trail then once the rightmost bot picks up the leftmost bot's trail, the rightmost bot moves twice the speed until it catches up with the leftmost bot.
IP Logged
Pages: 1  Reply Reply Notify of replies Notify of replies Send Topic Send Topic Print Print

« Previous topic | Next topic »

Powered by YaBB 1 Gold - SP 1.4!
Forum software copyright © 2000-2004 Yet another Bulletin Board