Ad
  • Custom User Avatar

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

  • Custom User Avatar

    Ah. A fatal flaw... you may have to write a new kata to fix it, unfortunately. Unless you can get hold of someone on the CW team. They're about. Somewhere... They should be able to discuss the situation and unlock it if necessary.

  • Default User Avatar

    I was just trying to add some more tests but have an information that "Test cases can no longer be edited for this kata". Sorry

  • Custom User Avatar

    rlubinsky, your code simply does not work with number==1. And 1 is a proper power of 4 (4**0), that's all :)

    Also, I would completely rethink your algo for checking it, but it could work that way too, provided you consider this kind of cases.

    Oh and as the creator could pass by: I kumited the Python version; any idea how it works to get it approved? I mean, if it is up to you, it becomes some kind of beta or what.

  • Custom User Avatar

    Could you add a reply with your code, and marked as "spoiler"? It will make it easier to help.

  • Custom User Avatar

    Same problem here but with the JS version

    powerOf4
    powerOf4 should be defined
    Test Passed
    should return true for powers of 4
    Test Passed
    Test Passed
    Test Passed
    Test Passed
    should return false for non powers of 4
    Test Passed
    Test Passed
    Value is not what was expected
    Value is not what was expected
    Test Passed
    Test Passed
    Test Passed
    should return false for non positive integer inputs
    Test Passed
    Test Passed
    Test Passed
    Test Passed
    Test Passed
    Test Passed
    Test Passed
    Test Passed
    Test Passed

  • Custom User Avatar

    You could add numeric strings, such as "4", which shouldn't pass, but would with some existing solutions.

  • Custom User Avatar

    I'm not much proficient with Ruby, but my check to see if it is numeric just works fine.

    Btw, I presume you solved it by now, but what was your original code?

  • Custom User Avatar

    I presume you are using Ruby; care to provide us with your code? And consider the extra tests when submitting also include not integer arguments.

  • Custom User Avatar

    I'm not sure what I'm missing as my tests pass but when I submit it fails and it's not telling me why...

  • Custom User Avatar

    I kumited a Python translation; let me know if it is ok with tests and stuff :)

  • Custom User Avatar

    exactly ! expect(powerOf4(20), false) should be included in tests

  • Custom User Avatar

    Technically speaking, 1 is a proper power of 4 (4**0 in Python notation), so I would add a specific requirement for it to have an exponente greater than 0 in the description of the kata for js.

    Edit: and the Ruby version accepts the 1 as a true multiple of 4, so it makes little to no sense to consider it a false in js.

  • Default User Avatar

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