Ad
  • Default User Avatar

    Plan for modifications:

    1. clarify descroption to make it clearer what the mathematical rules are
    2. change centre of disk to any float value to avoid the possibility of finding all "failure" cases
    3. move make_disk as suggested
  • Default User Avatar

    although more random tests wouldn't help in this instance I believe as the edge cases will still be the same ones. Where should make_disk go then? (I'm new to authoring kata so I'm still figuring this stuff out)

  • Default User Avatar

    well spotted - will have a think to see whether I can stop the brute force approach to find edge cases

  • Default User Avatar

    Indeed, thanks for pointing that out – the new solution fixes the case when no solution is found (and indeed there were cases before when the wrong solution was found ). I believe the latest reference solution fixes both issues as I'm taking care of the precision of radius within the code now

    Brute force: guilty as charged. I'll look for a cleaner and neater solution (and hopefully I'll see some better solutions by others posted soon)

    Reference solution now rounds to 1 decimal place.

  • Default User Avatar

    Thanks for your comment. Do you have an example in which you think the reference solution is incorrect? The requirement states that "if the centre of the pixel is within the disk, then it is represented as a 1, and if the centre of the pixel is outside the disk then its value is 0." This is not an ambiguous condition since the centre of a pixel, say (2, 2) is either within the radius of the circle or outside. This gives a clear one-to-one mapping from radius to array but possibly a many-to-one inverse mapping from array to radius. This requirement means that the solution is dependant of a "specific" precision requirement but that the solution needs to solve the above requirement.

    Possibly the old version could be a separarte easier kata but this version poses a more interesting challenge, I believe. Happy to discuss further of course, hoping to clarify to you and hence in the kata description the actual requirement being made

  • Default User Avatar

    I have updated this beta to include more random test cases and to include the option of indeterminate cases in which the input array does not have sufficient resolution to return a unique radius.

    Comments welcome…

  • Custom User Avatar
  • Custom User Avatar

    Ah, figured it out… I was being silly

  • Custom User Avatar

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

  • Custom User Avatar

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

  • Custom User Avatar

    I'm only working in Python. It seems you're on JS…

  • Custom User Avatar

    Enjoyed this Kata although it felt a bit easier than 5 kyu to me. Or maybe I'm still 'calibrating' the difficulty levels

  • Custom User Avatar

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

  • Custom User Avatar

    I enjoyed this too. Not sure my solution is as elegant as some of the others, but it fits my current style and I'm relatively pleased I got it done in an hour or so.

    So how about that LinkedIn endoresement?!