Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
jnz 5 10
->5
here is a constant, which is not zero, which means your next step should be jumping forward 10 steps, which ends the program.Not a kata issue.
I believe this test case if wrong: { "mov d 100", "dec d", "mov b d", "jnz b -2", "inc d", "mov a d", "jnz 5 10", "mov c a" }
When the code reaches the "jnz 5 10" no registers has the value 5.\
Breakdown:
mov d 100 -> d is 100
dec 9 -> d is 99
mov b d -> botb b and d are 99
jnz b -2 -> we decrease the value of d then copy d's value to b until d is 0, so d and b is 0 when we reach the "inc d" instruction
inc d -> d is 1 b is 0
mov a d -> d and a are 1, b is 0
jnz 5 10 -> no register has 5 as value
C# tests seem to be timing out on correct answer. Adding " " to output fails with only that as the error, but leaving it out times out every time.
the initial code tells you:
this is not what you are doing, you are putting a into
registers[0]
, b intoregisters[1]
, etcIn C, when I print the registers[] array inside the function, the output matches the expected results exactly (at least when running the first test cases). Despite this, the tests still fail, showing that the registers are zero, not matching the expected output. What is the correct way to modify the array, so that the test framework correctly evaluates the results?
I believe there is a forever loop in one of the test cases. Specifically the case:
On line 7 reg b gets its initial value of -9 from reg a. On line 10 it is decremented to -10. It is then decremented 8 more times. When I get to line 24 reg b is -18 so it has me go back 2 where it has me decrement it again to -19. By the time it overflows the Int32 to get back to 0 it has timed out.
Did I miss anything?
Thank you for answering. I have submitted my request.
You could save yourself the trouble by checking the list of available packages.
Additional packages can be requested by creating a ticket in the Codewars runner repository.
I decided to learn Rust's Nom crate. Got a nice solution up and running with Nom, only to experience that Nom is not accepted. Nom has 158+ million downloads, and I will suggest that any rustacean would consider Nom for a task like this.
Allow Rust Nom crate!
even better: just generate all 10000 digits first
Nice kata, too easy for 2kyu though
I don't understand neither: So if it's going out of range then selects the first (0) position again?
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
I have tested my program, and the complex_2 test says that the output should be {a=1, b=0, d=1}, and my output is {a=1, b=0, c=1, d=1}, and that is absolutely imposible, because if there's no letter c it wouldn't had added it to the map, so it has to be a letter c on the test. Which it would be nice to see what tests the program does, to prove them in the IDE and find errors.
Sorry for my english, i'm not native and i don't know speak very well.
Loading more items...