Ad
  • Custom User Avatar

    Trying to solve this in C#... Simple brute method worked with sample tests, but timed out on the later test.
    So i've used the Binet formula which works fine up to n = 10 and fails at n = 100.
    I've used double to define phi, psi and sqrt(5), and to do phi^n, and apparently that starts to fail in lesser digits on the number.
    What am I missing here?

  • Custom User Avatar

    Welp, I've made a Java translation which uses double array and wondered if that was ok for the part 1, cause I'm too lazy to do extra job if it's not entirely necessary.

  • Custom User Avatar

    Why do you return string instead of just array/list?

  • Custom User Avatar

    not identical at all

    Not true. I've used my very same solution, just added the condition for '_' into one of the statements for part #1. That is 'identical' for me.

  • Custom User Avatar

    Why do you have two almost identical katas here...

  • Custom User Avatar

    +1 to solved :D

  • Custom User Avatar

    Blind4Basics, I know right. I meant that logics without combinations is not working.

    Look for 100% sure safe places

    is exactly what I meant and intended to do.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    Now 4 mines left, 1 mine hidden in ab, 1 mine hidden in cd, 2 mines hidden in fghi. e and j are the safe places

    Not really. 2 mines are hidden in the efghij and it can't be told exactly just from the opened cells, it needs to continue opening other cells and validating solution.

  • Custom User Avatar

    My bad. There should be 4 mines left, actually. Here's the original piece:

    1 1 1 1 x 2 1 1 0 0 0 0
    2 2 1 1 1 2 x 2 1 1 1 1
    x x 2 2 2 2 3 x 2 1 x 1
    x 3 2 x x 1 2 x 2 1 1 1
    

    The logics you provide... It's not a simple rule like mentioned above and needs the rest of the map to be solved till the end and then mines being counted. And this can be long and tricky, if this situation is encountered in the middle of the game, not in the end. I guess it's easier to write a substitutor which will try all the combinations of mines in the border zone, remove the invalid ones and ones which have more mines than the task is, and then look for cells being same in all solutions.

  • Custom User Avatar

    Argh, I have no idea how to render that, codeblock removes newlines and regular text isn't monospaced...

    Last rule meant if A ⊃ B & hiddenMines(A) - hiddenMines(B) == count(A - B) ⇒ A - B is mines

  • Custom User Avatar

    Welp, I'm stuck here. My solution already has logics for if A ⊃ B & hiddenMines(A) == hiddenMines(B) ⇒ A - B is safe, A and B being ? zones around opened cells. I've even gone further and implemented logics for if A ⊃ B & A ⊃ C & hiddenMines(A) == hiddenMines(B) + hiddenMines(C) ⇒ A - B - C is safe and also logics for if A ⊃ B & hiddenMines(A) - hiddenMines(B) == count(A - B) but yet I'm stuck at map #6 (I believe) in moreDifficultTests, 87 mines, 29x30. I have just 3 mines left and the area looks like

    1 1 1 1 x 2 1 1 0 0 0 0

    2 2 1 1 1 2 x 2 1 1 1 1

    x x 2 2 2 2 3 ? ? 1 ? ?

    x ? ? ? ? ? ? x 2 1 1 1

    My previous solution would did substitute here, just shoving mines in every bordering cell and then validating the combinations, and then intersecting solutions to find safe cells, but it was messy so I started over and would rather stay away from that. Is there any other logical rule I'm missing, or there needs to be a substitution part?

  • Custom User Avatar

    'Expected', not 'Excpected' q:

  • Custom User Avatar

    Btw, u got a type there.

  • Custom User Avatar

    Never mind, there was an extra newline in the end. I found that out and was going to mark issue resolved, but you were faster.
    There are no \n here because SW shrank the code.

  • Loading more items...