Ad
  • Custom User Avatar

    Random tests shifted up sometimes expect numbers to merge twice, which should not be possible.

    Initial column: [4, 4, 8, 0]
    "Should not combine tiles twice (UP)" test expects: [8, 8, 0, 0]
    One of the "Random boards shifted up" test expects: [16, 0, 0, 0]
    
  • 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

    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".