Skip to main content
clarify L,R not in-place turns
Source Link
Karl
  • 871
  • 4
  • 14

You're driving along a streetcar in an infinite city whose blocks are pentagons arranged in the order-4 pentagonal tiling. At each step, you proceed to the next intersection and choose whether to go eithercontinue left, right, or straight. A sequence of choices that returns you to your initial state (street segment and direction) is called a round trip.

Write a function (or program) that takes a string of L/R/Ss and returns (or outputs) one of two values, indicating whether the input represents a round trip.

Examples:

LLLLL -> yes (this is a drive around one pentagonal block) LLLLSRRRRS -> yes SRRSRRSRRSRR -> yes (empty sequence) -> yes R -> no LLLLLL -> no (starts with a round trip but leaves initial state) SLLLLR -> no (returns to initial street but opposite direction) 

(Note that L and R are not in-place rotations; every move includes entering and exiting the next intersection.)

You're driving along a street in an infinite city whose blocks are pentagons arranged in the order-4 pentagonal tiling. At each step, you proceed to the next intersection and choose to go either left, right, or straight. A sequence of choices that returns you to your initial state (street and direction) is called a round trip.

Write a function (or program) that takes a string of L/R/Ss and returns (or outputs) one of two values, indicating whether the input represents a round trip.

Examples:

LLLLL -> yes LLLLSRRRRS -> yes SRRSRRSRRSRR -> yes (empty sequence) -> yes R -> no LLLLLL -> no (starts with a round trip but leaves initial state) SLLLLR -> no (returns to initial street but opposite direction) 

You're driving a car in an infinite city whose blocks are pentagons arranged in the order-4 pentagonal tiling. At each step, you proceed to the next intersection and choose whether to continue left, right, or straight. A sequence of choices that returns you to your initial state (street segment and direction) is called a round trip.

Write a function (or program) that takes a string of L/R/Ss and returns (or outputs) one of two values, indicating whether the input represents a round trip.

Examples:

LLLLL -> yes (this is a drive around one pentagonal block) LLLLSRRRRS -> yes SRRSRRSRRSRR -> yes (empty sequence) -> yes R -> no LLLLLL -> no (starts with a round trip but leaves initial state) SLLLLR -> no (returns to initial street but opposite direction) 

(Note that L and R are not in-place rotations; every move includes entering and exiting the next intersection.)

Became Hot Network Question
accept & improve suggested edit adding decision problem tag
Link
Karl
  • 871
  • 4
  • 14

Detect round trips on the order-4 pentagonal tilinga hyperbolic grid

Source Link
Karl
  • 871
  • 4
  • 14
Loading