Ad
  • Custom User Avatar

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

  • Custom User Avatar
  • Custom User Avatar

    Thank you very much, I missed the case for ... /*.... /*.... */... which was not handled

  • Custom User Avatar

    hello there

    I am having a bit of trouble with this kata (java)

    Some of the tests fail and I can't explain why, but I did get one failure which I think was wrong

    It has to do with comments, my code is throwing a exceptions while yours is not, and I believe this might impact the other tests (I get about 15 to 20 test failures for the whole test suite with wrong output)

    The example I have is this:

    //p8pp4qpqF8p374qp5qqqL4R4FPLF4RF7PRL9L2FL
    //L1L8L4p7FFLFLp0FpqLLFR3qp374p0qRF2F4R6R3()5L6FpqqPP(PFR8P)RR(F)5q
    R1(RFR7F(F5))R5FR4((RR6F8P4)2((()2F6/**/)6RLLL2)2(F5/*RF*/)P9)8LF(F6P7F)1F//F(F7PP)6LRR((R()P)F2)p0PL9LqLLFRL(RF9RF)8PL0
    P5P9F(L2)7R//LRPPpp4p1qp850qqPL8p3pqL()PL1R9qqp0p9p0qqF1R1R6q(F9)F3(P(F6R0)F6)3
    L5F2FP6Fp0F//FFP4FFF6Fp9()F0()6F2p5qp0qR()RRFqF8R2
    FR7qp4p0(R1F()7)FR(F1)6Rp5p374qL0/**/L0FFF0qq(LFR)L5RF0//RR(F9RL)R5FF7R3RL2
    R7P0FqLFL3(F4)F0L2L4F3L2Fp5L//P7RR4R
    FF/*pp7qRFPF7()qRFP9R0*/R(F)p2(()R9L())8L3LL/*()5PL7LF6()L*/p9LFL1R0RF7L2F/**/R/**//**//**/LFL8R1L8qP5RqP9qF/*p0LRR6FF6RL9PRPL0LF1PL0Fqp5Pp893F8F2q(R0)R1RF9(PFL8)(P)LF(FR3FFR4)qF1FPF*/L3R5//F6F5R0LL6L5PF((FF))RpF0PFF2p9p6qF3F6()4F()8RRLqFR8Rq
    RL5(L8)LL8P5P4RF(RR4)RLp6p3(P7LF1F)8L8FFFL3//p708qLF()7
    (P9P7R8)7P0LqP4RR3L3(//P0F7P4
    R)8/*p9PF4PPLR6F9L7q*/L/*F8F*/LqFP7FR/*PL9R0p5pR()4F1qqp769R2RR7L6LR9(()F0L6())(R5)q*/P0F((/*p7q*/R)3(P7))F(R0L7FRL)R2L9L(RF(L1L(FRL3)FP9)/*pF8L4LL7qR7F8F7p4L4R8L2RF6RFqF0*/)F6R6(((R7/**/)F0/*FL7RR6L9LL4P*/)/*(()LL9F)Fp4p0qp6qp4qL2R8qR4pp7qp0qq*//*(R1PF6)FFR9R3p374L6p8q()0()PR1F1R6FF6q*/)8L4p7/*F2LF1R7P7RF(R6F4//L2L0LR8RF6F7L3p9q
    R)6P4p5F0F(R6RF)RF4P4RP9FR7LRF1F8R2(R5F)R7FFF1(//
    //
    F5)Rq/*RF8R(R)R9RF3Lp374F6()FL6Fq*/RLL3p7p708()5LF5F4()RFR1RR5RLqqqp9/*R4R*/R9(FRR4F9L6)0R3(R4)1F/*F6*/(//LF4R3Fpq
    (//
    R)7LF9)0RFF4L0P6FqP0LL2LP9L/*F7LL3LR9(R5F)8(LPL3L2)2(RLLL)5RF(PR6L5)8Fp9FLq(F2P)((LL9)L9LRL9)PF5(F8F8LL6R)*/FRF1L4F7
    

    for which my code removes the comments like so:

    R1(RFR7F(F5))R5FR4((RR6F8P4)2((()2F6 )6RLLL2)2(F5 )P9)8LF(F6P7F)1F
    P5P9F(L2)7R
    L5F2FP6Fp0F
    FR7qp4p0(R1F()7)FR(F1)6Rp5p374qL0 L0FFF0qq(LFR)L5RF0
    R7P0FqLFL3(F4)F0L2L4F3L2Fp5L
    FF R(F)p2(()R9L())8L3LL p9LFL1R0RF7L2F R   LFL8R1L8qP5RqP9qF L3R5
    RL5(L8)LL8P5P4RF(RR4)RLp6p3(P7LF1F)8L8FFFL3
    (P9P7R8)7P0LqP4RR3L3(
    R)8 L LqFP7FR P0F(( R)3(P7))F(R0L7FRL)R2L9L(RF(L1L(FRL3)FP9) )F6R6(((R7 )F0 )  )8L4p7/*F2LF1R7P7RF(R6F4
    R)6P4p5F0F(R6RF)RF4P4RP9FR7LRF1F8R2(R5F)R7FFF1(
    
    F5)Rq RLL3p7p708()5LF5F4()RFR1RR5RLqqqp9 R9(FRR4F9L6)0R3(R4)1F (
    (
    R)7LF9)0RFF4L0P6FqP0LL2LP9L FRF1L4F7
    

    notice there is a stray /* somewhere in there

    I have looked at the comparison many times and I can't see the problem, please take a look when you have some time

    Thank you

  • Custom User Avatar

    alright, thank you for the reply

  • Custom User Avatar

    Hello there, I'm struggling a bit with this kata (java)

    I have two problems, one about the duplicate pattern and the aother, not sure

    1. For the duplicate pattern exception

    For these example cases, how come your code does not throw an exception due to duplicate pattern definitions:

    p153 defined twice:

    p875FF(L8L)5L9L9L9L2(R4F8)10FF0P290qp654F8L((F8LF13RRRF12LF2L)10(F8LF13RRRF12LF2L)14)15FLqp153LL(R(F8LF13RRRF12LF2L)10)18FFqp822L8R(FR6)4F9L1qL2R(RR0)17FFp690FF9((F8LF13RRRF12LF2L)3F0)16LLP875FR(F9R)0L3L9RR(L8R)17RLqp11RL(RF5)15L3FRR(LL6)18LLqp290FR((F3RF5L)10F)1L2FP654L5F7(FF)1F5FP153P290P11qRF4(LL)6LRp153q
    

    p222 defined twice:

    p803qp222LF4(R5L)2L0F5RR(F(F3RF5L)14)15RF8qp491P222qp477P985L3L(F9F)4LL8qP477L4R(FF3)10RFp985F5L(LR0)1L3L2F0L(FL1)5F2LqP287p287F8L4(F9L9)14RF6qp222P803P491L0F(RF)9F7RF9L4(RL3)6L8F9L4L(L6R)3LRLF0((F3RF5L)2(F8LF13RRRF12LF2L)9)18LRq
    

    p305 defined twice

    p368P305LL((F8LF13RRRF12LF2L)0R6)1FRqFF1(F0L6)11RLp75RF5(F1(F8LF13RRRF12LF2L)8)0LL0LR((F3RF5L)1F3)8L4L9L8R(F9L)16LLqP75FL8(LL)0F5F4p305qp305LF(FF3)9LRLF(F0R)12LF4P368qp368q
    

    what am I missing?

    1. Code not throwing exception when it should

    I am getting a lot of random tests failing due to not throwing exceptions but my program outputs just fine
    I am not sure if it's due to that recursion check, the "particular very high (but sensible) threshold"
    For example this one works just fine for me:

    P976p724FL(F3L)6L2RLL(R5R)12F4F6RL(FR)7RF1F7F0((F8LF13RRRF12LF2L)14R9)3FL1qp976qp192P192qFF7((F8LF13RRRF12LF2L)7(F3RF5L)13)11L4F
    

    I ask because the output does look a bit like a fractal for this one, but it still works

    Is that the reason?

    Also, another issue, sorry, this one for example:

    p905L0L7((F3RF5L)14F)5F2F2P590P602P964L8F8(F4L6)16LRqp420LF8(LF1)7LLF3L9(R3F5)16F7LP801qp651F9L(R8L)3L8LP905L2L4((F8LF13RRRF12LF2L)9R)9LL5qP66p66qp964FR(L9L4)13LL8qp801FF1(L3R)14F1L1P801qp602F2L2(R(F8LF13RRRF12LF2L)11)17LLRF((F8LF13RRRF12LF2L)10L5)6L8Lqp590F1F0(RR)3FL1F1L2(R4R)17L3F7P420L5L4(L4R9)8F5FF3F3(F3L)3LLqp149RR(F8(F3RF5L)0)18FF0RF7(L(F3RF5L)14)0LFL6L9((F8LF13RRRF12LF2L)0(F8LF13RRRF12LF2L)4)7RFFL(F2F)11L0Rq
    

    I return *, but your code expects **

    if broken into pieces a bit this is how it looks like:

    p905L0L7((F3RF5L)14F)5F2F2P590P602P964L8F8(F4L6)16LRq
    p420LF8(LF1)7LLF3L9(R3F5)16F7LP801q
    p651F9L(R8L)3L8LP905L2L4((F8LF13RRRF12LF2L)9R)9LL5q
    P66
    p66q
    p964FR(L9L4)13LL8q
    p801FF1(L3R)14F1L1P801q
    p602F2L2(R(F8LF13RRRF12LF2L)11)17LLRF((F8LF13RRRF12LF2L)10L5)6L8Lq
    p590F1F0(RR)3FL1F1L2(R4R)17L3F7P420L5L4(L4R9)8F5FF3F3(F3L)3LLq
    p149RR(F8(F3RF5L)0)18FF0RF7(L(F3RF5L)14)0LFL6L9((F8LF13RRRF12LF2L)0(F8LF13RRRF12LF2L)4)7RFFL(F2F)11L0Rq
    

    so you can see it basically does nothing, am I blind?

  • Custom User Avatar

    Yes you are right, I have missed some things

    Thank you very much for the reply

  • Custom User Avatar

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

  • Custom User Avatar

    Hi, I need a bit of help if possible

    I have a problem with one of the random tests, this one:

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

    My problem is that my algorithm finds 3 distinct valid possibilities when resolving the multiple choice area in the bottom left
    I've reduced the board to make it more clear like so:

    Game

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

    I've marked the possible mines with M

    Input       ||  Expected  || Variant 1 || Variant 2 (incomplete but resolvable)
                ||            ||           || the border has sufficient mines
    ------------||------------||-----------||------------------------------------            
    0 0 0 1 x   || 0 0 0 1 x  || 0 0 0 1 x || 0 0 0 1 x
    0 1 1 2 2   || 0 1 1 2 2  || 0 1 1 2 2 || 0 1 1 2 2
    1 2 x 1 0   || 1 2 x 1 0  || 1 2 x 1 0 || 1 2 x 1 0
    ? ? 2 1 0   || ? M 2 1 0  || M ? 2 1 0 || ? M 2 1 0
    ? ? 2 1 2   || ? ? 2 1 2  || ? M 2 1 2 || ? ? 2 1 2
    ? ? 2 x 2   || ? ? 2 x 2  || ? ? 2 x 2 || ? ? 2 x 2
    ? ? ? 2 2   || ? M ? 2 2  || ? ? ? 2 2 || ? ? M 2 2
    ? ? ? 1 0   || ? ? M 1 0  || ? ? M 1 0 || ? ? ? 1 0
    

    My algorithm is basically attempting to place mines and counts if sufficient mines have been placed to satisfy the known number of mines on the discovered positions along the border (after the initial opening of obvious positions)

    Both variant 1 and 2 are valid from this perspective

    My issue is why are variant 1 and 2 not valid?
    I've tried to reason in many ways but I don't see a problem with those placements
    I've been doing this on paper like crazy and I can't figure out a criteria that would eliminate them

    Also my algorithm seems to solve one of the tests which are not supposed to pass, this one
    (I'll return with a explanation for this one)
    I found why this one fails for me, my flat recursion is not right, so I am missing possible solutions, but the problem above still stands

    0 0 1 x 1 0 1 x 1 0
    0 0 1 1 1 0 1 1 1 0
    0 1 1 1 0 0 0 0 0 0
    0 1 x 1 0 0 0 1 1 1
    0 1 1 1 0 0 0 1 x 1
    1 1 2 1 1 0 0 1 1 1
    1 x 2 x 1 0 1 1 1 0
    1 1 2 2 2 1 1 x 2 1
    0 0 0 1 x 1 1 1 2 x
    0 0 0 1 1 1 0 0 1 1
    0 0 1 1 1 0 0 0 0 0
    1 2 3 x 1 0 0 0 0 0
    2 x x 3 2 0 1 1 1 0
    x 4 4 x 2 1 2 x 1 0
    2 x 3 2 2 x 3 2 1 0
    2 3 x 1 1 3 x 2 0 0
    x 3 2 1 0 2 x 2 0 0
    2 x 2 1 1 2 2 2 0 0
    2 2 3 x 2 2 x 1 0 0
    2 x 3 2 x 2 1 1 0 0
    2 x 2 1 1 1 0 0 0 0
    1 1 1 0 0 0 0 0 0 0
    
  • Custom User Avatar

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

  • Custom User Avatar

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

  • Custom User Avatar

    Great kata, but I think more test cases are needed, I struggled more with the tests and the cropping algorithm rather than the actual problem :)

  • Default User Avatar

    The eqSumPowDig is easy to understand, but the hasProperty is in chinese.