Ad
  • Custom User Avatar
  • Default User Avatar

    They were coding as fast as they can

  • Default User Avatar
  • Custom User Avatar

    If this is your first kata, do yourself a favour and don't mess with floating point numbers. ( The kata doesn't actually even strictly need them. ) See below; those Docs do a fair job of explaining the problem ( and the "solution" ).

    If you can't make the task fit the backstory, or the backstory the task, keeping it unpublished is an option. Replace velocity by speed, either introduce an angle or restrict movement to 1D ( thus either positive or negative ), and it might yet work. But it'll need a better description, and keeping the physics realistic would keep things simpler to explain.

    Good luck!

  • Default User Avatar

    this is a good point, this is my first kata and wasn't too sure of how to go about this. i might just delete the kata.

  • Custom User Avatar

    If velocity is positive, and friction is interpreted as drag, it might be?

    The whole kata is not very strict with its terminology, or its units, or really its physics.

  • Custom User Avatar

    This is a weird way to represent friction, and the description does not do a good job of explaining it.

    Friction, or drag, must always have a sign opposite to velocity ( otherwise, it'd be speed - velocity is speed in a direction ), and must always be smaller than it, physically. If friction can somehow be bigger than negative velocity ( impact with a heavier object? ), (a) it's no longer friction and (b) yes, it can reverse velocity.

    If it's supposed to model cumulative friction over time, the model also breaks down - friction at any moment can still never be bigger than negative velocity, so can never sum to more than negative velocity.

    Or maybe you just need a different model to explain what you want us to calculate, because this one doesn't work.

    Backstories are nice, but they should be somewhat believable.

  • Custom User Avatar

    velocity will always be one number, negative or positive, as will friction.

    Friction can be negative?

  • Custom User Avatar

    expected 1.8000000000000003 to deeply equal 1.8

    The test cases should allow for floating point inaccuracies instead of using strict comparisons, see the docs here.

  • Custom User Avatar

    v=0.9271393100564309, f=0.0847028626832449

    expected 0.08011068322398196 to deeply equal 0.842436447373186

    Why? The velocity is supposed to decrease to as close 0 as possible, but not below. Why stop after 1 decrement of friction?

  • Default User Avatar

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

  • Default User Avatar

    man wrote a book on how to find a needle in a haystack that is probably in a fram in a barn possibly near rural texas.

  • Default User Avatar

    how? what? why? ... actually, you know what, do what you do, it's beautiful.