Pure Programmer
Blue Matrix


Cluster Map

Project: Punchcard Filter

Write a filter program that converts an input stream into a representation similar to old-style punchcards. Eight rows will be output with 77 columns. Each column in the output representing the bit pattern for one byte in the message. The least significant bit should be at the bottom and the most significant bit should be at the top. Use the LEFT HALF BLOCK Unicode character ('\u258c') to represent a bit that is on in the byte. Use a space for bits that are off. Use other box drawing characters to make the outline of a card around each group of 78 characters

See: [[Punched card]]

Output
$ node PunchcardFilter.js < ../../data/text/LoremIpsum256.txt ┌──────────────────────────────────────────────────────────────────────────────┐ │ │ │▌▌▌▌▌ ▌▌▌▌▌ ▌▌▌▌▌ ▌▌▌ ▌▌▌▌ ▌▌▌▌▌▌▌▌▌▌▌▌ ▌▌▌▌▌▌▌▌▌▌ ▌▌▌▌ ▌▌▌▌▌▌▌▌▌ ▌▌▌ ▌▌▌▌▌ │ │ ▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌ ▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌│ │ ▌ ▌▌▌ ▌ ▌ ▌ ▌ ▌ ▌ ▌▌ ▌ ▌ ▌ ▌ ▌▌ ▌▌▌ ▌ ▌ ▌▌▌ │ │▌▌ ▌ ▌ ▌ ▌▌▌ ▌ ▌ ▌ ▌▌ ▌ ▌ ▌▌ ▌▌ ▌ ▌ ▌ ▌ │ │▌▌ ▌▌ ▌▌ ▌▌▌▌ ▌ ▌▌▌▌ ▌▌ ▌ ▌▌▌▌▌ ▌ ▌▌ ▌▌ ▌▌ ▌ ▌▌ ▌▌▌ ▌ │ │ ▌▌ ▌ ▌ ▌▌ ▌ ▌▌▌▌ ▌ ▌ ▌▌ ▌▌ ▌ ▌ ▌ ▌ ▌ ▌ ▌ ▌ ▌ │ │ ▌ ▌▌ ▌ ▌▌▌ ▌ ▌ ▌▌ ▌▌▌ ▌▌ ▌▌▌ ▌ ▌▌ ▌ ▌ ▌▌▌▌ ▌ ▌ ▌ ▌▌ ▌ ▌ ▌ ▌ ▌▌▌▌ │ ├──────────────────────────────────────────────────────────────────────────────┤ │ │ │▌▌▌ ▌▌▌▌ ▌▌▌▌▌▌ ▌▌▌▌▌▌▌ ▌▌▌▌ ▌▌▌▌▌▌▌▌▌ ▌▌▌▌▌ ▌▌ ▌▌▌▌ ▌▌▌▌▌▌▌▌▌▌▌▌ ▌▌▌▌▌▌▌ ▌▌│ │▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌ ▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌ ▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌│ │ ▌ ▌ ▌▌▌ ▌ ▌ ▌ ▌▌ ▌ ▌ ▌▌ ▌ ▌ ▌ ▌▌▌ ▌ ▌ │ │▌ ▌ ▌ ▌ ▌ ▌ ▌ ▌ ▌ ▌ ▌▌ ▌▌ ▌ ▌▌ ▌ ▌ ▌ ▌▌│ │▌▌ ▌ ▌▌ ▌▌ ▌ ▌▌ ▌▌ ▌ ▌▌ ▌ ▌ ▌▌▌ ▌ ▌▌ ▌▌ ▌▌ ▌▌▌▌▌▌▌ ▌▌ ▌▌ ▌▌ ▌▌│ │▌ ▌ ▌▌▌ ▌ ▌ ▌ ▌ ▌ ▌▌ ▌ ▌ ▌ ▌ ▌ ▌ ▌▌ ▌ ▌│ │ ▌▌ ▌ ▌▌ ▌▌ ▌▌ ▌ ▌ ▌ ▌▌ ▌▌ ▌▌▌▌ ▌ ▌ ▌ ▌ ▌ ▌ ▌ ▌ ▌▌▌▌▌ ▌▌ ▌ ▌▌ ▌│ ├──────────────────────────────────────────────────────────────────────────────┤ │ │ │▌▌▌▌▌▌ ▌▌▌▌ ▌▌▌▌▌▌▌▌▌▌▌ ▌▌▌▌▌▌▌▌▌▌▌▌ ▌▌▌▌▌▌▌▌▌▌▌ ▌▌▌▌▌▌▌ ▌▌ ▌▌ ▌▌▌▌▌▌ ▌▌▌▌│ │▌▌▌▌▌▌▌▌▌▌▌▌▌ ▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌ ▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌ ▌▌▌▌▌▌▌▌▌▌▌▌▌ ▌▌▌│ │ ▌▌ ▌ ▌▌▌▌ ▌▌ ▌ ▌▌ ▌▌▌▌ ▌▌ ▌ ▌ ▌ ▌▌▌▌ ▌ ▌ │ │ ▌ ▌ ▌▌▌▌ ▌ ▌ ▌▌▌▌ ▌ ▌▌▌ ▌ ▌ ▌ ▌ ▌▌ ▌▌ ▌ ▌ ▌▌│ │ ▌ ▌ ▌▌ ▌▌ ▌ ▌▌▌ ▌ ▌▌▌ ▌▌▌ ▌▌ ▌ ▌▌▌ ▌ ▌▌▌▌▌ ▌ ▌ ▌▌ ▌ ▌▌▌│ │▌▌▌ ▌ ▌ ▌ ▌ ▌ ▌ ▌▌ ▌▌ ▌ ▌▌ ▌ ▌ ▌ ▌▌ ▌ ▌ ▌ ▌ ▌ ▌ ▌▌ │ │ ▌ ▌▌ ▌ ▌▌ ▌▌▌ ▌ ▌▌▌▌ ▌▌ ▌▌▌ ▌ ▌ ▌▌▌ ▌ ▌▌▌▌ ▌ ▌ ▌ ▌ ▌▌ ▌ ▌▌ ▌ │ ├──────────────────────────────────────────────────────────────────────────────┤ │ │ │▌▌▌▌▌▌▌▌ ▌▌▌▌▌▌▌ │ │▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌ │ │ ▌ ▌▌▌ ▌ ▌▌ │ │ ▌ ▌ ▌▌ │ │▌▌▌▌ ▌▌ ▌ ▌ ▌ │ │ ▌ ▌ ▌ ▌▌▌ │ │▌ ▌▌▌▌▌ ▌ ▌ ▌▌ │ └──────────────────────────────────────────────────────────────────────────────┘

Solution