Shannon Source Coding: Symbol Probabilities, Huffman Codewords and Entropy Bound (2D)
A top view of the encoder with symbol-probability bars, the Huffman codeword of every symbol and the live encoded stream, plus charts of entropy against average code length and the effect of block extension. Same shared model as the 3D scene.
Build a symbol source and watch the best prefix code for it. Choose the alphabet size and how skewed the probabilities are (Zipf-like), and the Huffman algorithm assigns short codewords to common symbols and long ones to rare symbols. A stream of sampled symbols is encoded live; its measured bits per symbol converges to the exact Huffman average length, which always sits between the entropy H and H + 1. Block extension shows how coding pairs and triples closes the gap. A Blender-built encoder and numerical checks are included.
A top view of the encoder with symbol-probability bars, the Huffman codeword of every symbol and the live encoded stream, plus charts of entropy against average code length and the effect of block extension. Same shared model as the 3D scene.
2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install