Enter some text to generate a legacy computer punch card, encoded using the DEC9 alphabet.
This programming challenge comes from /r/dailyprogrammer. The goal is to create a program that will generate an ASCII art punchcard, encoded in the format shown below. The end result should include a near replica of the ASCII punch card, including diagonal notch and original message across the top.
Punch cards are an older form of recording computer programming instructions. Many people here may think of them from the early digital computing era, but they actually go back to fairground organs and textile mills in the 19th century! The format most of us are familiar with was originally patented by Hollerith, using stiff card stock. Over the years this format changed slightly and varied on this them, including a diagonal cut corner. For this challenge we'll focus on the tail end of punch cards with IBM, GE and UNIVAC type cards.To use them, a program would be transcribed to the punch cards. Each column represented a single character, 80 columns to the card, 12 rows to the column. The zone rows can be used to have two punches per column.
Each card vendor would have an alphabet, an array of characters that are numerically represented by the punches. Here's an example of the IBM model 026 keypunch, showing you the punch codes and the order in which they appear.
FORT +-0123456789ABCDEFGHIJKLMNOPQR/STUVWXYZ =' .) $* ,(
________________________________________________________________
/ -0123456789ABCDEFGHIJKLMNOPQR/STUVWXYZ . $ ,
12 / O OOOOOOOOO OOOOOO
11| O OOOOOOOOO OOOOOO
0| O OOOOOOOOO ? ? OOOOOO
1| O O O O
2| O O O O O ? ? O
3| O O O O O O O O
4| O O O O O O O O
5| O O O O O O O O
6| O O O O O O O O
7| O O O O O O O O
8| O O O O OOOOOOOOOOOOOOOOOOOOOOOO
9| O O O O
|__________________________________________________________________
You can see the first 12 characters are represented by a single punch, then the next 9 have two punches (with one in the upper zone), then the next 9 use the next zone as that second punch, the fourth 9 use the next zone as the second punch, then we start on the lower zone for the next sets of 6 with the upper zone punched increasingly.
DEC9 &-0123456789ABCDEFGHIJKLMNOPQR/STUVWXYZ:#@'="[.<(+^!$*);\],%_>?
3
Hello, world!
This is Reddit's r/dailyprogrammer challenge.
WRITE (6,7) FORMAT(13H HELLO, WORLD) STOP END
For this programming challenge, we're using the Digital Equipment Corporation DEC9 keypunch. The master deck is encoded as shown below.
DEC9 &-0123456789ABCDEFGHIJKLMNOPQR/STUVWXYZ:#@'="[.<(+^!$*);\],%_>>?
________________________________________________________________
/&-0123456789ABCDEFGHIJKLMNOPQR/STUVWXYZ:#@'="[.<(+^!$*);\],%_>?
12 / O OOOOOOOOO OOOOOO
11| O OOOOOOOOO OOOOOO
0| O OOOOOOOOO OOOOOO
1| O O O O
2| O O O O O O O O
3| O O O O O O O O
4| O O O O O O O O
5| O O O O O O O O
6| O O O O O O O O
7| O O O O O O O O
8| O O O O OOOOOOOOOOOOOOOOOOOOOOOO
9| O O O O
|__________________________________________________________________