Ad
  • Custom User Avatar

    Thanks. I solved it minutes after I had last posted.

  • Custom User Avatar

    See my issue above. You should not modify the input to pass tests.

  • Custom User Avatar

    From the description: "Your function can modify the initial board value as much as you like, but the test suite will validate what you return, so don't forget to return it".

    But if you modify rows of the initial board then you will not pass tests. Tests call the user solution with a shallow copy of board.

  • Custom User Avatar

    The one below. The onlyone that is still opened... ;)

    edit: looking again at your input, I'm not sure this is the same thing. I didn't find the formatting of your message in the test suite. I'm not sure what's going on there, but, in any case : are you mutating the input? Also check for the absence of global variables, because there are some in the tests utilities ( :rolleyes: ). Edit: I removed them all.

  • Custom User Avatar

    Which issue is it below? There are so many. Your comment is not veyr helpful. :(

  • Custom User Avatar

    duplicated issue (see below)

  • Custom User Avatar

    The tests appear broken. This looks like it contradicts the instructions:

    input:
    [ 8, 8, 8, 8 ],
    [ 2, 0, 8, 16 ],
    [ 0, 0, 8, 8 ],
    [ 0, 0, 4, 0 ]

    Expected:
    [32, 0, 0, 0]
    [2, 8, 16, 0]
    [16, 0, 0, 0]
    [4, 0, 0, 0]

    instead got:
    [16, 16, 0, 0]
    [2, 8, 16, 0]
    [16, 0, 0, 0]
    [4, 0, 0, 0]

  • Custom User Avatar

    "The result of a combination cannot match with another tile on the same move" - this is not what happens in the example above. It's the opposite here, a tile is moving onto a combined tile. This is not allowed, but nowhere in the description does it state this.

  • Custom User Avatar

    From description
    The result of a combination cannot match with another tile on the same move. In other words, 2222 => collapses to ##44 and not ###8

    Also description says Your function can modify the initial board value as much as you like.... Of course you can, but you won't pass the tests.

  • Custom User Avatar

    It's not mentioned in the description that once two tiles are merged, no other tiles can be merged into that same tile within the same move. This only becomes apparent from test cases.

    example move row to left:
    
    row: [2, 0, 2, 4]
    expected: [4, 4, 0, 0]
    
    if multiple merges would be possible: [8, 0, 0, 0]
    
    
  • Custom User Avatar

    Good point about Set. I've prefixed the test constructor so there's no name conflict.

    I'll also consider changing 'falsy' to null and undefined. Thanks for the feedback!

  • Custom User Avatar

    Set is a native class. You should not redefine it.

    User-defined classes ( ie, Constructor functions ) should, by convention, have names starting with a capital letter.

    Expecting "falsy" for null, undefined and NaN but not false, 0 or "" feels inconsistent. Easiest fix for that is possibly a different name, though I have trouble coming up with one that would naturally not include any of the others. Maybe you should just go with JS itself and expect "null" ( not the historically correct bug that is "object" ! ), "undefined" and "number".

  • Custom User Avatar

    Good catch. Fixed.

  • Custom User Avatar

    Some typos:

    sting -> string
    and array -> an array
    and object -> an object
    
  • Custom User Avatar

    I have added functions into the mix. My apologies if your solution became invalidated.

    I won't add any additional requirements to the kata from now on. (I'll only fix issues, if any come up)

  • Loading more items...