21
\$\begingroup\$

You have a 3x3 grid. Each cell can be colored black or white. Display all 512 of these colorings. Fewest bytes wins.

You can display the grids in any formation as long as they are visually separated and the spacing looks regular. You may use ASCII art or images. Any two distinct visible symbols or colors can be used for black and white. Any whitespace is fine as long as the result is visually correct.

Example output:

...
...
...

...
...
..X

...
...
.X.

...
...
.XX

...
...
X..

...
...
X.X

...
...
XX.

...
...
XXX

...
..X
...

...
..X
..X

...
..X
.X.

...
..X
.XX

...
..X
X..

...
..X
X.X

...
..X
XX.

...
..X
XXX

...
.X.
...

...
.X.
..X

...
.X.
.X.

...
.X.
.XX

...
.X.
X..

...
.X.
X.X

...
.X.
XX.

...
.X.
XXX

...
.XX
...

...
.XX
..X

...
.XX
.X.

...
.XX
.XX

...
.XX
X..

...
.XX
X.X

...
.XX
XX.

...
.XX
XXX

...
X..
...

...
X..
..X

...
X..
.X.

...
X..
.XX

...
X..
X..

...
X..
X.X

...
X..
XX.

...
X..
XXX

...
X.X
...

...
X.X
..X

...
X.X
.X.

...
X.X
.XX

...
X.X
X..

...
X.X
X.X

...
X.X
XX.

...
X.X
XXX

...
XX.
...

...
XX.
..X

...
XX.
.X.

...
XX.
.XX

...
XX.
X..

...
XX.
X.X

...
XX.
XX.

...
XX.
XXX

...
XXX
...

...
XXX
..X

...
XXX
.X.

...
XXX
.XX

...
XXX
X..

...
XXX
X.X

...
XXX
XX.

...
XXX
XXX

..X
...
...

..X
...
..X

..X
...
.X.

..X
...
.XX

..X
...
X..

..X
...
X.X

..X
...
XX.

..X
...
XXX

..X
..X
...

..X
..X
..X

..X
..X
.X.

..X
..X
.XX

..X
..X
X..

..X
..X
X.X

..X
..X
XX.

..X
..X
XXX

..X
.X.
...

..X
.X.
..X

..X
.X.
.X.

..X
.X.
.XX

..X
.X.
X..

..X
.X.
X.X

..X
.X.
XX.

..X
.X.
XXX

..X
.XX
...

..X
.XX
..X

..X
.XX
.X.

..X
.XX
.XX

..X
.XX
X..

..X
.XX
X.X

..X
.XX
XX.

..X
.XX
XXX

..X
X..
...

..X
X..
..X

..X
X..
.X.

..X
X..
.XX

..X
X..
X..

..X
X..
X.X

..X
X..
XX.

..X
X..
XXX

..X
X.X
...

..X
X.X
..X

..X
X.X
.X.

..X
X.X
.XX

..X
X.X
X..

..X
X.X
X.X

..X
X.X
XX.

..X
X.X
XXX

..X
XX.
...

..X
XX.
..X

..X
XX.
.X.

..X
XX.
.XX

..X
XX.
X..

..X
XX.
X.X

..X
XX.
XX.

..X
XX.
XXX

..X
XXX
...

..X
XXX
..X

..X
XXX
.X.

..X
XXX
.XX

..X
XXX
X..

..X
XXX
X.X

..X
XXX
XX.

..X
XXX
XXX

.X.
...
...

.X.
...
..X

.X.
...
.X.

.X.
...
.XX

.X.
...
X..

.X.
...
X.X

.X.
...
XX.

.X.
...
XXX

.X.
..X
...

.X.
..X
..X

.X.
..X
.X.

.X.
..X
.XX

.X.
..X
X..

.X.
..X
X.X

.X.
..X
XX.

.X.
..X
XXX

.X.
.X.
...

.X.
.X.
..X

