◄ WORLD V · SONNY 5DART 388 · a helldive at the net

THE GRAY CODE count with no carry — an ordering where each step flips exactly one bit

A binary counter, ticking from 0111 to 1000, flips four bits at once — and a carry rippling across all of them means, for a split instant, the wires disagree and the reading is garbage. The Gray code refuses the carry entirely: it reorders the numbers so that every step changes exactly one bit. g = x ⊕ (x>>1) converts binary to Gray; consecutive Gray codes are always one flip apart (Hamming distance 1). No multi-bit transition means no carry to ripple and no glitch to misread — which is why rotary encoders, ADCs, and Karnaugh maps use it. An ordering built to make the carry unnecessary.

THE TECHNIQUE g = x ⊕ (x>>1) ; consecutive codes differ in exactly one bit

The demo shows consecutive Gray codes differing by a single bit — g(5)=7, g(6)=5, Hamming distance 1 — the carry-free count: live demo


HISTORY & CREDIT Frank Gray, 1953 · Baudot 1878

“Counting flips many bits and ripples a carry.” — the Gray code reorders the count so every step flips exactly one bit: no carry, no transition glitch. cited

1878 · Émile Baudot — used a reflected code in telegraphy (a precursor).
1953 · Frank Gray (Bell Labs) — patented the reflected binary code for PCM.
reflected · built by mirroring the list and prefixing a bit — a palindromic construction; g = x ⊕ (x>>1).

Reorder the count so one bit changes at a time — no carry to ripple, no glitch to catch. A code that makes the carry unnecessary. Gray 1953

RECOMMEND FOR I-13 the single-bit step, on the compiler

On the canonical compiler, g(5)=7 and g(6)=5 differ in exactly one bit (Hamming distance 1) — the carry-free transition:

$ i13 run c_graycode.i13 # g = x ^ (x>>1) RUN OK · 134 step(s) · peak stack 5 · call depth 7 g5 = 7 g6 = 5 hamming = 1 -- consecutive Gray codes differ in exactly ONE bit: no carry
Recommend — the batch's keeper shot. Where every other dart manages the carry, the Gray code abolishes it: an ordering in which each step is a single-bit flip, so there is no carry to propagate and no multi-bit glitch to misread. The supplement looks real — a correct-but-different counter (plain binary) flips many bits and lacks the unit-Hamming property. The honest questions for the panel: (1) is “consecutive outputs differ by one bit” a structural output-relation invariant, or a property of the encoding/ordering (a resource-adjacent choice)? (2) the construction is the reflected binary code — built by mirroring — and g=x⊕(x>>1) with its inverse is an involution-flavoured pair; does it collapse into the self-inverse (CRC/Verlet) axis, the reflection the corpus already keeps? My honest read is NULL by that collapse — but it is the one dart in the batch whose property lives in the output sequence, not the cost, so it earns the panel.