# [Community Puzzle] Fractal Image Recognition

https://www.codingame.com/training/medium/fractal-image-recognition

Created by @CSGO_BOT,validated by @DaNinja,@Smelty and @KAbel.
If you have any issues, feel free to ping them.

The stub is faulty: It reads βimageSizeβ chars per line, but input contains twice as much because of the separating spaces.

I think the best would be to just read it cell by cell:
`loop imageSize loopline imageSize pixel:int`

1 Like

I donβt understand these instructions,

" To place a fractal to the north (β3β) of pixel P , pixels β9β, β5β, β3β, β4β, β2β around pixel P must be empty.
To place a fractal to the northeast (β4β) of pixel P , pixels β5β, β3β, β4β, β2β, β7β around pixel P must be empty." .

When I put the northeast(β4β) of pixel P (for the first extremum (1, 6)) , the fractal in the north (β3β) canβt be empty 'cause there will be near each other (north and northeast) of the extremum.

And in the place of the result example, why we hadnβt :

0 0 0 0 0 5 3 4 0 0
0 0 0 0 0 0 1 0 0 0
0 0 0 0 0 1 1 0 0 0
0 0 0 0 1 0 1 0 0 0
0 0 9 1 0 0 1 0 0 0
0 0 8 6 7 0 1 0 0 0
0 0 0 0 0 0 1 0 0 0
0 0 0 0 0 0 1 0 0 0
0 0 0 0 0 0 1 0 0 0
0 0 0 0 0 8 6 7 0 0

Because you also need to have

at least 5 consecutive empty (β0β) spaces around it.

For example, the 5 youβve placed at the top has only 4 consecutive empty spaces around the 1 pixel, so the 5 cannot be placed there.