.X.
.X.
.X.

.X.
.X.
.XX

.X.
.X.
X..

.X.
.X.
X.X

.X.
.X.
XX.

.X.
.X.
XXX

.X.
.XX
...

.X.
.XX
..X

.X.
.XX
.X.

.X.
.XX
.XX

.X.
.XX
X..

.X.
.XX
X.X

.X.
.XX
XX.

.X.
.XX
XXX

.X.
X..
...

.X.
X..
..X

.X.
X..
.X.

.X.
X..
.XX

.X.
X..
X..

.X.
X..
X.X

.X.
X..
XX.

.X.
X..
XXX

.X.
X.X
...

.X.
X.X
..X

.X.
X.X
.X.

.X.
X.X
.XX

.X.
X.X
X..

.X.
X.X
X.X

.X.
X.X
XX.

.X.
X.X
XXX

.X.
XX.
...

.X.
XX.
..X

.X.
XX.
.X.

.X.
XX.
.XX

.X.
XX.
X..

.X.
XX.
X.X

.X.
XX.
XX.

.X.
XX.
XXX

.X.
XXX
...

.X.
XXX
..X

.X.
XXX
.X.

.X.
XXX
.XX

.X.
XXX
X..

.X.
XXX
X.X

.X.
XXX
XX.

.X.
XXX
XXX

.XX
...
...

.XX
...
..X

.XX
...
.X.

.XX
...
.XX

.XX
...
X..

.XX
...
X.X

.XX
...
XX.

.XX
...
XXX

.XX
..X
...

.XX
..X
..X

.XX
..X
.X.

.XX
..X
.XX

.XX
..X
X..

.XX
..X
X.X

.XX
..X
XX.

.XX
..X
XXX

.XX
.X.
...

.XX
.X.
..X

.XX
.X.
.X.

.XX
.X.
.XX

.XX
.X.
X..

.XX
.X.
X.X

.XX
.X.
XX.

.XX
.X.
XXX

.XX
.XX
...

.XX
.XX
..X

.XX
.XX
.X.

.XX
.XX
.XX

.XX
.XX
X..

.XX
.XX
X.X

.XX
.XX
XX.

.XX
.XX
XXX

.XX
X..
...

.XX
X..
..X

.XX
X..
.X.

.XX
X..
.XX

.XX
X..
X..

.XX
X..
X.X

.XX
X..
XX.

.XX
X..
XXX

.XX
X.X
...

.XX
X.X
..X

.XX
X.X
.X.

.XX
X.X
.XX

.XX
X.X
X..

.XX
X.X
X.X

.XX
X.X
XX.

.XX
X.X
XXX

.XX
XX.
...

.XX
XX.
..X

.XX
XX.
.X.

.XX
XX.
.XX

.XX
XX.
X..

.XX
XX.
X.X

.XX
XX.
XX.

.XX
XX.
XXX

.XX
XXX
...

.XX
XXX
..X

.XX
XXX
.X.

.XX
XXX
.XX

.XX
XXX
X..

.XX
XXX
X.X

.XX
XXX
XX.

.XX
XXX
XXX

X..
...
...

X..
...
..X

X..
...
.X.

X..
...
.XX

X..
...
X..

X..
...
X.X

X..
...
XX.

X..
...
XXX

X..
..X
...

X..
..X
..X

X..
..X
.X.

X..
..X
.XX

X..
..X
X..

X..
..X
X.X

X..
..X
XX.

X..
..X
XXX

X..
.X.
...

X..
.X.
..X

X..
.X.
.X.

X..
.X.
.XX

X..
.X.
X..

X..
.X.
X.X

X..
.X.
XX.

X..
.X.
XXX

X..
.XX
...

X..
.XX
..X

X..
.XX
.X.

X..
.XX
.XX

X..
.XX
X..

X..
.XX
X.X

X..
.XX
XX.

X..
.XX
XXX

X..
X..
...

