An interactive web demonstration of the Hamming (7,4) single-error correcting code, based entirely on the original Mathematica notebook by Chen Avin.
Hamming(7,4) is a single-error correcting code that uses a 7-bit codeword to transmit four bits of data.
The sender computes three parity bits for each 4-bit data word, assembles the data and parity bits into a 7-bit codeword, and transmits this codeword. The receiver computes three parity check bits from the received 7-bit word.
If no error occurred in transmission, all three parity check bits will be zero. If a single bit has been changed in transmission, the value of the three parity bits (interpreted as a 3-bit binary number) will indicate the position of the error, which can then be corrected automatically.
This demonstration allows you to simulate a transmission:
-
Set Data Bits: Toggle the four data bits (
$d_1, d_2, d_3, d_4$ ) at the top to configure the word you want to transmit. -
Observe Encoding: Watch as the three parity bits (
$q_1, q_2, q_3$ ) are generated and packed into the Transmitted 7-bit word. - Introduce an Error: Use the interactive buttons to simulate a transmission error (flipping a single bit) at any position in the word, or choose None.
-
Observe Decoding: Watch the receiver calculate the parity checks (
$pc_1, pc_2, pc_3$ ) on the Received word to determine the Error Syndrome. - View Correction: The final corrected word is presented, flawlessly mirroring the original transmission even though an error occurred.
This project is built using:
- Pure HTML5 (Semantic table-based grid layout)
- CSS3 (Custom styling to match the original Mathematica interface)
- Vanilla JavaScript (Real-time logical bit manipulation and DOM updates)
Based on the original Mathematica Demonstration.