[Community Puzzle] A mountain of a mole hill

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

Send your feedback or ask for help here!

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

Not well defined task.

ooooo
-----
ooooo
-----
ooooo

Answer can be 5 and 10.