X..
X..
..X

X..
X..
.X.

X..
X..
.XX

X..
X..
X..

X..
X..
X.X

X..
X..
XX.

X..
X..
XXX

X..
X.X
...

X..
X.X
..X

X..
X.X
.X.

X..
X.X
.XX

X..
X.X
X..

X..
X.X
X.X

X..
X.X
XX.

X..
X.X
XXX

X..
XX.
...

X..
XX.
..X

X..
XX.
.X.

X..
XX.
.XX

X..
XX.
X..

X..
XX.
X.X

X..
XX.
XX.

X..
XX.
XXX

X..
XXX
...

X..
XXX
..X

X..
XXX
.X.

X..
XXX
.XX

X..
XXX
X..

X..
XXX
X.X

X..
XXX
XX.

X..
XXX
XXX

X.X
...
...

X.X
...
..X

X.X
...
.X.

X.X
...
.XX

X.X
...
X..

X.X
...
X.X

X.X
...
XX.

X.X
...
XXX

X.X
..X
...

X.X
..X
..X

X.X
..X
.X.

X.X
..X
.XX

X.X
..X
X..

X.X
..X
X.X

X.X
..X
XX.

X.X
..X
XXX

X.X
.X.
...

X.X
.X.
..X

X.X
.X.
.X.

X.X
.X.
.XX

X.X
.X.
X..

X.X
.X.
X.X

X.X
.X.
XX.

X.X
.X.
XXX

X.X
.XX
...

X.X
.XX
..X

X.X
.XX
.X.

X.X
.XX
.XX

X.X
.XX
X..

X.X
.XX
X.X

X.X
.XX
XX.

X.X
.XX
XXX

X.X
X..
...

X.X
X..
..X

X.X
X..
.X.

X.X
X..
.XX

X.X
X..
X..

X.X
X..
X.X

X.X
X..
XX.

X.X
X..
XXX

X.X
X.X
...

X.X
X.X
..X

X.X
X.X
.X.

X.X
X.X
.XX

X.X
X.X
X..

X.X
X.X
X.X

X.X
X.X
XX.

X.X
X.X
XXX

X.X
XX.
...

X.X
XX.
..X

X.X
XX.
.X.

X.X
XX.
.XX

X.X
XX.
X..

X.X
XX.
X.X

X.X
XX.
XX.

X.X
XX.
XXX

X.X
XXX
...

X.X
XXX
..X

X.X
XXX
.X.

X.X
XXX
.XX

X.X
XXX
X..

X.X
XXX
X.X

X.X
XXX
XX.

X.X
XXX
XXX

XX.
...
...

XX.
...
..X

XX.
...
.X.

XX.
...
.XX

XX.
...
X..

XX.
...
X.X

XX.
...
XX.

XX.
...
XXX

XX.
..X
...

XX.
..X
..X

XX.
..X
.X.

XX.
..X
.XX

XX.
..X
X..

XX.
..X
X.X

XX.
..X
XX.

XX.
..X
XXX

XX.
.X.
...

XX.
.X.
..X

XX.
.X.
.X.

XX.
.X.
.XX

XX.
.X.
X..

XX.
.X.
X.X

XX.
.X.
XX.

XX.
.X.
XXX

XX.
.XX
...

XX.
.XX
..X

XX.
.XX
.X.

XX.
.XX
.XX

XX.
.XX
X..

XX.
.XX
X.X

XX.
.XX
XX.

XX.
.XX
XXX

XX.
X..
...

XX.
X..
..X

XX.
X..
.X.

XX.
X..
.XX

XX.
X..
X..

XX.
X..
X.X

XX.
X..
XX.

XX.
X..
XXX

XX.
X.X
...

XX.
X.X
..X

XX.
X.X
.X.

XX.
X.X
.XX

XX.
X.X
X..

XX.
X.X
X.X

XX.
X.X
XX.

XX.
X.X
XXX

