Ad
  • Default User Avatar

    i think, this line - "for num, color in zip(range(number, number+3), (2, 1, 1)):"
    should be like this - "for num, color in zip(range(number, number+3), (2, 1, 0)):"

  • Custom User Avatar

    I don't do Go at all, so I can't be of any technical help, sorry.

  • Default User Avatar

    I've been using Go for a while. It would be cool to translate this into Go. But I've always found translations difficult to do. Usually the myself and the kata author have no idea how to do it.

    If I translated it into Go, would you help me do that?

  • Custom User Avatar

    Ok, I found the reason: the random tests still pass because they don't just compare the output string against another (because several solutions may be possible), so the leading and trailing new lines, which are just about formatting, don't cause problems. The fixed tests, on the other hand, fail because the strings are different.

  • Default User Avatar

    Thanks for ressurecting this kata, it's a pretty good one.

    I don't understand the way you're handling the new lines at all. I don't see why my original code works for all but a few tests? There must be something different about those ones.

    But I'll just use that last line of code you provided. Thanks again.

  • Custom User Avatar

    your code is passing with just this, tho: return "\n".join(map(''.join,theMap)) (I just checked, both against the full test suite and the sample tests)

  • Default User Avatar

    To get it to pass, I had to do this:

    if width == 3 and height == 3:
        return outputString[1:-1]
    if width == 5 and height == 5:
        return outputString[1:-1]
    if width == 10 and height == 10:
        return outputString[1:-1]
    return outputString
    

    So that it removes the leading and trailing '\n' for the small tests.

  • Default User Avatar

    The last few lines of my code - which I use to return the problem in the correct format are these:

    outputString = "\n"
    for row in theMap:
        outputString += ''.join(row) + '\n'
    return outputString
    

    Which gives the correct format for the bulk of the problems. If I remove the leading and trailing '\n' then the first few tests pass, but the rest don't.

  • Default User Avatar

    Hi, I've basically solved this using python. But I get kind of a formatting error with the first few tests...
    The bulk of the tests seem to need a leading and trailing '\n' newline character, but the first few don't...

    Sorry for the long post, but I don't know how to show this more concisely.

    
    Time: 4106ms Passed: 305Failed: 6Exit Code: 1
    Test Results:
    Fixed tests
    No solution
    3x3
    '\nSX.\nXP.\nXXG\n' should equal 'SX.\nXP.\nXXG'
    '\n.S.\n.P.\n.G.\n' should equal '.S.\n.P.\n.G.'
    '\n...\nSPG\n...\n' should equal '...\nSPG\n...'
    '\n...\nSG.\n...\n' should equal '...\nSG.\n...'
    Completed in 0.45ms
    5x5
    '\n.SP..\nXXXP.\n.XPXX\n.PX..\nG...X\n' should equal '.SP..\nXXXP.\n.XPXX\n.PX..\nG...X'
    Completed in 0.18ms
    
    ...
    
    Same for 10x10
    
    ...
    

    But then all the below cases solve no problem at all:

    More tests
    More fixed tests
    (4 of 4 Assertions)
    Random tests
    (300 of 300 Assertions)
    Completed in 3585.46ms
    
    
  • Default User Avatar

    I really enjoyed this kata! Is the author accepting translations?

  • Default User Avatar

    I have the crappiest solution possible. Tell me I'm wrong!

  • Default User Avatar

    I answered my own question. It is.

  • Default User Avatar

    Is this doable in Python in 2023?

  • Default User Avatar

    Thank you, Davo36! The last sentence of your comment finally suggested the kind of syntax I needed to call the desired lambda from the constant list of lambdas (ACTION). That had me stuck more than any other aspect of this kata.

  • Default User Avatar

    I really enjoyed this one. Great kata, thanks.

  • Loading more items...