[Community Puzzle] Detective Pikaptcha EP2


#1

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

Send your feedback or ask for help here!

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


#2

hi. all tests pass in IDE but during validation, “trapped” test fails (?!). Pikaptcha is trapped on a cell and can’t go anywhere. If I initialize the cell with value “0”, it fails, value “1”, it fails, value " ", it fails. I can’t figure out the value awaited in this case.
Can you just tell me what is the value awaited.
Best regards


#3

Hello, I have printed out the inputs and it seems there is no pikaptcha character such as < > ^ v but only the map that consists with 0s and #s


#4

i’m getting back in shape currently on coding, so I’m training in python on easy puzzles first and I could pass all the tests here except for the last 2, I get a “stacktrace too big” error, I think because of the recursivity I use and my non-optimal code writing :sweat_smile: is it possible to give me a hint on the solution thinking ? :hugs:


#5

In the trapped cell the value is 0. All other cells’ values have to be the same as the input.


#6

Which map are you referring to? Are you dealing with EP1?


#7

When a function is called, its variables get memory allocated on the stack. And whenever the function call is over, the memory for the variables is deallocated. Declare no variable within your recursive function to avoid stack overflow.


#8

Thank you for the hint, I’ll try that ! :blush:


#9

Solution doesn’t compute after validation / it keeps loading forever…


#10

Using the online version, when it times-out it will stop your code from running forever.


#11

We had an issue with the platform. It is fixed now, you can submit again your solution.


#12

Every test passes but while submitting the Two chambers test fails. What is the validation doing differently?


#14

Hi, I’ve got a quite nasty problem with the “Many Crosses” validation. My code passes all the test in the IDE and all the other validations except that one. I have copied the map and tested my code offline and it shows the correct answer. Online however it looks like it does it’s own thing and it goes on a completely other route. Any ideas?


#15

Maybe a bug in your code, just a little bug.


#16

That would explain failing the test, but not the different reactions offline/online.


#17

I have the same problem (also my code fails “Trapped v2”). How did you copy the map?


#19

Wow, it’s really funny thing. I expected ‘down’ direction to be capital V. But it’s lowercase. And Pikachu faces ‘down’ direction only in those two validation cases. Lol


#20

I can’t thank you enough :D, now I feel stupid.


#21

Hi !
I’m having a strange problem while getting the side (‘R’ or ‘L’ input), in Python3
It only works for map #2 (Two chambers), for the others the program stop on the line “side = input()”
What is even more confusing is that if i write “print(input())” instead of “side = input()” it works, the program writes the character in the output.

Here is the concerned portion of code:
#Get the maze
for y in range(height):
----line = input()
----print(line,file=sys.stderr)
----for x in range(width):
--------c = line[x]
--------if c ==‘0’:
------------grid[x][y] = 0
--------elif c in rotation:
------------pika_o = c
------------pika_x = x
------------pika_y = y
------------grid[x][y] = 0
print(“OVER”,file=sys.stderr)
#print(input(),file=sys.stderr)
side = input()
print(“SIDE :”,side,file =sys.stderr)

Note that by replacing the assignation line with the commented one, it works. With this code, it blocks when getting the last input and times out

I’m clueless :\


#22

you program timeout, but not at the lines you’re referring. Use sys.stderr.flush() to see the proper standard error. Anyway, it seems you managed to solve it (but didn’t submit your Python solution)