Output hint

Add a reply

Posted by flagitious 663 days ago:
Many of the challenges ask for a specific format in output, but your program's output is stripped of leading and trailing whitespace and so is the expected output. This means you can skip or have excess leading/trailing whitespace, which is sometimes to your advantage for problems.

Note: this is not true for all challenges, 99 bottles of beer is the only one I know of where you cannot have leading whitespace (but trailing is fine).
Posted by carldr 659 days ago:
That's actually a bug in Code Golf that you've found there! It's intended that we ignore trailing whitespace, but it should be that leading whitespace is significant. I imagine there are entries which take advantage of this, so I can't change it now.

However, any of the challenges where the goal is to merely match some output (Pascal's Triangle and as Flagitious mentioned, 99 Bottles, for example) will have leading space which is significant.
Posted by mick 657 days ago:
That's actually a bug in Code Golf that you've found there! It's intended that we ignore trailing whitespace, but it should be that leading whitespace is significant. I imagine there are entries which take advantage of this, so I can't change it now.

However, any of the challenges where the goal is to merely match some output (Pascal's Triangle and as Flagitious mentioned, 99 Bottles, for example) will have leading space which is significant.

Hmm...the ASCII Art challenge explicitly says:

Once you have processed each of the lines, the resultant grid should be printed to stdout. Each row in the grid which contains a non-empty cell should be output with any trailing spaces removed and a newline appended.

I just tried to resubmit my Python entry to that challenge with additional trailing whitespace, and it failed because of the extra whitespace.

Is this true only for certain languages/certain challenges?
Posted by mick 657 days ago:
That's actually a bug in Code Golf that you've found there! It's intended that we ignore trailing whitespace, but it should be that leading whitespace is significant. I imagine there are entries which take advantage of this, so I can't change it now.

However, any of the challenges where the goal is to merely match some output (Pascal's Triangle and as Flagitious mentioned, 99 Bottles, for example) will have leading space which is significant.

Another data point...I just tried Pascal's Triangle, and it seems to think that trailing whitespace is significant (in Python).

Are the runners for the different languages all using the same output matcher?
Posted by Mark Byers 657 days ago:
Trailing whitespace at the end of the output is OK, but trailing whitespace on a line that is not the last line is *not* OK.
Posted by blake8086 656 days ago:
Trailing whitespace at the end of the output is OK, but trailing whitespace on a line that is not the last line is *not* OK.

Otherwise we would have much short Pascal solutions! (that's a sort of oblique hint)

Add a reply