Ad
  • Default User Avatar

    Gee I'm so relieved at least ONE other person knows how to use (or write) clamp and abstracting away pixel access/manipulation a bit. +1

  • Default User Avatar

    C++ version requires very spotty error checking. E.g. trailing garbage at the end is simply to be ignored (WTF) UNLESS (found empirically) it starts with ')', '|' or '*'.

    It could be that more arbitrary continuation characters should trigger parse failures, but I happened to not hit them with the random test cases I received.

    Please, let's make sure that katas teach PROPER programming principles, such as:

    1. consistency
    2. input validation (don't just silently accept/ignore trailing garbage!)
    3. have an interface that allows non-leakage (right now, it's very easy for the parser to have built RegExp instances, but never free them - in fact we don't know how they're allocated)
  • Default User Avatar

    The test cases testing for exception in C++ are wrong:

    It(should_throw_if_lives_ran_out)
    {
        Guesser guesser(10, 2);
        guesser.guess(1);
        guesser.guess(2);
        AssertThrows(std::exception, guesser.guess(10));
    };
    

    The description clearly states that

    • If the user tries to guess WRONG more than the limit the function should throw an error
    • correct guesses DO NOT consume lives

    I'd expect the function to throw at the second guess, or MAYBE at the first next WRONG guess. Not at the third guess when that guess is actually correct

  • Default User Avatar
  • Default User Avatar

    May well be the only person to use regex here :)

  • Default User Avatar

    The flaw is in the kata writer's logic

    And arrogance. "XXX people completed the kata" doesn't (at all) mean it's above criticism. It just means all code warriors have stamina and pitbull mentality.
    Which is great, because programmers need that.

    Translating that to "my description is perfect" is just nonsense. Ironically, a programmer with good sense of logic would realize that. But that programmer would read the question the way we all did, as opposed to how the author reads it.

  • Default User Avatar

    I get your frustration. I too read the problem in the "sensible way". Just accept that it wasn't intended to have any real-life useful meaning, and it's basically a sequence-manipulation trick. Either bit the bullet or skip the kata (I wouldn't blame you, it's just my OCD keeping me here)

  • Default User Avatar

    The wording "Furthermore the percent of loss [...]" clearly implies that it only goes for the depreciation of the OLD car, not the new (that's a WIN, not a LOSS)

    The major complication is the value of both cars is decreasing (i.e. depreciating). They both decrease by the same percent per month, 1.5% for our first test. Additionally, the amount of depreciation increases by 0.5 percent every second month.

    is WAY more accurate. (thanks to designerzim)

  • Default User Avatar

    Indeed, especially

    The major complication is the value of both cars is decreasing (i.e. depreciating). They both decrease by the same percent per month, 1.5% for our first test. Additionally, the amount of depreciation increases by 0.5 percent every second month.

    is WAY more accurate. I'm filing an issue because "Furthermore the percent of loss" clearly implies that it only goes for the depreciation of the OLD car, not the new (that's a WIN, not a LOSS)

  • Default User Avatar

    Good style. Consider using a proper random generator (std::mt19937 e.g.)

  • Default User Avatar

    @g964 of course it is. Changing the parameters of my compare predicate to int16_t very much makes the tests fail due to overflow.

  • Default User Avatar

    randomized tests could mean the test "passes" by accident (because it doesn't hit the edge case that fails)

  • Default User Avatar

    This is one of the rare cases that work in-place.

    Also, I think most answers get the dimension detection on decode wrong in the general case (though I'm not in the mood to check)

  • Default User Avatar

    Huh. Interesting. What are you using isPrime for here?

  • Default User Avatar

    What a royal mess this is. I even left in my debug traces. Bad kata.

  • Loading more items...