6 kyu
Error Correction Codes
73 of 100mathsisfun
Loading description...
Algorithms
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
Pretty interesting programming concept, very funny.
JavaScript translation awaiting approval.
🖖
you should add to the description the equivalent linear string, used as input (below the second grid)
Done, I think. I also tried to make it look a bit better.
Here's one of the sample tests:
correct(2,3,'11011000001') === '11011000011'
Laid out, it looks like:
Shouldn't the last row consist of just
0
s since the number of1
s in each column is even?I recently had to change how I did it to resolve one of the issues raised, so the examples now look like:
Test.assert_equals(correct(2,3,'11111010001'), '11111010001') Test.assert_equals(correct(2,3,'11011010001'), '11111010001') Test.assert_equals(correct(2,3,'11111011001'), '11111010001') Test.assert_equals(correct(2,3,'11111010011'), '11111010001')
So it is '111110' + '10'(rows) + '001'(cols). laid out it looks like: 111 1 110 0 00 1 I think your looking at the previous versions of the examples, which made sense then because I was doing columns and rows the wrong way around.Marking question resolved.
seems like your random tests almost never swap one of the parity bits => you'll need to make those two cases much more current (for now, changes in the message and no changes at all represent like 95% of the whole batches of tests).
I've added another batch of random tests that only modify the parity bits. Does that work?
almost: the problem is that you announce to the user where the error will be ;)
=> you need to merge the 3 batches and pick randomly a strategy when you do one test. (note: is that necessary to do that many tests?)
I've changed it so that for the random cases, it randomly decides to either do no errors (20%), a message error (40%), or a parity error (40%), and have combined the larger and smaller tests into one batch.
I mostly am doing many tests because an answer which is almost correct might only fail in a small number of cases, and I wouldn't want slightly wrong answers to pass just because the case where they fail didn't come up in the testing.
I think you have your
m
andn
flipped through out the entire kata:In the standard terminology for matrices, M x N means M rows and N columns, not the opposite. See https://en.wikipedia.org/wiki/Matrix_(mathematics)
You're right. I believe I've now swapped the M and N to be correct, but it required many changes so I may have done it wrong :/
I'm pretty sure I've swapped them around now.