It seems that you're using an outdated browser. Some things may not work as they should (or don't work at all).
We suggest you upgrade newer and better browser like: Chrome, Firefox, Internet Explorer or Opera

×
In Level 21 the code works perfectly fine, but management keeps nagging about a wrong number.

The Code:
-- HUMAN RESOURCE MACHINE PROGRAM --

a:
COPYFROM 5
COPYTO 4
b:
INBOX
JUMPZ c
ADD 4
COPYTO 4
JUMP b
c:
COPYFROM 4
OUTBOX
JUMP a


DEFINE LABEL 4
eJzzZ2BgWG6h4ypmMc1plv4dB2aVZX618ooRwnJacdFyYcnzFKyzVmtOKonVflixVNug9ozWp5aLGg8m
uqmJzGVW2bR0nsL0NU2yXBtcJZ9tYBIvWftM+OoSoJEMlm7H6tc6WzZnOf7u8nTYM8nToW6Ws9Oq+R9c
s5ff9j288U2I0LbdkaZbt0brrgepn5p+rP5u+tl5KTl7Jt0sa2i8Wda/LKvcftHayqjZPPUzJ7u25vYt
6ZrQ+7CvdMrWiWfn9U1SXQnSV7U8pol7xdUla9dP6A3datl8e+ex+rQ9x+ol9q1ua9ofNNX04OGNtQen
r6k4LLP4zrGo2RdP6U9bejZoavh57ukHL3yYO+sixJz452oTGl8wTzz54nr3t6er20rvO3auuTFz8p5L
bQtmXdy0VPsS46ovN0y3/n6cdUDz3f9D3z8pH2IYBaNgGAAAzqGauQ;

For instance:
Inqueue
3,6,0
6,-2,7,0
0,0
2,-5,4,3,-2,1,0

Output
9
11
0
3

3 ist the correct sum, but look at the attached image.

Did I misunderstand something or is the management wrong?

Greetings, t.
Attachments:
avatar
gewe: 0,0
You write it as a 0-terminated string containing 0, but it's actually 2 0-terminated strings of length 0. So, management is right. However, looking at your code as posted, I don't see why it isn't producing the correct answer. Maybe I'll look at it again later when I have time to enter it and observe it in action.

edit: tested it, and it works right. Did you find your mistake yourself and correct it before you pasted it here?
Post edited February 01, 2020 by darktjm
Ah, I know, what you mean.
Will look into it tomorrow.
Lot of thanks for your input! :D
You're right, I tried to optimize the number of steps.
Which didn't work. Management is right and I'm a bad emloyee. ;)
The solution I posted works just fine.
Thank you for taking a look at it! :D