In PHP: APU returning "Invalid node (1, 0)" on correct echo's

Doing the APU-puzzle it is returning Game information: “Invalid node (1, 0)” on correct echo’s. Even handing it fixed input like this returns that the first round (echo) is correct, but the second gives errormessage.
//output testcase horizontal:
echo(“0 0 2 0 -1 -1\n”);
echo(“1 0 2 0 -1 -1\n”);
echo(“2 0 4 0 -1 -1\n”);
echo(“3 0 4 0 -1 -1\n”);
echo(“4 0 -1 -1 -1 -1\n”);

Strange thing is that changing the order, also changes the result. Moving the second (echo 1…) and fourth (echo 3…) lines to the bottom, Game information is only showing results of the other three and says everything ok, no sign of the last two lines.
To me it looks like a bug in the APU-game. Or am I overlooking something.

Test case horizontal have only 3 nodes, how can you end up with 5 lines. (1,0) is a invalid node just as (3,0)


if this is test case 02: horizontal, then!

  • 2nd and 4th echo are wrong,
  • how can the neighbour of (0,0) be (2,0), when the 2nd echo says, there is a node (1,0), which neighbour is (2,0)

The neighbour has not to be at the next coordinate point, the neighbour is the next node on the axis and there can be empty points between two neighbouring nodes, so find the next node on the axis to find the next neighbour.

The right output for this test case was:

0 0 2 0 -1 -1
2 0 4 0 -1 -1
4 0 -1 -1 -1 -1

Thanks! All I did was misunderstand the goal. Thought you needed to return the neighbournodes for every single node… So all I needed to add was a check if the node is 0. Got it now. :slight_smile: