Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
I stranded at 49 :)
edit: 47 \o/
I'm stuck at 52 :( Feeling ready to give us and not find the solution... I'm not sure if it's a trick with regex or something in the counting that I could be doing different!...
This comment is hidden because it contains spoiler information about the solution
Now I understand why you were "so insistant" to have all the "0" uncovered in the initial grid... ;)
With "real game approach", it would look like this:
@pianowow, @Balkoth
Perhaps this one should use a special logic, I named it "corner logic":
If corner is ?, then this corner has at least 1 mine.
(It can not using in the real game)Well, let's say that sometimes you have to search where the mines could be... And sometimes you should search where they could not be too...
I hope it helps. ;)
Hi, can you elaborate on that test 17 ?
It is the only test I fail, and I don't understand how you would solve it using logic.
You should improve the way you check the different possible combinations and what you could do considering the whole bunch of them ;)
Ok, glad you find it (and that my code isn't wrong! :) )
Be strong! ;)
(I hope you didn't try with the erroneous codes I posted in the message before? Sorry if that is the case :-/ )
Hi,
Interesting one...
Seems to me it shouldn't be solvable. Could you explain the steps you used to get there?
To avoid any troubles, please do the following:
past that in the sample tests and execute it:
gamemap = """
0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1
0 0 0 0 0 0 0 1 1 1 0 0 0 1 ? 2
0 0 0 0 0 0 0 1 ? 1 0 0 0 1 2 ?
0 0 0 0 0 0 0 1 1 1 0 0 1 1 2 1
0 0 0 1 2 2 1 0 0 0 0 0 1 ? 1 0
1 1 1 2 ? ? 2 2 1 2 1 1 1 1 1 0
? ? 2 ? ? 4 ? 2 ? 2 ? 1 0 0 0 0
1 1 2 ? 3 ? 2 2 1 2 1 1 0 0 1 1
0 0 1 1 2 ? 1 0 0 0 0 0 0 0 1 ?
""".strip()
result = """
0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1
0 0 0 0 0 0 0 1 1 1 0 0 0 1 x 2
0 0 0 0 0 0 0 1 x 1 0 0 0 1 2 x
0 0 0 0 0 0 0 1 1 1 0 0 1 1 2 1
0 0 0 1 2 2 1 0 0 0 0 0 1 x 1 0
1 1 1 2 x x 2 2 1 2 1 1 1 1 1 0
1 x 2 3 x 4 x 2 x 2 x 1 0 0 0 0
1 1 2 x 3 3 2 2 1 2 1 1 0 0 1 1
0 0 1 1 2 x 1 0 0 0 0 0 0 0 1 x
""".strip()
game.read(gamemap, result)
makeAssertion(solve_mine(gamemap, game.count), "")
It will display a fail, but what interest me is what your code will return.
if you find a way to solve the one above, could you explain how you do it? (Remainder, just in case: you should open a square only if you are 100% it's safe)
your code should be able to get from the original grid to the one below. Make sure that it is the case, please (if it's not, then the problem lays on your side and you made a "wrong but successful" guess somewhere in your execution, I think. Unless you can explain the thing. ;) ):
0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1
0 0 0 0 0 0 0 1 1 1 0 0 0 1 x 2
0 0 0 0 0 0 0 1 x 1 0 0 0 1 2 x
0 0 0 0 0 0 0 1 1 1 0 0 1 1 2 1
0 0 0 1 2 2 1 0 0 0 0 0 1 x 1 0
1 1 1 2 x x 2 2 1 2 1 1 1 1 1 0
? ? 2 ? ? 4 x 2 x 2 x 1 0 0 0 0
1 1 2 x 3 ? 2 2 1 2 1 1 0 0 1 1
0 0 1 1 2 ? 1 0 0 0 0 0 0 0 1 x
Waiting for news!
OK. disabled ;-)
Thanks, I'll disable that ;-)
Thanks. It's not really fast code but it looks nice :) Wonder how noone else solved your kata yet. One tip: would be nice to add random tests...
Well, yes, golfing is an entirely different kind of challenges :P, but IMO so far the One Line Task katas have been pretty self-contained to not require too many tricks per kata.