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.
current JS version definitely does not have this problem.
can't say about Kotlin or Java one way or the other.
Hellfingers: no, your code is wrong. You're only checking if the boss's happiness is <= 5 or not, and that's not what you should be doing at all.
The java problem still has the same error
It looks that kotlin version works fine. If you still have an issue then check your coding once again or post your issue over github codewars help forum so we can try to help you;p
same with js
Same issue with the java random tests.
I'm having issues with random tests too :/
Is it an error in the exercise?
Done. Many thanks for finding that error.
unless the code isn't correctly written, all proc will end with a ret command. But yes. ;)
You need to mimic plain recursive calls. Meaning that when the first
ret
is executed, you go back to the lastcall proc_func
statement executed. Meaning, in that routine, you continue to read the commands after the call, then you end up on theret
inside thecontinue:
routinelabel, which sents you to the previouscall proc_func
statement executed, and again, and again, ... until you finallyret
from the first call of the routine and go back to the 5th line of the script, then print the result, then end the program.Meaning, you need to see those two routines as one single block:
equivalent to:
EDIT: note the difference in the names: one is called
proc_...
, meaning it will be "called" while the other is just a label used to mimic a GOTO statement.True. But for the purposes of this kata it seems entering another function (by parsing the commands sequentially), and calling
ret
inside that other function is deemed the same as calling a non-existantret
command insideproc_func
. At least, such logic lines up with the way this test case is structured.ok, went to it with a brain in better shape than last time... x)
This:
is actually equivalent to this:
and you have to keep track of the different levels of the calls to interpret that correctly.
all routines will always have a
ret
command somewhere (sometimes, the ret of onecall
ed routine is the one of another routine that you reach using a jump command instead of acall
one, as in the present case), so you have to go back to the location of the previouscall
command.EDIT: keep in mind that all registers are global variables, here.
As I understood that case, after you return inside
continue: ret
to thecall proc_func
(line 14), you will keep moving forward line-by-line and run into thecontinue: ret
on lines 16-17 again and again. This wayret
operation will be called enough times to return you back to line 5, and you should proceed to theend
operation normally.With what language version do you have this problem?
mmmmh... Correct, I had it wrong (did that one a fair amont of time ago, sorry...).
I don't have time right now to investigate further, sorry.
Loading more items...