Ad
  • Default User Avatar

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

  • Default User Avatar

    Looks like this is a faulty test case (for Golang)

    {"mov a 1", "mov b 1", "mov c 0", "mov d 26", "jnz c 2", "jnz 1 5", "mov c 7", "inc d", "dec c", "jnz c -2", "mov c a", "inc a", "dec b", "jnz b -2", "mov b c", "dec d", "jnz d -6", "mov c 18", "mov d 11", "inc a", "dec d", "jnz d -2", "dec c", "jnz c -5"}

    Once the iteration reaches index 13 (counting from 0), the "jnz b -2" moves to "inc a" and does so until "b" reaches zero. Then it goes to index 16 and executes "jnz d -6" going back to "mov c a". Everything works fine until it reaches index 12 and executes "dec b". "b" is no longer 0 so instruction at index 13 is executed again and again and ... well it's an infinite loop now. Please correct me if I misunderstood how "jnz" works.

  • Default User Avatar

    So why same test cases are passed as sample tests?

  • Default User Avatar

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

  • Default User Avatar

    Yes, my bad. TY

  • Default User Avatar

    Looks like Golang tests are broken:

    codewarrior/kata_test [codewarrior/kata.test]

    ./kata_test.go:17:5: undefined: items
    ./kata_test.go:18:4: undefined: result
    ./kata_test.go:19:4: undefined: k
    ./kata_test.go:20:11: undefined: items
    ./kata_test.go:20:17: undefined: k
    ./kata_test.go:20:19: undefined: result

  • Default User Avatar

    It would be nice to have "Regular Expressions" tag added here

  • Default User Avatar

    A lot of 7 kyu katas from g964 are more difficult than this one (at least for Bash). All because of complex math that those are built upon. It is safe to assume they have a math background and those tasks are trivial in their opinion. I think that warriors who do not know math and have attempted those katas would agree it's not that trivial. Some might say: "Just skip the katas". The problem is, for some niche languages (e.g Bash, Lua, Powershell) there's not really any choice, i.e most katas for these languages are provided by g964. It can also be quite difficult to deal with floats in Bash if you are not using external tools (e.g AWK, Perl) which you can use here but that's not what you want to do sometimes and CW does not support shells that handle floats accurately (e.g fish).

    So my request to g964: please consider adding more katas that deal with strings, arrays, loops, conditionals, regex, anything but not numbers, mathematics, algebra, geometry and similar topics. This kata is a perfect example of a Bash coding challenge that a Sysadmin or a DevOps would look for.

  • Default User Avatar

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

  • Default User Avatar

    I was an issue with my code. Thanks for looking into it.

  • Default User Avatar

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

  • Default User Avatar

    Any hint on how to avoid timeout (in bash)?

  • Default User Avatar

    Can this kata actually be solved in bash? Options I could find for converting float to int just truncate the floating part which is obviously not the right way of doing it. Can anyone suggest a proper tool for this in bash?

  • Default User Avatar

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

  • Default User Avatar

    This kata deserves higher ranking

  • Loading more items...