|
41 | 41 | ## My struggle
|
42 | 42 |
|
43 | 43 | Quick google CCIR476 leads us to wiki page that explains that CCIR476 is a character enconding used in radio data protocol.
|
44 |
| -So seems like we should start by decoding message. Article itself is not too friendly and doesn't explain much (too many |
45 |
| -technical words without definition for my liking), but there is important bit it stats that CCIR 476 is a 7-bit encoding. |
46 |
| -This allows us quickly test if our input is indeed CCID476 message without investing hours in the wrong direction: |
| 44 | +So seems like we should start by decoding the message. Article itself is not too friendly and doesn't explain much (too many |
| 45 | +technical words without definition for my liking), but there is important bit: CCIR476 encodes each character as 7-bits. |
| 46 | + |
| 47 | +This allows us quickly test if our input is indeed CCID476 message or not without investing hours moving in the wrong direction: |
47 | 48 | length of input is 441 which is exactly 63 7bit words. Looks promising!
|
48 | 49 |
|
49 | 50 | Second link in google is https://blog.gcwizard.net/manual/en/ccitt-codes/08-what-is-ccir-476/
|
50 | 51 | Which contains table that can be used for decoding:
|
51 | 52 | 
|
52 | 53 |
|
53 |
| -So in first version I created alphabet with all characters I can understand and left others (CR, LTRS, FIGS) empty: |
| 54 | +So in the first iteration I created alphabet with all characters I can understand and left others (CR, LTRS, FIGS) empty: |
54 | 55 |
|
55 | 56 | !!! note "Interation 1"
|
56 | 57 | ```py
|
@@ -98,19 +99,19 @@ So in first version I created alphabet with all characters I can understand and
|
98 | 99 | print(letters[word], end="") # print letter from alphabet that corresponds to the sequence
|
99 | 100 | ```
|
100 | 101 |
|
101 |
| -The result is looking very promising, I can even read the sentence: |
| 102 | +The output made me excited, I can even read the sentence: |
102 | 103 | ```txt
|
103 | 104 | HHTHE QUPKKRSS ARE HELD QN FRCQLITY HQQOQQF
|
104 | 105 | ```
|
105 |
| -But some letters are wrong, and also according to description of the challenge result should start with `##`. So, how can we get |
106 |
| -from `HH` to `##`? Notice from encoding table has many columns and `1101001` is `H` in letters case, but `#` in `US TTYs` |
| 106 | +But some letters are wrong, and also according to description of the challenge answer starts with `##`. |
| 107 | + |
| 108 | +So, how can we get from `HH` to `##`? Notice in encoding table there are many columns and `1101001` is `H` in letters case, but `#` in `US TTYs` |
107 | 109 | (whatever that means).
|
108 | 110 |
|
109 |
| -Probably ignored so far characters CR, LTRS and FIGS could be helpful. Explanation is very obvious, but on the day it took |
110 |
| -quite a lot of trial and errors: |
| 111 | +Probably ignored so far characters CR, LTRS and FIGS could be helpful. Explanation is very obvious, but on the day it quite some digging: |
111 | 112 |
|
112 |
| -* LTRS - switches decoding into letters mode (ie after LTRS symbols all characters are letters until FIGS is encountered) |
113 |
| -* FIGS - switching decoding into figures mode (ie all characters from now will be symbols until LTRS is encountered) |
| 113 | +* LTRS - switches decoding into letters mode (ie after LTRS all characters are letters until FIGS is encountered) |
| 114 | +* FIGS - switching decoding into figures mode (ie all characters from now on will be symbols until LTRS is encountered) |
114 | 115 |
|
115 | 116 | Second alphabet added, slightly updated decoding logic:
|
116 | 117 |
|
@@ -201,8 +202,8 @@ Second alphabet added, slightly updated decoding logic:
|
201 | 202 |
|
202 | 203 | ```
|
203 | 204 |
|
204 |
| -The only thing not mentioned before is I used `'` instead of `BELL` character because its not clear what that one means and |
205 |
| -single quote grammatically made sense. |
| 205 | +The only thing not mentioned before is I used `'` instead of `BELL` character because its not clear what `BELL` means and |
| 206 | +single quote grammatically makes sense. |
206 | 207 |
|
207 | 208 | ## Epilogue
|
208 | 209 |
|
|
0 commit comments