-
-
Notifications
You must be signed in to change notification settings - Fork 552
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add intergalactic-transmission exercise #2543
base: main
Are you sure you want to change the base?
Conversation
|
||
Your job is to help implement the message sequencer to add the parity bit to the messages and the decoder to receive messages. | ||
|
||
The entire message, itself, is sequence of a number of bytes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The entire message, itself, is sequence of a number of bytes. | |
The message is a sequence of bytes. |
Your job is to help implement the message sequencer to add the parity bit to the messages and the decoder to receive messages. | ||
|
||
The entire message, itself, is sequence of a number of bytes. | ||
The transmitters and receivers can only transmit and receive one byte at a time, so parity bit needs to be added every eighth bit. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The transmitters and receivers can only transmit and receive one byte at a time, so parity bit needs to be added every eighth bit. | |
The transmitters and receivers can only transmit and receive one byte at a time, so a parity bit needs to be added every eighth bit. |
Also as a layperson, I’m already a bit confused by bit vs byte so we may want to simplify.
The transmitters and receivers can only transmit and receive one byte at a time, so parity bit needs to be added every eighth bit. | ||
The algorithm for adding the bits is as follows: | ||
1. Divide the message bits into groups of 7, starting from the left (the message is transmitted from left to right). | ||
2. If the last group has less than 7 bits, append some 0s to pad the group to 7 bits. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2. If the last group has less than 7 bits, append some 0s to pad the group to 7 bits. | |
2. If the last group has less than 7 bits, append 0s until that group has 7 bits. |
What are the 0s signifying?
1. Divide the message bits into groups of 7, starting from the left (the message is transmitted from left to right). | ||
2. If the last group has less than 7 bits, append some 0s to pad the group to 7 bits. | ||
3. For each group, determine if there are an odd or even number of 1s. | ||
4. If the group has even number of 1s or none at all, append a 0 to the group. Otherwise, append 1 if there is odd number. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
4. If the group has even number of 1s or none at all, append a 0 to the group. Otherwise, append 1 if there is odd number. | |
4. If the group has an even number of 1s or none at all, append a 0 to the group. Otherwise, append 1 if there is an odd number of 1s. |
|
||
The first group contains two 1s (an even number of 1s), so 0 is appended to the group. | ||
The second group has none, so append 0. | ||
The rest have three, so they append 1. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rest have three, so they append 1. | |
The rest have three each, so they append 1. |
@@ -0,0 +1,37 @@ | |||
# Instructions | |||
|
|||
Your job is to help implement the message sequencer to add the parity bit to the messages and the decoder to receive messages. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The double "to" in this sentence might be worth changing.
|
||
The first group contains two 1s (an even number of 1s), so 0 is appended to the group. | ||
The second group has none, so append 0. | ||
The rest have three, so they append 1. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drop the "they". There is no "them" in the other steps.
| C 0 | 0 0 | 7 1 | 1 B | E 1 | (in hex) | ||
``` | ||
|
||
Thus, the transmission sequence is 0xC0_00_71_1B_E1. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thus, the transmission sequence is 0xC0_00_71_1B_E1. | |
The resulting transmission sequence is `0xC0_00_71_1B_E1`. |
Just pushed updates. Ended up re-writing the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a couple of comments! Really looking forward to implementing this
|
||
But how? | ||
Scientists and engineers from across the universe have been battling this problem for eons. | ||
Entire cosmic AI superclusters churn through the data. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be past tense?
Entire cosmic AI superclusters churn through the data. | |
Entire cosmic AI superclusters churned through the data. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think present tense is right (the paragraph is in present tense).
This is a proposal for a parity bit exercise.
I've created a proof of concept: exercism/csharp#2398
Note, I wasn't quite sure how best to represent byte data in the JSON. I've used an array of strings with the hex values as Visual Code was telling me "expected comma" if I didn't use the string.