# 16-bit binary grid

Given any unsigned 16 bit integer, convert its decimal form (i.e., base-10) number into a 4x4 ASCII grid of its bits, with the most-significant bit (MSB) at the top left, least-significant bit (LSB) at bottom right, read across and then down (like English text).

## Examples

### Input: 4242

+---+---+---+---+
|   |   |   | # |
+---+---+---+---+
|   |   |   |   |
+---+---+---+---+
| # |   |   | # |
+---+---+---+---+
|   |   | # |   |
+---+---+---+---+


### Input: 33825

+---+---+---+---+
| # |   |   |   |
+---+---+---+---+
|   | # |   |   |
+---+---+---+---+
|   |   | # |   |
+---+---+---+---+
|   |   |   | # |
+---+---+---+---+


## Specific Requirements

1. Input must be in decimal (base-10), however you may convert to binary any way you wish (including using language built-ins, if available).

2. Output table format must match exactly. This means you must use the specific ASCII characters (-, +, and |) for the table grid lines as shown, each cell's interior is 3 characters, and true bits are represented by # while false is represented by a space ().

3. Leading or trailing whitespace is not permitted. Final newline is required.

4. Bit order must match the examples as described.

## Allowances

1. Input must be a base-10 number on the command line, standard input, or user input, but must not be hard-coded into your source code.

May the clearest shortest code win! :-)

• Related Sep 18 '15 at 16:38
• The first sentence sounds confusing to me, where it says "convert its decimal form". Based on the rest of the post and the example, it looks like the input is given in decimal form, but you have to convert the binary form of the value into a grid. Sep 18 '15 at 16:44
• @RetoKoradi you are essentially correct, but the question does require you to convert a decimal number into a binary grid. There is no explicit requirement to ever work with a binary number, only a likely implementation detail. Sep 18 '15 at 17:53
• Does writing a function with the base-10 number as the function argument count as user input? Sep 18 '15 at 18:12
• Since you say that the given number is an "unsigned 16 bit integer", it is by definition in binary form. When I first read this, it actually sounded like the input would be given in binary form. It all becomes clear towards the end. But at least for me, the first paragraph really doesn't capture the problem at all. Sep 18 '15 at 18:20

a:TBa