174 166 106 97 bytes
94 bytes for the code + 3 bytes for the flag (
-w) which allows execution without input.
!ZZZZZZZZZZZZt |))))))x)))))f |)xx)x-))xxxa |)))))-))x))c )))))x-))))g )-))))-x)xd b e^b^e
Chip is a 2D language inspired by integrated circuits, input and output are broken down into individual bits which travel through gates and across wires.
Ungolfed (134 bytes):
!ZZZZZZZZZZZZt xxxxxxxxxxxxxh )))))xx)))))xg x))))))x)))))f xxxxxxx)x)xxxe )x))))xx)x)xxd x)))))x))x))xc xxxx)xx)))xxxb x)xx)xx))xxx)a
How the ungolfed version works:
This implementation encodes the target string
Hello, World! as a bit matrix, somewhat reminiscent of core memory. The leftmost column of
x's corresponds to
H in the output, the rightmost column to
) is an Or-gate (mapping to a 1 in the output), and the
x is a wire crossing (mapping to a 0).
The first row is for timing, and the remaining rows are for each of the bits of the output (the row ending in
h is the highest bit, and
a is the lowest).
The timing behavior starts with the
! produces a single 1-cycle pulse at the beginning of execution. The line of
Zs then control the left-to-right propagation of the signal at a rate of one element per cycle, each one corresponding to the transition between consecutive letters of the output. Each
Z also sends a signal to the column below. At the end of the timing row is
t, which terminates the program, preventing infinite output of null characters at the end.
In the first cycle, the first data column is powered. We see OR-gates (
)) on the rows for bits
g, turning them on; the remaining bits stay off because the wire crosses (
x) won't propagate the signal from the top to the left. This gives us
01001000, which is
In the next cycle, only the second data column is powered. Rows
g turn on much like the bits in the first cycle, and the remaining bits are off. This gives us
01100101, which is
This continues all the way across to the right, giving the remainder of the output.
There's not a lot that could be done here, but there are a few things of note:
hrow is always off, so that can be eliminated.
- Each row can be trimmed on both ends, removing unnecessary
x's, so long as the timing signal can still be propagated downward to rows that need it below. This is why the rows are rearranged; to maximize the trimming that can occur.
- The construct
)ais equivalent to simply
a, so long as the signal did not need to be propagated downward from the OR-gate.
All other changes are just mashing things around to save single bytes.