100
14
Consider a square of printable ASCII characters (code points 0x20 to 0x7E) for side length N, like the following (here, N = 6):
=\
g \
7
m+y "g
L ~
e> PHq
We also require each row and each column to contain at least 1 space and 1 non-space character. (The above example satisfies this.)
We define the negative of such a square, to be a square of the same size, where each space is replaced with a non-space and vice versa. E.g., the following would be a valid negative of the above example:
1234
a b cd
ZYXWV
!
{} [ ]
?
The choice of non-space characters is irrelevant (as long as they are from the printable ASCII range).
The Challenge
You're to write a program, with square source code with side length N > 1, which prints a negative of itself to STDOUT. Trailing spaces have to be printed. You may or may not print a single trailing newline.
The usual quine rules also apply, so you must not read your own source code, directly or indirectly. Likewise, you must not assume a REPL environment, which automatically prints the value of each entered expression.
The winner is the program with the lowest side length N. In the event of a tie, the submission with the fewest non-space characters in the source code wins. If there's still a tie, the earliest answer wins.
What about little variation: negative must be a program that print original program? :) – abc667 – 2014-12-28T23:23:47.203
@abc667 like this?
– Martin Ender – 2014-12-28T23:45:06.200Is it intentional that some lines in the example output are longer than others? The second line is 8 characters long (including the 2 trailing spaces), the fifth line 7 characters (one trailing space). Based on the description, I would have expected all lines to be 6 characters long. – Reto Koradi – 2015-10-04T05:19:42.797
I hope someone will do this in piet. – Domino – 2015-11-09T14:47:50.097
Is a function's return value accepted or should it be printed to STDOUT? – Paul Guyot – 2014-11-29T23:30:13.570
1@PaulGuyot For this challenge, please stick to full programs and STDOUT (as it's, loosely speaking, a quine variant). – Martin Ender – 2014-11-29T23:32:21.783
You should clarify that the board size must be N>0. I see that your example specifies N>1 (and did you mean N>=1?), but this is not in the rules proper. – imallett – 2014-11-30T06:11:35.917
2@imallett implied by "We also require each row and each column to contain at least 1 space and 1 non-space character". Wait. No. It isn't. Good point. It does imply N==0||N>1, though. – John Dvorak – 2014-11-30T06:38:24.933
@imallett That is supposed to be part of the rules, not the example (because my definition of negative only applies provided these constraints are fulfilled). Will clarify. – Martin Ender – 2014-11-30T08:25:18.500
Is a rectangle also a square in your definition? – justinpc – 2014-11-30T21:40:17.947
@jpcooper No, I'm asking for a square with N = width = height. – Martin Ender – 2014-11-30T23:22:54.410
@MartinBüttner What if each row has m initial non-space characters and n final space characters with (m+n) rows? Is it still not a square by your definition? – justinpc – 2014-12-01T09:00:59.980
1@jpcooper Yes, that's a square, but it doesn't satisfy "We also require each row and each column to contain at least 1 space and 1 non-space character." because the first m columns don't contain spaces, and the last n columns don't contain non-spaces. – Martin Ender – 2014-12-01T13:53:15.847
@MartinBüttner That is indeed true. – justinpc – 2014-12-01T19:06:17.010
Pity that you can't read your own source code, I had a 2x2 answer all revved up. – Nit – 2014-12-01T21:47:49.137