Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
Thanks that solved my problem.
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.
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.
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:
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.
[Edit: I discovered, though it's never mentioned in the instructions, that the terminating zeros must be delivered as well.]