Hi ! I would really like to see your implementation but I didn’t manage to find it, where can i found it sir ?
It’s in the C++ solutions.
The event says solution will be revealed tomorrow. I don’t know if finishing the puzzle will still be required to see the solutions?
I’m not sure about this affirmation
If that were the case, the research on all NP-complete problems would only be to find some smart reductions (and work on SAT solvers).
But I agree this could be a reasonable path to take if the reduction is not too ugly (which you sort of showed here with your solution; well done! ).
On my side, I managed to get 100% on my first submission, I got lucky with my “no luck” solution (I chose to play (-1,-1) if I haven’t found any safe cell)!
Continuing the discussion from [Community Puzzle] Minesweeper:
Monday, Feb 7, 11:00 AM - Try to solve this puzzle.
Wednesday, Feb 9, 11:00 AM - Vote for the best solutions.
Are you kidding? Two days to write the best solution?
somehow it always works differently for me. sometimes I can calculate several thousand possibilities and other times not even 200 before I get a timeout. I realize that my solution is far from optimized, but these are hard fluctuations. I also think it’s nice that it’s randomized. but a few easier examples would have been nice
took me in sum 5 ours to solve, and now i spend 3 hours to make it more nice
So you can do it
This isn’t mine but I wanted to share a cool resource for those stuck.
Are you unemployed?
8 hours is 3-4 days, not two days.
no i’am not unemployed, i do this in the evening till midnight or so. Sometimes i get a coding hype and do it on my freetime here in codingame
But tbh … i tried to style the code and now i don’t get a success … always hitting a bomb, when there is no save move anymore … damn
So, in 8 hours you made some solution, not the best.
In your situation, for cell (12, 6) you must merge cells (13, 5) and (13, 6) - they contain one mine only.
Then for cell (12, 5) you will find the mine on which you blew up. (y:x)
no 5h. … whatever. it dosn’t mater …
BUt thx for your tipp … i totaly forgott to implement such logic. That will take me some time to implement. There can’t be a bomb on 13,5 because than there is no space for the second bomb arround 12.5 cause, 12,4 is 1, means its save, but 12.6 is done as well, means no space for the second bomb. … great
- This is not medium dificulty puzzle. I believe it very hard.
- When you press “Submit” system should make 100 tests and save your solution with success rate. Succes rate means how your solution is good.
the keyword here is probability. there is actually a video for this, code examples and I even found a paper about it. But you have to optimize it very well in order not to get a timeout
I used Wave Function Collapse to solve minesweeper. Here is how I approached it
What if we have this puzzle?
? ? ? ? ?
? 1 2 1 ?
? ? ? ? ?
Can we correctly make this progress?
? ? ? ? ? . ? . ? .
? 1 2 1 ? ==> . 1 2 1 .
? ? ? ? ? . ? . ? .
First calculate all the valid possibilities
. b . b . . . . . . . b . . . . . . b .
. 1 2 1 . . 1 2 1 . . 1 2 1 . . 1 2 1 .
. . . . . . b . b . . . . b . . b . . .
There are common areas that are always safe
Encode BOMB(b) = 1 , SAFE(.) = 2 , UNKNOWN(?) = BOMB | SAFE
For each possibility you just boolean ‘OR’ the
corresponding squares together and you get
. ? . ? .
. 1 2 1 .
. ? . ? .
Only modify the unknown squares.
This is expandable up to any size board but it grows
exponentially in runtime with size. Instead use a
smaller size, such as 3x3, 4x4, 5x5 and sample parts
of a larger board. When sampling part of a board
only use the non-perimeter squares for constraining
possibilities.
? . ? . . .
? 1 3 => . 1 3
. b ? . b .
For this 3x3 patch, the “3” is on the perimeter
and so it is not part of the constraints.
Similarly, the 3 does not help the 2 reduce
any unknowns because we lack information about
what is to the right of the 3.
? . ? ? . ?
? 2 3 => ? 2 3
. b ? . b ?
This follows a concept call Wave Function Collapse that you can also find here Coding Games and Programming Challenges to Code Better
405 non blank lines of code, 245 of it is the solver, 160 of it is unit tests
Emergency exit - click on an already open cell.
Try this:
while (1) {
for (let i=0; i<16; i++) readline();
console.log(“20 7”);
}
I used this feature in my first day version to avoid the timeout.
But you need to improve your algorithm actually.
Resubmited the solution - bugs fixed, achieved a 7/10 test pass.
But the vote has already passed two days.
And I understand that it would be possible to improve the random click algorithm when a free cell is not proven.
But when?
I do not think vote is closed. So submit anyway.
Closed after 3 review.
" THANK YOU FOR YOUR PARTICIPATION!
You will receive an email at the end of the event (Sunday, February 13, 11:00 PM) that will present you with the best solutions of the event."
No luck! I submitted just before posting in the forum.