# [Community Puzzle] A mountain of a mole hill

https://www.codingame.com/training/easy/a-mountain-of-a-mole-hill

Created by @Humanosaure,validated by @IAmNoob,@TBali and @WINWINWIN.
If you have any issues, feel free to ping them.

Why is this thing in easy section??

6 Likes

Because itâs a simple flood fill?

1 Like

I did use a âsimple flood fillâ, but I guess you would agree that cases with nested gardens and/or moles everywhere introduce some complications one has to think through. Also, there are solutions that are much neater than flood fill; finding these requires a bit more thinking. Some of the puzzles in the easy section are borderline trivial, so I can at least understand why someone might wonder whether this is the right category.

4 Likes

I agree with docri that it is more complex than it looks. Quite at the upper edge of âeasyâ. Or 'medium â would have been also appropriate.
But it is exactly these âmatryoshka-styleâ and âfull-of-holes-without-grassâ test cases, which make this puzzle interesting.

I am not sure that the [3,13] (0 based) corner(+) in the ZzzzzâŠ test is necessary, and it introduce an error in my simple solution

1 Like

@ivon Indeed, corrected (as well as the associated validator).

diff
``````+--------------+        +--------------+
|    o       o |        |    o       o |
+----------+  ++        +----------+  ++
..........++ ++.        ..........++ ++.
....o....++ ++..        ....o....++ ++..
........++ ++...        ........++ ++...
.......++ ++....        .......++ ++....
.oo...++o++...o.        .oo...++o++...o.
.....++ ++......        .....++ ++......
....++ ++.......        ....++ ++.......
...++ ++....oo..        ...++ ++....oo..
..++ ++....o....        ..++ ++....o....
.++ ++..........        .++ ++..........
++o++----------+      | ++o +----------+
|       o      |        |       o      |
+--------------+        +--------------+
``````

Not easy at all. Rather medium.

6 Likes

Hi, beginner here. I am having issues with the last 3 test cases, and itâs generally due to the way I try to find the starting point for the floodfill algorithm

Any advice or high-level psuedo code to identify where i should start my floodfill?

Add two lines full of dots, one at the start, one at the end.
Add also a dot starting each line and another one ending each line.
It may help.

4 Likes

Thanks, was a big clue

1 Like

Hello , I have issues with my two last cases , someone can help me ? o guide me?

What are the issues ? (I didnât check the puzzle)

I did a solution that works and it pass all validations but âThe Boss Validationâ, anyone know whats that ?

It is very similar to the âHow did THAT happen?â IDE test.
It has a fence part shaped like this, which the IDE test counterpart does not have:

``````...-+oo
...o+-+
...ooo|
``````

Ok, so : i thought it didnât belong to EASY, but in fact, you donât even need to implement floodfill, I managed to compute each line separately (except for â+â where you just need adjacents cells), with just 2 flag toggling.

1 Like

it is easier than it seems. Figuring out the problem is harder. Maybe you can look around to see if youâre inside? You know just look up,down,left and right. Do some counting check for trick counts.

1 Like

nice puzzle ! finally get it by flooding and suppressing couch of wall 1 by one with a flag inside/outsideâŠ
but rather medium than easy!

1 Like

I was wondering if it is possible to solve it using regex.
I almost sure it is not possible because of this:
âÂ±+oÂ±+â it can be both outside and inside, you cant tell because there are no verticality in the string. I was trying to do vertical/horizontal verification by rotating matrix, however there was multiple fault detections on last test.
If you wish to try regex here is my last itterations â[|+][^|+\n]+[|+]â.
Maybe you can make vertical verification work by adding borders around original map and reversing match result. I was able to past 7/8 tests with this aproach.
Solving this puzzle using regex will be swaggest solution imho

1 Like

``````ooooo