Ad
  • Default User Avatar

    The compensation is the sum of all grains on the board; not just the grains in the last square.

  • Default User Avatar

    You're right; there's no question it should be what_note. I went ahead and fixed it myself. Better to do it now. Fixing it broke the solutions that have passed already, though, so you will have to update yours.

    I fixed the "octaves" thing too while I was at it.

  • Default User Avatar

    Fixed

  • Default User Avatar

    The initial solution's method name is in snake case (what_note), but the default and kata test cases expect whatnote. I think it would be better to use snake case. I didn't change it myself because it would break the solutions up to this point, but if you agree, there are only a couple of solutions so it's not too late to change it.

  • Default User Avatar

    letter is sometimes undefined in the random tests. In the test cases, Math.random()*27 needs to be Math.random()*26 (alpha is not defined at index 26).

  • Default User Avatar

    Great opportunity to put switch(true) to work.

  • Default User Avatar

    I like this kata. I suggest a couple of things:

    Speed is supplied as two instantaneous values, so an assumption has to be made about how to determine the average speed beteween the two instances. It seems that the intended assumption is that speed will increase linearly between the two, as the test cases expect that if instance #1 is 0 mph and instance #2 is 100 mph, the average speed between them is 50 mph. I think this could use clarification in the description.

    Also, I think the test cases should check that subsequent calls (third, fourth, etc.) continue to work as expected. Or, if the intention is to only measure between two instances, it should test that the solution resets after working for the first pair, and that should be mentioned in the description.

  • Default User Avatar

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

  • Default User Avatar

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

  • Default User Avatar

    Could you make this a translation of this kata?

  • Default User Avatar

    Yes, it is for the sake of the inject. If d1 is the first digit of id, after the map.with_index step it looks like:

    [d1 * 7, -d2, d3 * 7, -d4, d5 * 7, -d6, d7 * 7, -d8]

    Add it all up and factor out the 7 and it looks like:

    (d1 + d3 + d5 + d7) * 7 - d2 - d4 - d6 - d8.

    This takes care of the instruction to "Take the sum of 1st, 3rd, 5th, 7th and 9th digit and multiply it by 7. Then subtract the sum of 2nd, 4th, 6th and 8th digits from this value." It would probably read more clearly if id was first partitioned into even/odd indices and both were manipulated separately, but the end result is the same.

  • Default User Avatar

    This kata by BattleRattle is essentially identical to this one and does have a JS translation, but not a Ruby translation, so translating this one into JS might be introducing a duplicate. Always appreciative of your contributions to CW, I just remembered this and thought I would give you a heads up.

  • Default User Avatar

    All better.

  • Default User Avatar

    In the description, it says If there is a tie in improvements then order by name. In the above examples, where there is a tie, my solution puts the names in order by the first letter of the name field (or more letters as necessary). For instance, in the first example, where all of the improvements are 0, {"name":"leroy, plum","improvement":0} should be last if we sort by that method, because the first letter of the name (l) comes after the first letter of all the other names alphabetically. Hypothetically, we could be sorting by the second name, but in that case leroy, plum would be second to last, and frog, cow would be first. Same goes for the improvements of -100, I would think that freeman, Act should precede god, cow.

  • Default User Avatar

    There is an issue with sorting in the random tests. From expected results:

    {"name":"leroy, plum","improvement":0},{"name":"blop, King","improvement":0},{"name":"frog, cow","improvement":0},{"name":"jeff, willow","improvement":0}

    {"name":"god, cow","improvement":-100},{"name":"freeman, Act","improvement":-100},{"name":"whimpy, brown","improvement":-100}

  • Loading more items...