sharkdp/parachuting-robots

Allow randomize to put blue to the left of red.

Closed this issue · 6 comments

The puzzle is much easier if blue is always to the right of red. Allow randomizing to put blue on either side of red.

Thank you for the feedback.

The puzzle is much easier if blue is always to the right of red

I have to disagree. The two robots are completely identical and run exactly the same program. The only way in which they differ is that one starts on the left and the other on the right. The coloring is completely arbitrary, I just chose to color the left one in red and the right one in blue.

Apologies, you're 100% right.

No need to apologize 😄. It's still a valid suggestion to randomize the colors just for sake of visualization

I'm going to reopen this. I think my initial intention actually was to have them randomly distributed, with equal chances of red being to the left of blue or vice versa. My randomization process is flawed:

  p1 <- randomInt 0 maxRange
  delta <- randomInt 1 (maxRange - 1)
  let p2 = (p1 + delta) `mod` (2 * maxRange)

The mod part never takes effect...

I guess it should read

..
  delta <- randomInt 1 (2 * maxRange - 1)
..

well done!