There is no Spoon - Episode 1 puzzle discussion

I now understand what we need to do, Thanks !!!

1 Like

Hi, I am having an issue with the “Tunnel” validator. I have checked my code in 2 different IDEs and the output comes correctly, however this compiler keeps giving an error. Does anyone have any fixes for this?
Here is my code:

Code deleted by a moderator

Please be more precise about your issue, and don’t drop your full code publicly.

Sorry about that. The website shows that my program fails the “Tunnel” validator at node (0,4), however I verified my program with this validator in 2 seperate IDEs with the correct output.

It seems your code doesn’t pass all tests in the IDE. I recommend getting 100% in the IDE before trying to validate the puzzle.

How come the same code would work but then if you test it again on the same test cases it doesn’t work? Btw, my code is simple looping through the 2D array and checking the right and bottom of each node that contains the ‘0’.

Edit: The problem was fgets, it wasn’t performing as fast as scanf I guess, so I changed fgets to scanf and all the tests are working perfectly.

I’m having trouble reading in the data, seems like a bug. Tackling this in Python3.

width = int(input())  # the number of cells on the X axis
height = int(input())  # the number of cells on the Y axis
grid = []

for y in range(height):
    grid.append(list(input()))
print(grid)

So I’m clearly reading in all available data before doing anything, and yet I get this warning:

Warning: your code did not read all available input before printing an instruction, your outputs will not be synchronized with the game's turns and unexpected behaviour may occur.

Am I missing something, or is it buggy?

hellooo friend, your code passes the test in local, i guess there is somthing wrong with the tests in codingame

So the IDE tests pass 100% but when I submit the code I got two tests wrong - Broken Square and Tunnel. When I test them on my local machine it feels that everything should be fine.
INPUT grid for Broken Square (that’s how I believe it looks like):

broken_sq = [[‘0’, ‘.’, ‘0’, ‘0’, ‘0’], [‘0’, ‘.’, ‘.’, ‘.’, ‘0’], [‘0’, ‘.’, ‘.’, ‘.’, ‘0’], [’.’, ‘.’, ‘.’, ‘.’, ‘.’], [‘0’, ‘.’, ‘0’, ‘0’, ‘0’]]

OUTPUT from my code:

‘0 0 2 0 0 1’
‘2 0 3 0 -1 -1’
‘3 0 4 0 -1 -1’
‘4 0 -1 -1 4 1’
‘0 1 -1 -1 0 2’
‘4 1 -1 -1 4 2’
‘0 2 -1 -1 0 4’
‘4 2 -1 -1 4 4’
‘0 4 2 4 -1 -1’
‘2 4 3 4 -1 -1’
‘3 4 4 4 -1 -1’
‘4 4 -1 -1 -1 -1’

Why is this still showing as fail?

An example of wrong output: 2nd line should be ‘2 0 3 0 2 4’ instead of ‘2 0 3 0 -1 -1’ :wink:

1 Like

Thank you. No sure why but I’ve assumed in the code that the nodes would be not more than two spaces away from each other where in the end the only limit was the grid size.

Hi, I am making the coding in C, and my code does not pass Tunnel test. Since I cannot trace Tunnel test, I cannot see what my code is doing… All I can see in Debug mode is that it does not even start to connect the dots. Perhaps there is a failure in the tester? Thank you very much!

Are you able to share your replay, the link of which can be found by clicking RESULTS and then DETAILS and then REPLAY AND SHARE?

Of course! As you can see, it does not even start: Coding Games and Programming Challenges to Code Better

Other cases are successful, like: Coding Games and Programming Challenges to Code Better

Thank you very much!

If you click “…” at the bottom of the replay, you can see that the error message is “Invalid node: (1, 0).” So it looks like you have output an invalid move.

Thanks a lot! I’ll check it

I cannot understand the failure… My code checks if the node is a ‘0’, it cannot print (1,0) because it does not even enter! Moreover, it works in all other test cases, what makes this case special? I would like to be able to see the stderr, is it possible?

It’s not special. As you are able to see what the inputs are from the replay, I think you may have to walk through your code manually to pinpoint the issue.
P.S. I have tried to find a way to stderr to the replay but I have not found any way to do so yet.

Bonjour,

j’aimerais savoir si c’est moi qui débloque, en prenant chaque ligne j’obtiens [, 00] ce qui m’interpelle c’est qu’il y a 2 lignes et donc l’index 0 est vide et je ne comprend vraiment pas pourquoi je n’ai pas [0.,00]. si vous tentez de le résoudre maintenant avez-vous ce genre d’erreur ? Je le fait en java.

The main problem is that the coordinates here are opposite to the index of the list, so you can arrange them in a list’s style first, and then invert the coordinates before output.