Ad
  • Custom User Avatar

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

  • Custom User Avatar

    (Original author here) Oh dear, seems times have moved on since I first dropped in and this kata didn't make the cut. Is there something I could do to modernise it for approval or is it beyond saving?

  • Custom User Avatar

    (Original author here) I'm afraid I am not aware of the etiquette here because I only drop in from time to time. Is there something I should do to this kata to modernise it? Would the "republish" option allow it to get a rating more in line with other kata?

    To be honest my main purpose for writing this was to have some fun with the plotting idea referenced in the description, to see if it could spice up an otherwise dry calculation kata. If that's no longer in the spirit of the community here then as a very casual user it's not my place to dispute!

  • Custom User Avatar

    Thanks, I enjoyed this solution. 👍

  • Custom User Avatar

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

  • Custom User Avatar

    Thanks @dcsmith for this kata, I found it clearly described and fun to complete.

  • Custom User Avatar

    Thanks for looking at this kata. I'm afraid I missed your feedback message, hence the delay in responding to you.

    I'm happy to add them but could you expand a little on why are random tests important here?

  • Custom User Avatar

    Thanks for the feedback. I think that the another extended version of this kata with the other operations is a good idea; that keeps this one nice and short for those in a hurry. I'll write that another kata when I get a moment.

    As for the response of add or mutliply being a real number, I think it's better to return a Complex so that other operations can be chained on it without risking a run time explosion:

    let a = new Complex(1, 2);
    let b = new Complex(1, -2);
    
    let c = a.add(b);
    
    // Since Complex.add currently returns a Complex we can continue chaining operations:
    c.add(a).add(new Complex(4,1)); // etc.
    
    // whereas if we conditionally returned a real number we'd have to extend the real number to support those operations too:
    c.add(3); // Number.prototype.add ?!
    
  • Custom User Avatar

    Thanks for the feedback, I've added the requirement to handle real/complex arguments transparently.

    I haven't added any of the additional operations you mention since I was trying to keep this kata nice and short. I'm happy to be argued down on that one if you think it'd be better with some more meat on it.

  • Custom User Avatar

    Sorry it took me so long to address your issue. I completely agree and have changed modulus to a method (and added some more helpful test cases).

  • Custom User Avatar

    Thanks for checking this. I'm confused though. Isn't that what it currently says?

  • Custom User Avatar

    Good spot and thanks for the feedback. I've added a test to cover the iteration order.

  • Custom User Avatar

    Ouch! Thanks for pointing that out. I've corrected that test and reduced the threshold to the correct value of 2 (as per http://en.wikipedia.org/wiki/Mandelbrot_set).

  • Custom User Avatar

    Ah, I understand now. I agree and have removed the final tests for Complex so you are free to delete or reimplement the provided Complex as you like; only the findEscapes(...) function is tested now, which better fits the purpose of this kata.

  • Custom User Avatar

    I'm glad you enjoyed it, Abbe, and thanks for the great feedback!

    I'm conflicted on this one. Part of me thinks implementation of complex number arithmetic should be part of the kata, which would then need the tests to help guide it. Another part of me thought of supplying the complex number implementation as a given rather than in the initial solution, so I could tighten the focus of the kata to just the mandelbrot calculations.

    Could you perhaps give a little bit more detail to help me understand the way my tests for Complex got in your way?