Human Resource Machine

Human Resource Machine

View Stats:
Bear B Jan 15, 2016 @ 7:32pm
Zero terminated Sum, Is this a bug?
So I'm confused as to why the management expected a 0 for the last output.

After pic
http://steamcommunity.com/sharedfiles/filedetails/?id=601339687

before pic
http://steamcommunity.com/sharedfiles/filedetails/?id=601339729

As you can see in this before screenshot it should want the -4, am i suppose to do the -4 and then add a 0 at the end? I thought it would need a double 0 for it to want me to output a 0.
< >
Showing 1-11 of 11 comments
LVRonald Jan 16, 2016 @ 2:01am 
Your solution does not handle empty string properly, you throw away two 0's instead of one.
Last edited by LVRonald; Jan 16, 2016 @ 2:02am
Bear B Jan 16, 2016 @ 6:17pm 
Originally posted by LVRonald:
Your solution does not handle empty string properly, you throw away two 0's instead of one.

Thanks that solved my problem.
Stormcaller Feb 13, 2016 @ 12:58am 
to be fair, it should throw it, its a new string with a zero termination (no content)
thewifiwhisperer Feb 13, 2016 @ 3:43am 
As far as I know, it's the only place in the game where this condition (a string containing 0, being represented by double-0) actually is an input. You can shave off a few commands and steps in other programs that involve zero-terminated strings, by not bothering to check for this condition.

It's a pretty tedious edge case, anyway. Although in real life programming, I do know that escaping special characters and such is pretty important.
artificialintel Jul 3, 2016 @ 5:48pm 
I would say this is simply a bug, as there's no way to make it logical. The boss of the level specifically says "And yes, sadly, this all means that a string can NOT contain the number ZERO." It would make no sense to have a special string that's just a single zero unless the output is also supposed to be zero terminated and the spec was allowing for passing a null string through the output. Since there's no requirement in the level to zero terminate non-null strings, that exception doesn't fly either. Granted, they can write the level requirements however they like and work this weird edge case into them, but they'd have to do so explicitly, which they don't in my version of the game.
Subscribenstein Mar 21, 2017 @ 6:33pm 
Seems like BS to specifically instruct the player that a string can't contain zeroes, then expect a string with a zero. :\
Murray Mar 22, 2017 @ 12:15am 
Originally posted by Muffins:
Seems like BS to specifically instruct the player that a string can't contain zeroes, then expect a string with a zero. :\
The string didn't have a zero exactly. It's the sum of an empty string that is zero.
mole sting May 28, 2017 @ 4:28am 
Originally posted by Murray:
Originally posted by Muffins:
Seems like BS to specifically instruct the player that a string can't contain zeroes, then expect a string with a zero. :\
The string didn't have a zero exactly. It's the sum of an empty string that is zero.
For anybody else who encounters this issue, I would like to reiterate that what Murray says is fact.

The specification states that you must return the sum of all zero-terminated strings.
A sum where the number of terms is zero is an empty sum. An empty sum has the value zero.
https://en.wikipedia.org/wiki/Empty_sum

If you click on either of the characters (yours or the manager), and select the demand "Give me an example?", you will see it demonstrated.
When a string is immediately terminated by a zero, the sum is zero and it must be returned.
I have added square brackets to the following example to identify the individual strings.
Each input string corresponds to a single output string, all in order.
Inputs: [1 2 3 0] [0] [0] [4 5 0]
Outputs: [6] [0] [0] [9]

Here are some suggestions:
When attempting your solution, consider different entry conditions for your "inbox" statement/s.
When zero is input, I recommend that you immediately output the sum, while if non-zero is input then you can continue with addition.
If your sum always begins with the first value in your string, you will always have a sum to read upon encountering your next zero.
More to the point, the termination character is a thrice useful part of every string: it is a free empty sum for subsequent termination characters, it is also a free zero for initializing sums and it terminates strings.

I hope that this is clear and useful.
Please ask any questions about this response if it is unclear.
Source: I'm not terribly experienced with assembly-like languages as they were only part of my studies, but I can work backwards from extensive experience with high-level languages.
Last edited by mole sting; May 28, 2017 @ 4:58am
mole sting May 28, 2017 @ 4:41am 
PS I think the default user interface is harder to deal with because I can only see 10 line-labels (the blank lines) or instructions at a time.
If you feel the same as I do, you may like to try copying programs into a text editor to see the underlying commands and then editing there. I find this to be clearer because I can use smaller font.
The game gives you a hint to do this when you copy a program.

Here is an example from the second level, where the goal was to read the input and output until empty:
-- HUMAN RESOURCE MACHINE PROGRAM -- a: INBOX OUTBOX JUMP a

You will notice that the line "a:" is the destination for a jump command. This is the line-label that I referred to at the start of this post.
You can even make up more complex label names.
For example:
"start:" for the entry point to your code,
"inc:" for incrementing (counting up),
"dec:" for decrementing (counting down).
I tested with a long alphanumeric (letters and numbers) label of 40 characters and it was fine, though I suspect long labels are frowned upon.
Last edited by mole sting; May 28, 2017 @ 4:54am
leftysrevenge Nov 20, 2018 @ 6:49pm 
I've run into this problem but, even accounting for extra 0s, management refuses to accept my final entry even though it fits the exact criteria as everything else. Exactly like that pictured.

[Edit: I discovered, though it's never mentioned in the instructions, that the terminating zeros must be delivered as well.]
Last edited by leftysrevenge; Nov 25, 2018 @ 10:55am
Supahtrupah Dec 28, 2023 @ 9:51am 
Simply put, if you find a 00 sequence, you cant just ignore it. You need to return 0, since the string is empty, the sum of its members is 0. That solved it for me.
< >
Showing 1-11 of 11 comments
Per page: 1530 50