Ad
  • Custom User Avatar

    Quite easy-going kata to figure out and to practice some coding challenges with, funny task.

  • Custom User Avatar

    Hi,

    I've tried multiple things and am unable to replicate the issue (in Python).

    1. Using print(n) will correctly output the input in the log.
    2. Incorrect outputs are displayed verbosely, i.e. n = 86: 86 should equal (1, 101)

    Please open another issue with more information if you believe it is still occurring.

  • Default User Avatar

    Nice kata.
    print(n) does not work.
    Unable to view inputs on "Attempt" tests.

  • Custom User Avatar

    I believe I have fixed this and added 'closeTo' assertions using expects' in-built methods.

    The only errors are logical errors when the gallery width is >= 700.

  • Custom User Avatar

    They're all trivial changes to the code. I'd expect you'd be able to modify this solution for those cases.

  • Custom User Avatar

    Hey, you said that this is the solution? But "setUpGallery" isn't named correctly, the values are rounded, and the Image objects aren't returned as rows.

    Can you please provide the updated code where you got the 'floating point error'.

    This will prevent me from wasting time trying to recreate your solution and getting it wrong.

  • Custom User Avatar

    The solution's just the link above though...

  • Custom User Avatar

    Could you please send your solution over so I can look into it further? Post it in Discord at "help-author" if that is better.

    @theunbeatableant

  • Custom User Avatar

    However, is you solution supposed to give the correct answers? If so, I will implement that now and that should fix everything.

    The last row is incorrect.

  • Custom User Avatar

    Although... that might be quite complicated to do with a 2D array of Image objects. If I were to implement fuzzy assertion, then I would appreciate any guidance you could give.

  • Custom User Avatar

    I could implement a 0.001 tolerance on either side of the expected value, that will definitely fix the errors.

    However, is you solution supposed to give the correct answers? If so, I will implement that now and that should fix everything.

  • Custom User Avatar

    Well, now the floating point error happens again:

    expected
    [ [ Image{ width: 1235, height: 366.88284518828453 } ], [ Image{ width: 183.98326819752805, height: 299.6065309669968 }, Image{ width: 1026.016731802472, height: 299.6065309669968 } ], [ Image{ width: 447.4078201485463, height: 429.9114249472065 }, Image{ width: 302.70916812762107, height: 429.9114249472065 }, Image{ width: 434.8830117238328, height: 429.9114249472065 } ], [ Image{ width: 163.01230759506961, height: 596.4597798639875 }, Image{ width: 1046.9876924049304, height: 596.4597798639875 } ], [ Image{ width: 75.74276443511488, height: 126.16876925082148 }, Image{ width: 1134.2572355648851, height: 126.16876925082148 } ] ]
    to deeply equal
    [ [ Image{ width: 1235, height: 366.88284518828453 } ], [ Image{ width: 183.98326819752805, height: 299.6065309669968 }, Image{ width: 1026.016731802472, height: 299.6065309669968 } ], [ Image{ width: 447.40782014854636, height: 429.9114249472065 }, Image{ width: 302.70916812762107, height: 429.9114249472065 }, Image{ width: 434.88301172383274, height: 429.9114249472065 } ], [ Image{ width: 163.01230759506964, height: 596.4597798639875 }, Image{ width: 1046.9876924049304, height: 596.4597798639875 } ], [ Image{ width: 75.74276443511486, height: 126.16876925082148 }, Image{ width: 1134.2572355648851, height: 126.16876925082148 } ] ]
    
  • Custom User Avatar

    Hi Voile, massive thanks for the clear and detailed explanation.

    1. OOP structure changed to a JavaScript function.
    2. Used .to.deep.equal() instead of JSON.stringify()
    3. Added chai.config.truncateThreshold = 0
    4. Changed return output to 2D array of Image objects.

    Hope this fixes any issues you raised :)

  • Custom User Avatar

    I made sure to remove the Math.round() from the solution and it looks like the solution is no longer passing the tests!

    (The actual image dimensions are different even though the return output is now a 2D array)

  • Custom User Avatar

    This incorrect solution sometimes passes all the tests.

  • Loading more items...