How to print the board

Hello,

I’ve got a question about “how to print the board” correctly.
This confusion again comes from the PDF, I guess. The PDF states:

Do not add additional whitespaces or new lines. (…) The last line must end with a single newline (’\n’).

I’ve understood that as follows:
→ We must not use ‘\n’ newline characters at all for any line end except for the last “separating” line
→ The output has to look the same like showed in the PDF and in the expected output of the corresponding test

The problem is: How am I supposed to “break” the lines after a “|” character without adding additional line-breaks? Is there anything I’ve maybe overread? Because without line-breaks, MIPS seems to print everything into a single line.

P.S: The attachment shows how I understood the assignment where the line-break has to be.

Thanks in advance!

Attachment:
image

I see where the confusion is coming from, but “Do not add additional whitespaces or new lines.” just means that you should not add any that do not match the example output.

Specifically, you will have to end every line with a \n in order to achieve the desired output, but you should not have any extra empty lines in between or at the end.

3 Likes

Yepp thanks. I tested it the way I understood it later and it works. My game is now playable. Thanks! :slight_smile:

2 Likes