Secondary menu

Search form

Mad robot

Submitted by Marianne on October 22, 2012

A mad robot sets off towards the North East on a journey from the point (0,0) in a coordinate system. It travels in stages by moving forward and then rotating on the spot. It follows these pseudo-code instructions:

Comments

the bot should make logbase2 1000 moves, which is 10 when the ceiling function is used. the robot starts facing north and goes 1000 steps, it then proceeds to go 500 east, 250 south, 125 west, 62.5 north, 31.25 east, 15.625 south, 7.8125 west, 3.90625 north, 1.953125 east. this means that it has gone 1000 - 250+62.5-15.625+3.90625 = 800.78125 north and 500-125+31.25-7.8125+1.953125 = 400.390625 east. this means, via pythag, that the robot has traveled 895.301 to 3dp. he has also gone overall in a direction of 26.57 degrees true.

I'd rather prefer a more geometrical approach... For example: let F_1 be the figure formed by the first 4 segments of the robot's journey, F_2 be the figure formed by the segments 5th to 8th , and so on. It is easy to see that a certain (fixed) homothety of center, say, P transforms each F_i into F_{i+1} ; furthermore, P is the intersection of two perpendicular lines r and s which can be found by observing carefully F_1 and F_2 . At the end of each stage, the robot is either on r or on s , and closer and closer to P ... Completing this argument will give you an elegant solution to the problem!

Let's rotate the walk of the mad robot 45 degrees to the left. So it walks up or down along the y-axis and to the right or left along the x-axis. Each time the robot turns 90 degrees it steps forward half the previous step. After the 21e step it stops, because that step is smaller than 0.001. But to calculate easily we let the robot go on forever, after all it doesn't go forward anymore (the steps are too small) and only turns around its axis (it really is a mad robot). Upwarts along the y-axis the robot walks 1000(1 + 1/2^4 + 1/2^8 + ....). An infinite geometric series between the parenthesis. The result is 1000 x 16/15. Downwarts along the y-axis:
250(1 + 1/2^4 + 1/ 2^8 + ...) = 250 x 16/15. The total walk along the y-axis is also 750 x 16/15 = 800. Along the x-axis, the robot starts with 500, so the covered way along the x-axis is 400, half the covered way along the y-axis. Therefore, the robot reaches the point (400,800). But remember, initially we did rotate its walk, so we have to rotate back 45 degrees. The final destination of the mad robot is (600√2,200√2) or (849,283).

I have solved this by using scratch programming however I had to set the distance to 100 otherwise it wouldn't work. I also divided the minimum distance by 10 and my answer was(84.9,28.3) which is equivalent to (849,283) after multiplying by 10.

Our digital lives rely on distributed computer systems, such as the internet, but understanding the order of events in such systems is not always straightforward. Leslie Lamport explains how special relativity helped him order events in computer science, enabling the development of distributed computing.