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.
Your code is not correct, it does not handle nested
call
correctly.I seem to be running into the same problem. Have you ever been able to solve it?
This exercise has a good concept, but several aspects could be improved. First, the specification of function returns is unclear, which can lead to confusion, especially when dealing with recursive calls. Additionally, jump instructions and labels need more details, such as what to do if a label is undefined. There’s also a lack of proper validation for instruction parameters and error management. It would be helpful if the prompt provided more details on handling spaces, comments in the code, and how to properly concatenate values in the msg instruction.
nice bro really clever solution
I don't think the solver should be in the position that they end up not knowing how their solution is called. "Your code should handle THIS" and then doesn't say what "THIS" is. That's weird, and something about that is an issue with codewars in general.
But the
issue
tag comes with burden of proof and I didn't want that tag to be useful in debugging your code when replying within a few minutes.You are very likely printing multiple test cases.
I've found a way to work around it.
Then please tell me how I should print it. It'll be very helpful to me if I could get the actual input when trying to figure out where I went wrong. I might also be able to resolve the issue if it turns out I am doing it wrong.
I could add that my current way of doing it is like this:
I use the extra characters(aside from the variable s) in order to copy it into vsc easier. But I'll throw in the result I get with the normal way of doing it:
you're probably reading your test output wrong and mixing up test cases. also the formatting in your post is messed up :x
why this fail,it expect -1 but it doesn't jump to exit function since both not equal
mov i, 2 ; instruction mov i, 2
mov q, 12 ; instruction mov q, 12
call func
msg 'Random result: ', n
end
func:
cmp i, q
je exit
mov n, i
sub n, q
ret
; Do nothing
exit:
msg 'Do nothing'
I'm gonna go out on a limb and guess that whatever you're using to print the input is rather half-assed and that what you're showing ain't it.
I think there is an issue with the tests. Input:
In here, there are 4 registers, a, b, c, and d.
The test expects 3. c is left out. Going through it manually, it does seem like c is supposed to be processed on it's first occurrence "mov c 0"
I recieve the error message
thanks. didn't see the double instructions until today. it would be better to follow the step by step style of the program and say:
decrease by 1
decrease by 1
instead of "decrease its value by 2" which looks like an instruction call.
dec x
should decrease the value inx
by one. The example says "decrease by 2" because there are twodec a
in a row in the example program.ISSUE TYPO?:
dec x - decreases the content of the register x by one
=/=
decrease its value by 2,
should "dec" decrease by one or two?
Ok, just debugged for the last 1hour just to find out that when I remove my print Statements it works - since the max Buffer size was exeeded due to the log! ^^ LOL
Loading more items...