There is no Spoon - Episode 1 puzzle discussion

Hey,
My code was passing all the test cases but was failing a tunnel validator too.

when you check the animation for tunnel validator I could see that it was not printing the data for the lowest level points.

I assumed that,like in all other puzzles, if the height is H then the lowest point will be either 0 either H-1. But here it is actually H as it turned out.
so if youre using a for(;;){} loop, then consider checking you actually cover all the area :slight_smile:

I usually code in C++. This kinda looks like python, but python doesn’t do i++. I think I can still read the code even though I’m not sure what language this is.

I traced through searchNextD. the First return was c.x =1 c.y =0;

My second time going through:

while (1 <= 2 or grid[0,1] is ‘0’) //go into because 1<=2 also [0,1] is ‘0’ either
if (1 == 2-1) //break out of while loop
if (grid[0,1] != ‘0’) //grid[0,1] does == ‘0’ so we won’t change x or y to -1
return c.x = 1 c.y = 0

So we started with x=0 y=0
After first pass x=1 y=0
After second pass x=1 y=0
After Third pass x=1 y=0

Your X and Y will never update because X won’t increment.
I’m not a superstar at coding, do you think I figured it out or did I get it wrong?

True. I struggled for 15 minutes until I realised I’ve switched x and y when I added the nodes in my vector. Modified it and everything went green.

What in the world is ‘invalid node’? What makes a node invalid?

Please share a link to your replay (look for the button near the lower right corner of the viewer), which may help others answer your questions.

Hi everyone, I am a bit confused here. Since nobody seems to ask this so I feel dumb asking this. I am having difficulty in understanding the coordinates in the example. They are [[0, 0],[1, 0],[0, 1],[1, 1]], for me it doesn’t make sense. If we follow i,j loop pattern then the coordinates should be [[0, 0], [0, 1], [1, 0], [1, 1]] and if we follow x,y pattern then the coordinates should be [[0, 1], [1, 1], [0, 0], [1, 0]]. Can anyone help clearing out my confusion? Am I the only one dumb here thinking that way? :sob: If so no problem I’ll learn from it and be lesser dumb next time :slight_smile:

Please help me out, I am getting frustrated

Your question is perfectly legitimate, and you aren’t dumb at all to ask it! The statement merely provides an example to show how the coordinate system works in this puzzle without explicitly explaining it… The coordinate system is usually explained in the statement for most puzzles, but alas, this puzzle isn’t doing that.

In most (but not all) puzzles on CodinGame, y-coordinates increase downwards instead of upwards while x-coordinates increase when you move to the right.

Hope this clarifies things and helps you out.

Thanks a lot @5DN1L for the clarification. Just because of the lack of explanation regarding the coordinates in this puzzle, it took me a lot more than it should. For me, this puzzle is simple and I’d have done it in 5mins max, but just because of this confusion it took me a lot of debugging in understanding the coordinates.

(-1, -1) is not to the right of (0, 0). Expected (2, 0).
Hello, i have this error, but the right of (0,0) is (1,0), am i right?

You’re right only if there’s a node at (1, 0). The task is to find the nearest neighbour (to the right or down below) where there’s a node.

1 Like

same here I think this platform doesn’t support basic C++ features. try your code on difference code editor mine works fine on any other editor. it’s the site problem

What basic C++ features are you referring to?

It’s entirely possible to solve this puzzle using C++.