[Community Puzzle] A child's play

Thank you Dwarfie for responding so quickly. While my error wasn’t related to the starting position of the robot, your comment led me to construct a series of random scenarios, one of which unexpectedly failed. This was due to a parsing error that would occur only in circumstances that do not appear in any test, but well in the final #4 validator.

I’m having issues with validator 5, and I can’t find why.
My solution takes everything into account (loop from starting positions and loop not directly from starting position) and passes all tests without any trouble. But validator 5 fails and I have no idea why…
That’s driving me crazy beacuse I can’t find any problem in my code.

If someone has the same issue or can help, that would be really nice !

The only difference between test 5 and validator 5 is the Number n of operations.

1 Like

How can you tell that’s the only difference?

Hello !
I tested my code on my IDE and the solution to this test with 14 instead of 15 is 2 2 but the validator didn’t pass.
Anyone’s got an idea about another test to do ?

Hello,
Is the answer to test 6 is right? For n=15, i will be on “4 3”. Test says otherwise. Am i missing something?
######
## . . .#
# .O#.#
# . . . .#
######

2 3 is the correct answer.

Robot moves:

2 1
3 1
4 1
4 2
4 3
3 3
2 3
1 3
1 2
2 2
2 3
1 3
1 2
2 2
2 3

1 Like

Thanks,
I took a left turn after 2 2. Repeatedly. Feels like i’m an idiot. :slight_smile:

Same for test 9 and validator 9?

Hi,
I tested simple test cases that I made and they work, but all the pre-made test case aren’t, can someone explain me what do I do wrong ?
Basically my code is:

for i in range(n):
if get_case_ahead(plateau, pos_robot, direction) == “#”:
turn_right()
else:
move_forward()

When I debug it it does the expected thing, but I have not any good test cases…

Pauloux, with love <3

Difficult to advise without knowing what you mean by “pre-made test cases” and what errors you have found. One suggestion though, is to make sure your code can detect loops, so it won’t enter into long loops and lead to timeout.

By “pre-made test cases” I mean the test cases made by the creator of the puzzle. My code doesn’t detect loop for now but for low number of n it doesn’t work anyway so I will not implement the last things if I can’t resolve the simple test cases.

What do I do wrong with my logic of “If obstacle aheah” then “turn right”, otherwise “move forward” ?

I mean I don’t know which specific cases you are failing to pass. I guess you refer to the first few cases.
Also I still don’t know what issues you have faced.
Your logic sounds correct but without the details I cannot say if you implement it correctly.
The best I can advise is that you do a debug print of your variables. You can then check which variables do not change in the way you expect them to.

Yeah I debuged but everything work as excpected :confused:
Thank you for your help and I will continue to work on it !

1 Like

I don’t understand how the robot is working. For exemple, test case 6.
map :
“# # ### #”
“# # . . . #”
“# .O# . #”
“# . . . . #”
“##### #”
We have 15 moves.
So,

  1. move forward
  2. turn right
  3. move forward
  4. move forward
  5. turn right
  6. move forward
  7. move forward
  8. turn right
  9. move forward
  10. move forward
  11. move forward
  12. turn right
  13. move forward
  14. turn right
  15. move forward

We finish at the position 2 2, but the test case is 2 3, why ?

Edit :
Wait, turning is counting as a move ?

1 Like

A move is a change in position. Turning is not a move.

2 Likes

To me, turning was considered as a move.
I finally finished this puzzle, it was fun ! However, I propose to say explicitly that turning is not a move :joy:
Thank you very much for your patience :smiley:

3 Likes

Hi everyone,
I have a problem with this puzzle. I pass all the tests successfully but my program fails at validators 5 and 6 when I submit it. So its impossible to debug…
Does anyone have a solution for me ?
Thanks

Please read the previous messages in this thread if you have not.

1 Like

Hi what do you have with this test case ?

w,h = 7,4
n=12
“###O###”
“### . ###”
“# . . . ###”
“#######”

I found (3,2) but seems wrong right ? Maybe that’s the reason why only validator 4 fails ?

Thanks.