XX.
XX.
...

XX.
XX.
..X

XX.
XX.
.X.

XX.
XX.
.XX

XX.
XX.
X..

XX.
XX.
X.X

XX.
XX.
XX.

XX.
XX.
XXX

XX.
XXX
...

XX.
XXX
..X

XX.
XXX
.X.

XX.
XXX
.XX

XX.
XXX
X..

XX.
XXX
X.X

XX.
XXX
XX.

XX.
XXX
XXX

XXX
...
...

XXX
...
..X

XXX
...
.X.

XXX
...
.XX

XXX
...
X..

XXX
...
X.X

XXX
...
XX.

XXX
...
XXX

XXX
..X
...

XXX
..X
..X

XXX
..X
.X.

XXX
..X
.XX

XXX
..X
X..

XXX
..X
X.X

XXX
..X
XX.

XXX
..X
XXX

XXX
.X.
...

XXX
.X.
..X

XXX
.X.
.X.

XXX
.X.
.XX

XXX
.X.
X..

XXX
.X.
X.X

XXX
.X.
XX.

XXX
.X.
XXX

XXX
.XX
...

XXX
.XX
..X

XXX
.XX
.X.

XXX
.XX
.XX

XXX
.XX
X..

XXX
.XX
X.X

XXX
.XX
XX.

XXX
.XX
XXX

XXX
X..
...

XXX
X..
..X

XXX
X..
.X.

XXX
X..
.XX

XXX
X..
X..

XXX
X..
X.X

XXX
X..
XX.

XXX
X..
XXX

XXX
X.X
...

XXX
X.X
..X

XXX
X.X
.X.

XXX
X.X
.XX

XXX
X.X
X..

XXX
X.X
X.X

XXX
X.X
XX.

XXX
X.X
XXX

XXX
XX.
...

XXX
XX.
..X

XXX
XX.
.X.

XXX
XX.
.XX

XXX
XX.
X..

XXX
XX.
X.X

XXX
XX.
XX.

XXX
XX.
XXX

XXX
XXX
...

XXX
XXX
..X

XXX
XXX
.X.

XXX
XXX
.XX

XXX
XXX
X..

XXX
XXX
X.X

XXX
XXX
XX.

XXX
XXX
XXX
\$\endgroup\$
  • \$\begingroup\$ @edc65 xnor made the edit, and Filipe approved it (after which I purged the comments). I just added tags. \$\endgroup\$ – Martin Ender Jun 9 '15 at 21:41
  • \$\begingroup\$ Can we move the example to a PasteBin? It’s anemic to scroll as of right now. Besides, this is just the power set of the input squared, divided into lines of the input where the 1s and 0s are replaced by X and . \$\endgroup\$ – Stan Strum Apr 14 '18 at 21:30

34 Answers 34

0
\$\begingroup\$

JavaScript (Node.js), 72 bytes

h=console.log;f=u=>h(u/4&1,u/2&1,u&1)|u/8;for(i=0;i<512;h``)f(f(f(i++)))

Try it online!

JavaScript (Node.js), 64 bytes

for(i=0;i<512;f(f(f(i++))))f=u=>console.log(u/4&1,u/2&1,u&1)|u/8

Try it online!

JavaScript (Node.js), 75 bytes

for(i=511;++i<1024;f(f(f(i))))f=u=>console.log(u.toString(2).slice(-3))|u/8

Try it online!

\$\endgroup\$
0
\$\begingroup\$

Perl 5, 48 bytes

say((sprintf"%09b",$_)=~s%...%$&$/%gr)for 0..511

Try it online!

\$\endgroup\$
0
\$\begingroup\$

Japt, 16 15 bytes

#f4o8³_¤Åò3 ·+R

Try it online!

\$\endgroup\$
0
\$\begingroup\$

Perl 5, 32 bytes

$_=("{.,#}"x3 .$/)x3;say<"$_\n">

Try it online!

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.