Filippo Vitale
June 20, 2012
120

# A Robot path problem – SydJS June 2012

A Robot path problem helped me realise I still love JavaScript
Project Euler 208 – https://projecteuler.net/problem=208

June 20, 2012

## Transcript

JavaScript

4. ### One-minute Rule "My program takes days to get to the

answer!" Each problem has been designed according to a "one-minute rule", which means that although it may take several hours to design a successful algorithm with more difficult problems, an efficient implementation will allow a solution to be obtained on a modestly powered computer in less than one minute.

7. None

9. ### Project Euler - Problem 208 A robot moves in a

series of one-fifth circular arcs (72°)
10. ### Project Euler - Problem 208 A robot moves in a

series of one-fifth circular arcs (72°) with a free choice of ▪ a clockwise or ▪ an anti-clockwise arc for each step but no turning on the spot.
11. ### Project Euler - Problem 208 One of 70932 possible closed

paths of 25 arcs
12. ### Project Euler - Problem 208 Given that the robot starts

facing North: How many journeys of 70 arcs in length can it take that return it, after the final arc, to its starting position? (Any arc may be traversed multiple times) http://projecteuler.net/problem=208
13. None

moves:

19. None

27. None

33. None
34. ### Move left, move right Model: • Move = { L,

R } • StateI = ( x, y, heading ) StateI
35. ### Move left, move right Model: • Move = { L,

R } • StateI = ( x, y, heading ) • StateII = ( lx, ly, rx, ry ) StateI StateII

42. ### Move left, move right How can we rotate a point

on a plane? http://www.wolframalpha.com/input/?i=%7B100%2C+0%7D+72%C2%B0+rotation
43. ### Move left, move right How can we rotate a point

on a plane? http://www.wolframalpha.com/input/?i=%7B100%2C+0%7D+72%C2%B0+rotation http://www.wolframalpha.com/input/?i=with+center+%7B-50%2C0%7D+rotate+72+deg+%7B50%2C0%7D

49. None

52. None

3 4
54. ### ABCDE Model A B C D E 0 1 2

3 4 heading 0 1 2 3 4
55. ### ABCDE Model A B C D E 0 1 2

3 4 heading counter 0 1 2 3 4 http://jsbin.com/oyifem/edit#preview
56. None

69. None

JavaScript