From a8d655030d8d76ee837fbf784ddc612f1fd8d556 Mon Sep 17 00:00:00 2001 From: gmcew <97335456+gmcew@users.noreply.github.com> Date: Tue, 27 Aug 2024 19:58:34 +0100 Subject: [PATCH 1/2] Further tweaks to Hamming phrasing Emphasise on difference between Wiki default [7,4] Hamming code and the structure used in-game --- src/data/codingcontracttypes.ts | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/data/codingcontracttypes.ts b/src/data/codingcontracttypes.ts index 60579a3994..85817f5a67 100644 --- a/src/data/codingcontracttypes.ts +++ b/src/data/codingcontracttypes.ts @@ -1295,18 +1295,20 @@ export const codingContractTypesMetadata: ICodingContractTypeMetadata[] = [ `${n} \n\n`, "Convert it to a binary representation and encode it as an 'extended Hamming code'.\n ", "The number should be converted to a string of '0' and '1' with no leading zeroes.\n", - "A parity bit is inserted at position 0 and at every position N where N is a power of 2.\n", + "An 'extended Hamming code' has an additional parity bit to enhance error detection and correction.\n", + "A parity bit is inserted at every position N where N is a power of 2, with the additional parity bit at position 0.\n", "Parity bits are used to make the total number of '1' bits in a given set of data even.\n", - "The parity bit at position 0 considers all bits including parity bits.\n", "Each parity bit at position 2^N alternately considers N bits then ignores N bits, starting at position 2^N.\n", + "The additional parity bit at position 0 considers all bits including parity bits.\n", "The endianness of the parity bits is reversed compared to the endianness of the data bits:\n", "Data bits are encoded most significant bit first and the parity bits encoded least significant bit first.\n", - "The parity bit at position 0 is set last.\n\n", + "The additional parity bit at position 0 is set last.\n\n", "Examples:\n\n", "8 in binary is 1000, and encodes to 11110000 (pppdpddd - where p is a parity bit and d is a data bit)\n", "21 in binary is 10101, and encodes to 1001101011 (pppdpdddpd)\n\n", "For more information on the 'rule' of encoding, refer to Wikipedia (https://wikipedia.org/wiki/Hamming_code)", - "or the 3Blue1Brown videos on Hamming Codes. (https://youtube.com/watch?v=X8jsijhllIA)", + "or the 3Blue1Brown videos on Hamming Codes. (https://youtube.com/watch?v=X8jsijhllIA)\n", + "NOTE: The wikipedia entry does not cover the specific 'extended Hamming code' structure used in this contract.", ].join(" "); }, gen: (): number => { @@ -1329,13 +1331,14 @@ export const codingContractTypesMetadata: ICodingContractTypeMetadata[] = [ `'${n}' \n\n`, "Decode it as an 'extended Hamming code' and convert it to a decimal value.\n", "The binary string may include leading zeroes.\n", - "A parity bit is inserted at position 0 and at every position N where N is a power of 2.\n", + "An 'extended Hamming code' has an additional parity bit to enhance error detection and correction.\n", + "A parity bit is inserted at every position N where N is a power of 2, with the additional parity bit at position 0.\n", "Parity bits are used to make the total number of '1' bits in a given set of data even.\n", - "The parity bit at position 0 considers all bits including parity bits.\n", "Each parity bit at position 2^N alternately considers 2^N bits then ignores 2^N bits, starting at position 2^N.\n", + "The additional parity bit at position 0 considers all bits including parity bits.\n", "The endianness of the parity bits is reversed compared to the endianness of the data bits:\n", "Data bits are encoded most significant bit first and the parity bits encoded least significant bit first.\n", - "The parity bit at position 0 is set last.\n", + "The additional parity bit at position 0 is set last.\n", "There is a ~55% chance for an altered bit at a random index.\n", "Find the possible altered bit, fix it and extract the decimal value.\n\n", "Examples:\n\n", @@ -1343,7 +1346,8 @@ export const codingContractTypesMetadata: ICodingContractTypeMetadata[] = [ "'1001101010' fails the parity checks and needs the last bit to be corrected to get '1001101011',", "after which the data bits are found to be 10101, which is 21 in binary.\n\n", "For more information on the 'rule' of encoding, refer to Wikipedia (https://wikipedia.org/wiki/Hamming_code)", - "or the 3Blue1Brown videos on Hamming Codes. (https://youtube.com/watch?v=X8jsijhllIA)", + "or the 3Blue1Brown videos on Hamming Codes. (https://youtube.com/watch?v=X8jsijhllIA)\n", + "NOTE: The wikipedia entry does not cover the specific 'extended Hamming code' structure used in this contract.", ].join(" "); }, gen: (): string => { From 80f5ecffe2d8920b6814ff2da24876505cd94120 Mon Sep 17 00:00:00 2001 From: gmcew <97335456+gmcew@users.noreply.github.com> Date: Wed, 28 Aug 2024 18:31:31 +0100 Subject: [PATCH 2/2] Correction to extended Hamming code error detection. --- src/data/codingcontracttypes.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/data/codingcontracttypes.ts b/src/data/codingcontracttypes.ts index 85817f5a67..0d65c08797 100644 --- a/src/data/codingcontracttypes.ts +++ b/src/data/codingcontracttypes.ts @@ -1295,7 +1295,7 @@ export const codingContractTypesMetadata: ICodingContractTypeMetadata[] = [ `${n} \n\n`, "Convert it to a binary representation and encode it as an 'extended Hamming code'.\n ", "The number should be converted to a string of '0' and '1' with no leading zeroes.\n", - "An 'extended Hamming code' has an additional parity bit to enhance error detection and correction.\n", + "An 'extended Hamming code' has an additional parity bit to enhance error detection.\n", "A parity bit is inserted at every position N where N is a power of 2, with the additional parity bit at position 0.\n", "Parity bits are used to make the total number of '1' bits in a given set of data even.\n", "Each parity bit at position 2^N alternately considers N bits then ignores N bits, starting at position 2^N.\n", @@ -1331,7 +1331,7 @@ export const codingContractTypesMetadata: ICodingContractTypeMetadata[] = [ `'${n}' \n\n`, "Decode it as an 'extended Hamming code' and convert it to a decimal value.\n", "The binary string may include leading zeroes.\n", - "An 'extended Hamming code' has an additional parity bit to enhance error detection and correction.\n", + "An 'extended Hamming code' has an additional parity bit to enhance error detection.\n", "A parity bit is inserted at every position N where N is a power of 2, with the additional parity bit at position 0.\n", "Parity bits are used to make the total number of '1' bits in a given set of data even.\n", "Each parity bit at position 2^N alternately considers 2^N bits then ignores 2^N bits, starting at position 2^N.\n",