Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
It is Hamming Code(3, 1). It was already disscused somewhere...
The encoding method in this Kata does not use Hamming Code, as claimed by the description and title. The encoding is just a simple repetition code/majority voting.
See Hamming(7,4) code - Message encoding for a Kata which actually uses Hamming Code.
This Kata should ideally be changed to remove mentions of Hamming Code.
See also:
But the descripition doesn't say to do what you are doing anywhere. Nowhere in the description does it say to compare two different bits, as you are doing, you do not need to compare two different bits. In other words, you do not need knowledge of the previous or next bit in order to encode the next pit/land.
Again the key is "a change from pit to land or land to pit indicates a one, while no change indicates a zero"
So bit 1 = L (if the previous indent was P) or P (if the previous indent was L) and bit 0 = L (if the previous indent was L) or P (if the previous indent was P)
As per the description: "a change from pit to land or land to pit indicates a one, while no change indicates a zero"
So in the example, "PL" encodes 1, "LL" encodes 0, "LP" encodes 1. "PP" encodes 0.