POV-Ray : Newsgroups : povray.off-topic : Interesting interview questions : Re: Interesting interview questions Server Time
4 Sep 2024 21:22:43 EDT (-0400)
  Re: Interesting interview questions  
From: scott
Date: 21 Jan 2010 02:52:43
Message: <4b5807cb$1@news.povray.org>
> You have an infinitely long line. Two robots are dropped on parachutes 
> onto the line at random, and each drops its parachute (leaving it behind) 
> where it lands. Your task is to crash the two robots into each other.
>
> Each robot runs the identical program starting at the beginning, and the 
> parachutes are identical, and they are in all ways identical other than 
> where they land, which is random.
>
> You have the following instructions available for programming the robots:
>
> Move the robot one step left.
>
> Move the robot one step right.
>
> Move the instruction pointer to a particular instruction (i.e., "goto")
>
> Skip the following instruction if you're standing on a parachute.

Wow that's a good one.

Given that both programs are identical, you'll need to use the fact that the 
only difference in the "input" is that one robot has another parachute to 
his left, and one has another parachute to his right.

Something like this should work (I think):







(spolier space)


















.slow_loop
Move left
Move right
Move left
Skip_next_if_parachute
Goto slow_loop

.fast_loop
Move left
Goto fast_loop


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.