# [Community Puzzle] Detective Pikaptcha EP1

https://www.codingame.com/training/easy/detective-pikaptcha-ep1

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

I need help i am not sure i fully understand what i should do, is it possible to have at least a sudocode

If a tile has coordinates (x,y), its right neighbour is (x+1, y), lower neighbour is (x, y+1), left and upper neighbours are…
Each tile has a counter.
For each neighbour, If it is valid (not outside the maze) and if it is not a wall, add 1 to the counter belonging to that tile. The resulting count will be within [0…4]. Do it for every passage tile in the map.

1 Like

“Player timed out, expected 3 lines” What does it mean?
My output for 1st case is:

1322#

#2#31

12#1#

Can ‘\n’ ruins validator?)

There should be no empty lines between the 3 answer lines.

so, using
for(int y=0;y<height;y++)
{
for(int x=0; x<width;x++) Console.Write(grid[x,y]);
if(y<height-1) Console.Write(’\n’); (WriteLine works the same)
}
I cant pass validator??
Now working on change of line on the same cycle when got it.

Okay,
foreach(string str in lines)
Console.WriteLine(str);
are working better, 100% done)

so do you want us to just do:

print ("#1#")
print (“1#1”)
print ("#1#")

or work out at a code to complete each level, because i have no idea how to

Do not hard code a solution. It only solves the test cases that you can see. It cannot solve the hidden validator cases.
You need to write a code to read inputs, process data, and base on processing result to produce outputs to solve the test cases. Hopefully your code will also solve the hidden cases.

I am still confused, could you help me?

If you ask a good question many people are willing to give good answers.

“May I ask” or “Could you help” are not good questions.Try again.

Hi,
first of all: great puzzle!
I’ve already tried out several strategies to solve it (successfully), but my latest version gives me a NPE that I can not reproduce in my IDE (everything works fine there) - and CodinGame only shows me this:

at sun.reflect.NativeMethodAccessorImpl.invoke0 on line 0
at sun.reflect.NativeMethodAccessorImpl.invoke on line 62
at sun.reflect.DelegatingMethodAccessorImpl.invoke on line 43
at java.lang.reflect.Method.invoke on line 498
at com.cartser.codemachine.java.Bridge.main on line 36

and nothing else to work with.

Is it okay to post my Java code here so someone can have a look at it?

Better show us all your import lines, and the exception message about which line in your code caused an error, and also the relevant lines in your code.

there is also a report bug? about similar exception
https://www.codingame.com/forum/t/a-craft-bugs/61926/3.
You can follow suggested way to print full stack trace in a catch block.

I only import

import java.util.Scanner;
import java.util.function.IntConsumer;
import java.util.stream.IntStream;
import java.util.stream.Stream;

but yes, the bug description in your link was spot on, this is exactly what is happening to me and it also seems to be related to the streams im using.

Unfortunately, I was not able to get more of the stack trace, even though I tried wrapping each function (including main) in a try-catch and printing the trace - that didn’t change anything…

if you think it is a bug in the system, you can report it in the Discord’s “bug-report” channel, or read anything from there to see any reported issues and possible solutions.

thank you for reporting the issue. We’ll look into it.

Do I still need to file a separate bug report or is this taken care of now?

reporting like you did here was perfect. Forum or discord is fine, I check both.

I get an inconsistent testresult. Deppending on whether or not I’m using cerr to print the width, some testcases fail. First testcase with cerr message:

`Lost with exception: Wrong line length got: 6, expected: 5`

If I comment it out, the next testcases fails with the error message:
`Lost with exception: Wrong line length got: 12, expected: 9`

My code:
`Code deleted by a moderator.`