#!/bin/sh

# Example of coding using a (7,4) Hamming code, with transmission through
# a Binary Symmetric Channel with error probability of 0.05.
#
# This example shows how random source messages can be encoded as codewords, 
# transmitted through the simulated channel, decoded, and the message bits
# extracted from the codewords.  The final result is in ham7b.ext, which can
# be compared to ham7b.src.

set -x -e # Echo commands as they are executed; stop if an error occurs
  
make-pchk ham7b.pchk 3 7 0:0 0:3 0:4 0:5 1:1 1:3 1:4 1:6 2:2 2:4 2:5 2:6
make-gen  ham7b.pchk ham7b.gen dense
rand-src  ham7b.src 1 4x1000
encode    ham7b.pchk ham7b.gen ham7b.src ham7b.enc
transmit  ham7b.enc ham7b.rec 1 bsc 0.05
decode    ham7b.pchk ham7b.rec ham7b.dec bsc 0.05 enum-bit ham7b.gen
verify    ham7b.pchk ham7b.dec ham7b.gen ham7b.src
extract   ham7b.gen ham7b.dec ham7b.ext
