Huffman Rover

Practise Huffman coding for Cambridge AS & A Level Computer Science 9618 as the rover decodes one movement command at a time.

How few bits can steer the rover to the beacon?

Press F, L, R and B to program a route from START (facing east) around the rocks to the beacon, and type codes in the codebook so that no code begins another. Press Run decoded transmission to see whether the rover reaches the beacon on the shortest valid bitstream.

Incoming bitstream

26 bits
decoder
reads here

Mars survey sector

Ready to decode. 7 bits above the shortest possible bitstream of 19 bits.

Program the rover

Huffman codebook

F
Forwardused 0 times
L
Leftused 0 times
R
Rightused 0 times
B
Backused 0 times

Valid prefix-free codebook.

Bitstream score

Current valid route
26 bits
73%

Teaching model inspired by the prefix-code rover example in 3Blue1Brown, “Reinventing Entropy”.