4 kyu

Broken Image - Puzzles #1

Description
Loading description...
Puzzles
  • Please sign in or sign up to leave a comment.
  • Voile Avatar

    Quick tip : if you find any difficulty regarding floating point then use round function

    This is a bad idea.

    • dfhwze Avatar

      On top of that, this hint is horrible. I was rounding intermediate results, but all we need to do is round the final results after applying all operations.

  • RealKenshiro Avatar

    That was very funny...

    Very original Kata!

  • user7820265 Avatar

    nice kata,i like.

  • G_kuldeep Avatar

    approved; lowest available rank was 4

  • mn113 Avatar

    Satisfying kata. Pretty spot-on for me with the amount of information provided and the amount to figure out. Mathematically not very hard, but there are plenty of possible approaches to extracting the data you need to use. And a good amount of little sanity checks you need to factor in. Good job!

    • matt c Avatar

      thank you :)

    • ffoleyTE Avatar

      I really struggling with extracting data. I have no idea how to use the pixel class.

      I have figured out that I can pass the first test using this method.

      image.forEach(i =>{ j = i.length; for(j = 0; j < i.length; j++){ i[j].g = 155;
      } })

  • GiacomoSorbi Avatar

    A tough one, particularly not knowing in advance about the format of the message one has to decode (I put "subtract" instead of "minus" until I start logging it to see the error), if it could have like "each Red and..." then "each Green and..." and so on; I finally managed to overcome that guesswork too, but I would recommend to be more informative in the description about the statement format.

    • matt c Avatar

      Sorry I'll add more descriptions about the input, Thank you :)

    • GiacomoSorbi Avatar

      No need to apologize, of course: I am still the one taking and you are still the one making a gift to us :)

      The kata could be fine as it is now, it is just that imho knowing in advance something more about the input format frees one's hands to focus more on the actual coding/fun part.

    • matt c Avatar

      I've updated the description and moved the pixel class to the preload section as there was no need for it to be in the actual code.

    • GiacomoSorbi Avatar

      Description seems much cleaner to me now; possible typo in the last line: I have moved the pixel class to the reloaded section., I think you meant preloaded.

    • matt c Avatar

      Thank you, I'll fix it now

  • Freywar Avatar

    When I try to submit, I get this error:

    Max Buffer reached: Too much information has been written to stdout. 20 Passed 0 Failed 0 Errors

    UPD After ~10 tries it finally accepted my solution. I did not console.log anything so stdout overload was purely from tests' logs. I think it would be better not to show "Expected: ... Got: ..." stuff for passed tests.

    UPD2 Also did not find any check for "Image has a size of" parsing instead of simply using length of image nor any benefits. Is it really neccessary?

    • matt c Avatar

      not really I thought it might help, some people might use another approach to the problem? Also I think that's a good idea and I will not output the data if it is correct.

      -->Sorry<-- I accidently set issue as resolved if the error still occurs, could you please just keep commenting here, and I'll try resolve the issue. Also I won't remove the size of part because there really is no need to, Thanks :)

      Issue marked resolved by matt c 10 years ago
    • Freywar Avatar

      Actually I meant removing Value == [125,155,255,125,155,255,125,155,255,125,155,255,125,155,255 messages from output, not pictures. Pictures was a much better idea.

    • matt c Avatar

      oh ok! yeah I guess I could do that!

  • Abbe Avatar

    It's a bit difficult to decide without looking at your actual test data, but I think your bonus tests are wrong.

    When I log the pixel values, it looks like the background is scrambled according to the statement, but the face is unscrambled.

    So when I try to "fix" the face, it becomes double fixed (which is wrong, of course).

    Could you take a peek at it, please?

    Funny thing is that I've spent more time writing code to help me debug and visualize the problem than to actually solve the kata. :-)

    • matt c Avatar

      You're right it does seem to only affect the background and not the face for the bonus test, I'll investigate further and try fix it asap.

    • matt c Avatar

      I believe I have solved this issue. I have also removed the division, so no image pixel will never be divided. Please reply with success if it has worked, also your solution may have to change as I was populating the images (before bonus test cases) wrong and have fixed it.

    • Abbe Avatar

      Hmmm. You may have fixed that problem, but you seem to have introduced another. :-)

      My first scrambled bonus image had the following statement: "Image has a size of 24 and each Red and each Blue and plus 40", but all of the background pixels were (13162,167,13295). The filters seem to be correct, but the arithmetic is off.

      All the bonus pictures have similar problems. They only used plus and minus but the actual values are way too large.

      The static images work without a problem.

      I never had problems with the division, btw. The resulting value was never more wrong than rounding the value to the nearest integer fixed it.

    • matt c Avatar

      Ok I believe I've fixed the issue and readded the dividsion as I found out what was actually causing the error. If you could confirm thank you very much :)

    • Abbe Avatar

      Looks good now. At least my solution passes all the tests. :-)

      Thanks for your effort!