Ad
  • Default User Avatar

    C#

    There's a problem with the tests checking even distribution - my passed solution is definitely not providing an even distribution...

    Having had a look at the relavent test in the Sample Tests, I think its a simple integer division issue:

    This checks for the distribution on '1's:
    Assert.Less(Math.Abs(Integers.GetValueOrDefault(1, 0) / Length) - (1 / 3.0), Threshold);

    However the number of 1s held in Integers.GetValueOrDefault(1, 0) is not being cast to double. Therefore when its divided by the total number of digits held in the integer Length, it comes out to 0. And since the Asserts are only failing when they find a proportion greater than 1 / 3 (which would be fine if the first calculation was correct), its passing everything.

    Casting Integers.GetValueOrDefault to double in each Assert should fix it I think.

  • Default User Avatar

    C

    Description says "return an empty array if your array is empty", but tests require null to be returned.

  • 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

    Javascript:

    Couple of conditions mentioned in the description are not checked in the test cases

    1. no test checks for a 0 length string - description says should throw an error
    2. no test checks for an illegal character at the mid point in a string with an odd number of characters - description strongly implies this should throw an error
  • Default User Avatar

    Revealing my own ignorance here, but I'm not familiar with the way the function signature was described in the Details:
    mod :: long a -> long n -> long

    Not exactly difficult to puzzle it out :) But it did make it a little confusing, and perhaps is an unneccasery extra barrier for anyone else who doesn't know the notation, and might be trying this kata is their first experiment with assembley.

  • Default User Avatar

    Yes, && is a logical And. It will return True if both conditions are True, and False otherwise.

    It also resolves from left to right, and exits immidiately if it encounters a False. So if a or b are 0, it will exit on (a != 0) or (b != 0) before it attempts to % by a and b (which would otherwise throw a divide by 0 error in these cases).

  • Default User Avatar

    Oh right, yeah, sprintf....

  • Default User Avatar

    That is annoyingly good...

  • Default User Avatar

    C# - The arguments in the Assert.AreEqual() tests are backwards (both in sample and actual tests) - they should be (expected, actual) but are currently (actual, expected), so generated Test Failed messages are the wrong way around.

  • Default User Avatar

    Just a wording suggestion, maybe change the description from "Your task is to extend the String class with a method called Score()" to "Your task is write an extension method for the String class called Score()" - just to avoid any misunderstanding that it is asking you to subclass String.

  • Default User Avatar

    I enjoyed this kata, just a minor edge case issue:

    C# could do with an extra test - my first solution passes when it shouldn't, for example it would return this board as a win for player 1:

    int[,] board = new int[,] { { 0, 0, 1 }, { 0, 0, 0 }, { 1, 0, 0 } };

    (ie I forgot to check the centre square when checking for a bottom-left to top-right diagonal)

  • Default User Avatar

    Thanks for updating! My thinking was that any types already present in the skeleton initial solution should already be included (and this seems to be the general practice). Especially since this is rated as a 7 kyu Kata so will be used by people who are just starting learning - I've been doing some 8 and 7 kyu Kata in other languages to teach myself their basics, and it gets confusing if types are used without being included. While having the includes there teaches by example what is required if you want to use them for another kata.

  • Default User Avatar

    Couple of small issues with the skeleton method you start with in C#:

    The return type is Boolean. It would be more normal to use the bool alias, but if Boolean is used there should be a:
    using System;
    line to allow the type to be found.

    Also one of the arguments is a List, which requires:
    using System.Collections.Generic;
    to find the type.

  • Default User Avatar

    C instructions for what to do with no results really need to be specififed. Having to hunt through comments to find out it wants a single string containing the text "None" was annoying.

  • Loading more items...