Ad
  • Custom User Avatar
  • Custom User Avatar

    I have the exact same question. My code passes all other tests execpt this one.

  • Custom User Avatar

    Fixed first one. Second suggestion is changed to:

    These soldiers will adopt the cadence of their neighbor.

  • Custom User Avatar

    b. If the rounded-down average is the soldier's current cadence, they the cadence moves one step towards the fastest neighbor's cadence.


    Not sure about my suggestion below, but yours doesn't fit the meaning:

    That soldier will adapt the cadence of their cadence on their neighbor.

  • Custom User Avatar

    :-)

  • Custom User Avatar
    • The ref solution was incorrect. Please try now. (I planned on making a simple kata, but I deceived myself :-)
    • Existing solutions are invalidated. Please have another go at it, if you wish to.
  • Custom User Avatar

    I'll rework the description later today when I've got some time. Back to draft for now.

  • Custom User Avatar

    I could be misunderstanding the description.

    For [{"initial":[10,3,1,3,2],"steps":1,"stan":3,"ollie":1}, I'm getting [ 9, 3, 3, 3, 3 ], but the answer should be [ 9, 3, 2, 3, 3 ] according to your tests. I'm unsure how the value at index 2 is 2 when Ollie and Stan's value never change and they're the neighbours (4. If both neighbors have the same cadence, the soldier adopts that cadence.)

  • Custom User Avatar

    Thanks. Well, that last statement should just be removed. I added it for clarity, but it is a false statement. Also added your test case in sample tests.

  • Custom User Avatar

    In your "Details" section you state:

    If neighbors have different cadences:
    a. The soldier's cadence moves one step towards the average (rounded down) of the neighbors.
    b. If the rounded-down average is the soldier's current cadence, they move one step towards the fastest neighbor's cadence.
    In both cases, if the soldier is already marching at the rounded-down average, they'll remain marching at that cadence.

    As currently worded, the last statement in the above description is confusing. If for example, the "initial" array is [4, 4, 5, 6, 6] with "stan" at index 0 and "ollie" at index 4, what should the new value be at index 2? The average of its neighbors is 5. Statement "b" above states that the soldier's current cadence should move one step towards the fastest neighbor's cadence. Based on this statement, the new value at index 2 should be 6. The last statement however states that if the soldier is already marching at the rounded-down average, they'll remain marching at that cadence which would make the new value at index 2 to be 5.

    Other than this description problem, this was another nice kata!! I really enjoy solving all of your katas.

  • Custom User Avatar
  • Custom User Avatar

    Thanks for the quick fix. That was the only issue that I found. Great Kata!!

  • Custom User Avatar

    It was in the first fixed test, I changed it to be compliant to the specs. Any other cases where you see a test that does not adhere to the specs?

  • Custom User Avatar

    Well spot! Is this in a fixed or random test? In random tests, I should prevent to generate such cases. If it's in a fixed test, I'll update that test.

  • Custom User Avatar

    Let me begin by stating that this kata is awesome!!! With that said, I believe that I either identified a problem with one of your tests OR I don't completely understand the instructions for the "Glide Effect".

    In your kata's description for the "Glide Effect" you state: "This effect will only be used if there is a next note entry, and if that note entry has a different pitch class as the current note entry.". In one of your tests however (see details below), two consecutive note entries are: 14A2g and 16A4gs. You are expecting the results for the "A" pitch class to be "A . . . . . . . . . . . . . . ● ↘ ● . . ~ . . . . . . . . . . . . .". This expected result shows a downward glide between two consecutive note entries for the same "A" pitch class. Since the pitch classes are identical for these two note entries, my solution doesn't display a downward glide but displays an "x" instead. Note I copied the output from that one failed test below.

    Compact:
    "A;0C.4bsg;4D2;6C.2g;8D4sg;12C.2b;14A2g;16A4gs;20B.2g;22C2g;24E.4sg;28D.b;29D;30C2"

    Expected:
    A' . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
    G . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
    F . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
    E . . . . . . . . . . . . . . . . . . . . . . . ↗ ○ . . ~ v . . . .
    D v . . ↗ ● x . ↗ ● . . ~ v . . . . . . . . . . . . . . ↘ ○ ● . . .
    C ○ . . ~ . . ○ x . . . ↘ ○ x . . . . . . . ↗ ● x . . . . . . ● x .
    B . . . . . . . . . . . . . . . . . . . ↗ ○ x . . . . . . . . . . .
    A . . . . . . . . . . . . . . ● ↘ ● . . ~ . . . . . . . . . . . . .
    | . . . | . . . | . . . | . . . | . . . | . . . | . . . | . . . |

    Actual:
    A' . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
    G . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
    F . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
    E . . . . . . . . . . . . . . . . . . . . . . . ↗ ○ . . ~ v . . . .
    D v . . ↗ ● x . ↗ ● . . ~ v . . . . . . . . . . . . . . ↘ ○ ● . . .
    C ○ . . ~ . . ○ x . . . ↘ ○ x . . . . . . . ↗ ● x . . . . . . ● x .
    B . . . . . . . . . . . . . . . . . . . ↗ ○ x . . . . . . . . . . .
    A . . . . . . . . . . . . . . ● x ● . . ~ . . . . . . . . . . . . .
    | . . . | . . . | . . . | . . . | . . . | . . . | . . . | . . . |

  • Loading more items...