Ad
  • Default User Avatar

    Actually, it is worse than you thought. I actually don't know if this works at all! I think the Java tests for this Kata are actually broken.

    test10(SqInRectTest)
    test(SqInRectTest)
    Random test 0
    test1(SqInRectTest)
    test2(SqInRectTest)
    Test Passed
    test3(SqInRectTest)
    test4(SqInRectTest)
    test5(SqInRectTest)
    test6(SqInRectTest)
    test7(SqInRectTest)
    test8(SqInRectTest)
    test9(SqInRectTest)
    1 Passed
    0 Failed
    0 Errors
    
    Process took 3216ms to complete
    

    Notice anything? It only says "1 passed" and doesn't mention the other 10 tests!

    So it looks like the buggy test code allowed my buggy code to pass. How embarassing. :) Thanks for catching this, btw. I will have to debug my solution and the test code.

  • Default User Avatar

    I forgot to reset "initialOk" if the remaining squares were bigger than 1x1. So this is my final solution to this problem that should take care of every possibility that could occur.

  • Default User Avatar

    The given Problem cries for a recursive solution (at least to my eyes ;-) ). The only thing that makes it a bit strange to solve is the fact that only the initial "paper" shouldn't be already a square. If you end up having a square while cutting it, it's fine.

  • Default User Avatar

    This wouldn't work for a call with "SqInRect.sqInRect(3, 4)" or "SqInRect.sqInRect(6, 4)"

  • Default User Avatar

    Before iterating over the array a simple length check could throw all walks away, that aren't of the correct size.