[Community Puzzle] Robot show

https://www.codingame.com/training/easy/robot-show

Send your feedback or ask for help here!

Created by @java_coffee_cup,validated by @Gorbit99,@Schwase and @JBM.
If you have any issues, feel free to ping them.

@java_coffee_cup yeah this puzzle makes me happy too haha

Glad that you like it.

Hello, I’m having trouble with validator 5, all tests and all other validators are OK, but not the 5th. My strategy is to always have the outer-most robots facing the other side, then next robots are facing the other way…etc ( looks like > < > < > < > < ) and I simulate twice if the number of robots is odd (changing the side of the center robot). Is my strategy correct or am I missing something?

You do not need to simulate all the combinations. Draw on a paper the lines representing the paths of the robots and you will see a nice property when two robots bump into each other.

2 Likes

In example I see an initial distance of 3 (robot in 2 and 6), and so they meet in 4; but for even distances? If robot are in 3 and 6, where do they meet, in 4 or in 5?

In this case
. . . > . . < . . .

where and when they meet?

1 Like

init distance in that case is 4

will be in the middle, 4.5

2 Likes

Just a friendly reminder to anyone who is trying brute force that this puzzle was labelled easy for a reason. Pay closer attention to the tag :stuck_out_tongue:.

2 Likes

That was exactly my thought: Oh man, why it is ‘easy’, # of possible robot facings grow exponential… I started to use my brain only after reading your post…
Excellent puzzle!

1 Like

Man, this was a physics problem I encountered quite a couple of times, nice!

For all of you trying to figure this out, think of it like this.
Imagine each robot is carrying a small cube on top of it. Every time it hits another robot, they swap cubes.
What is the trajectory of the cubes?

3 Likes

Took me 3 days to reach that “Aha!!” moment. :crazy_face: :crazy_face:

Ha ha, nice one. :slight_smile:

One could argue this is more an experiment in human psychology than a programming puzzle, though.

Creative approach, special insight to a problem, thinking out-of-the-box, seeing things in a different perspective…

People (including programmers) aspire to have these qualities.

Put down logic and algorithms for a while. Time for brain exercise.

1 Like

Well, yes. :slight_smile: I didn’t mean to say it doesn’t belong here, otherwise I would have said so.

What I meant by “experiment in human psychology” is that, if you tell people a story involving agents (here: the bots), they naturally assume these agents have some kind of identity that matters and one could say the key to the puzzle is to overcome this instinct.

And I think you – as the creator of the puzzle – would agree the specification and the example time slices were deliberately crafted to hide the underlying simplicity (there is a reason you did not include a snapshot at t = 3 s).

In any case, it made me smile. So thank you very much for your effort providing the content!

1 Like

Awesome puzzle. “They had us in the first half not gonna lie” haha

2 Likes

Wow … This is an incredible comment, i figured out everything !!! I was coding deep into a full simulation step by step for each bots… something crazy … and here you go with a simple view of mind that makes everything so simple ! …
I feel stupid lol
Thx

1 Like