Ad
  • Custom User Avatar

    thanks

  • Custom User Avatar

    It can be worked around by adding global.Test = require('@codewars/test-compat'); to user code.

  • Custom User Avatar

    The kata's testing code incorrectly assumes that there is only 1 possible row/column/diagonal sum for every magic square of a certain size. In fact this is already untrue for 4x4 magic squares.

    Its calculation is also flawed: adding a constant to all numbers will result in the "expected sum" to change by a different amount. Any minimum value other than 0 will cause the sum test to fail.

  • Custom User Avatar

    This kata cannot be solved:

    ReferenceError: Test is not defined
        at verify (test.js:33:13)
        at Context.<anonymous> (test.js:63:17)
        at processImmediate (internal/timers.js:464:21)
    
  • Custom User Avatar

    Seems like it does not work... at least.. for valid 3x3 square i got response:
    The sum in row 0 is incorrect.: expected 15 to equal 13.5

  • Custom User Avatar

    And also, please check your verify function, is it worked correctly? (it seems like it works when min number starts with zero)

    It might be: var expectedSum = size*(minFound+(size*size-1)/2);
    instead of: var expectedSum = size*(minFound+(size*size-1))/2;

  • Custom User Avatar

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

  • Custom User Avatar

    0 is a debated natural number and can be a member of the natural number set depending on which set you are using. See here http://oeis.org/A000027.

    N = {0, 1, 2, 3, ...}         - nonnegative integers
    
    N = (1, 2, 3, 4, ...}         - positive integers
    

    However, I agree with you on the fact it should state that it is including 0 as a natural number.

  • Custom User Avatar

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