[Community Puzzle] Minesweeper (old medium puzzle)

Edit: puzzle link:
https://www.codingame.com/training/medium/minesweeper

Hello,

Je suis pas spécialement un expert en démineur mais j’ai l’impression pour ne pas dire certitude que l’output de l’example est faux.

Input
6 6
4
.1???1
.11211
11…
?2…
?2…
11…

On a dans cet exemple simple 5 possibilités de mine aux coordonnées suivantes :
0-2; 0-3; 0-4; 3-0; 4-0

Si on suit les règles et l’input, l’output réponse devrait être :
0-2; 0-4; 3-0; 4-0
et non pas
0-3; 0-4; 2-0; 4-0

Des bisous,


Geff

You swapped the coordinates: column should come first.

1 Like

oh my bad, i guess i need some sleep :slight_smile:


Geff

hello, once again, i get 100% ide but only 60 % when submitting…
I don’t know if i m doing wrong.
here is a debug trace of how i found and demine, but i can’t really see my mistake.

??1..
??1..
11222
..1??
..1??

?.0..
.m0..
00122
..1??
..1??

?.0..
.m0..
00011
..0m?
..0.?

?.0..
.m0..
00000
..0mm
..0.?

?.0..
.m0..
00000
..0mm
..0.?

3 mines to look for, so the algorithm stop here

thx

I am not able to understand the test case “Hidden Mines”. I discovered the possible mine locations like the following:
(* - mines)

…122
…2**
…3*?
…2*?

But the output considers the location of two “?” also. Could you please explain why is that? Is it because no of hidden mines (nb) in input is 6?

Note: “?” at (3,4) can be replaced with number 4 and “?” at (4,4) with number 2.

Which mines to select if input is 14 for no of hidden mines (nb) for the following example?

1…1.
.2…12*
*1…11
11…
12221…11
*.*2112
???21
???.32.??
???2.??

@codybumba
in fact you can’t resolved the last two interrogations…
but you know that they are 6 mines in total (from input) in this configuration,
and you discover 4 of them,
so the last two ‘?’ must be the last 2 mines to reach 6

Does it make sense about this extra input?

it is one part of this puzzle.

I’m a bit disapointed, I thought solving this puzzle would compel me to find mines more efficiently to improve my solver for the interactive version (https://www.codingame.com/training/medium/minesweeper-1) but actually the basic check I use in the interactive version still works here and gets me 100%.
I challenged most user solutions with this very easy custom validator:

3 3
2
???
121

and almost none of them finds the mines (0 0 and 2 0), meaning most of us went lazy for this puzzle :sweat_smile:

1 Like

@pardouin this kind of pattern recognition will be useful in the next minesweeper… https://www.codingame.com/training/medium/minesweeper-1

Well, I don’t have much time to improve solutions of already completed puzzles (I’d like to complete all medium puzzles and it’s pretty long, 43% so far and I’m happy when I can grind 5% per week), but I’ll definitively give it a try later.

I see how this can be done, testing all combinations of mines in the neighboorhood of a digit and when only one of them doesn’t contradict the other digits, it’s the good one.
It seems pretty straightforward to implement but my code is already spaghetti-ish and if I want to add this properly I’d have to do a bit of cleaning before :smiley:

I assume this is why I am failing validator 4, as I believe it is timing out because it is never able to resolve this pattern. Test case 4 doesn’t have that pattern. It’s a little bit evil that it got snuck into the validator, if so.

i agree with you