fix Hollerith encoding
Submit
Language is selected by the extension of the file. See the list of supported languages to know the extension of your language.
Problem
The CLC-INTERCAL compiler <i>sick</i> accepts not only ASCII (actually, LATIN1 or ISO-8859-1, in <i>iconv</i> command on my Termux), but also EBCDIC, extended Baudot, and a punched cards encoding Hollerith; CLC-INTERCAL program can be written in such many encodings, so it's pretty adaptable for many environments.
The problem is, however, that Hollerith character encoding is implemented incorrectly so we have to make source compatible with the implementation.
Here are sources that work on ACTUAL sick compiler, but when the software were to be updated, they won't work like they used to.
So your task is to update the source to correct Hollerith encoding so that it works when CLC-INTERCAL were updated.
<h2>How Hollerith encoding works</h2>
<ul>
<li>A pair of octets represents one character.</li>
<li>Each character is represented by twelve punch lines.</li>
<li>Each punch line is represented by a bit.</li>
<li>Two most significant bits on each octed are ignored.</li>
<li>Six rest bits on first octet contains punch line 12, 0, 2, 4, 6, 8.</li>
<li>Six rest bits on second octet represents line 11, 1, 3, 5, 7, 9.</li>
<li>A bit 1 means the line is punched while 0 means it is not.</li>
</ul>
<h2>How it is implemented</h2>
Lines 11 and 12 are swapped. Even those two lines were fixed back, the order of lines documented would not match with that of implementation.
Here is how it is implemented, from most to least significant bits.
Each hyphen means to be ignored.
Each number represents line number.
<table border>
<tr>
<td>1st octet</td>
<td>-</td>
<td>-</td>
<td>11</td>
<td>8</td>
<td>6</td>
<td>4</td>
<td>2</td>
<td>0</td>
</tr>
<tr>
<td>2nd octet</td>
<td>-</td>
<td>-</td>
<td>12</td>
<td>9</td>
<td>7</td>
<td>5</td>
<td>3</td>
<td>1</td>
</tr>
</table>
<h2>Problem</h2>
Given the string encoded in incorrectly implemented Hollerith character set, convert to the correct one.
<h3>How it should be corrected</h3>
Here is the correct Hollerith encoding (as on this problem). Note each hyphen means to be unchanged.
<table border>
<tr>
<td>1st octet</td>
<td>-</td>
<td>-</td>
<td>12</td>
<td>0</td>
<td>2</td>
<td>4</td>
<td>6</td>
<td>8</td>
</tr>
<tr>
<td>2nd octet</td>
<td>-</td>
<td>-</td>
<td>11</td>
<td>1</td>
<td>3</td>
<td>5</td>
<td>7</td>
<td>9</td>
</tr>
</table>
<h2>References</h2>
<ul>
<li><a href='https://groups.google.com/g/alt.lang.intercal/c/JFxcHOjY2lc'>My post on mailing list <i>alt.lang.intercal</i></a>. Discusses the bug of Hollerith character set.</li>
<li><a href='https://snapshot.debian.org/package/clc-intercal/1%3A1.0%7E4pre1.-94.-2-2/'>CLC-INTERCAL 1.-94.-2 Debian package</a>.</li>
<li></li>
</ul>
<h2>Disclaimer</h2>
This is just my idea of how the bug should be fixed.
<h2>Signature</h2>
-- 鳴神裁4.1号, 2021.10.21, 17:57 UTC+9.
If you have any suggestion or opinion, please post by any means; I may react to it to feedback for creating next problems.
Options
exec is denied
rejudge feature is enabled
now post-mortem time, all source codes will be revealed
Sample input:_
D`h@D`@dB`E@@h@pAB
Sample output:
d@B`d@`Dh@T@`B`APH
Sample input:_
@BPb@AD@@@PpCA@@T@Eh`HpPDdED@ddDCB@@BbPhDdPD@`AX`DHh@@`H`BAP
Sample output:
@HaH@PD@@@aAXP@@E@tB@bAadDTD`DDdXH@@hHaBdDAD`@PC@dbB@@@b@hPA
Sample input:_
R@AXPBS@x@EHM@U@DhL`T`aD
Sample output:
I@PCAHY@C`TBV@U@dBf@e@Pd
Ranking
Rank | User | Size | Time | Date | Statistics |
---|
1 | tails | 64 | 0.0457 | 2021/10/22 18:44:03 | 0B / 31B / 30B |
2 | test1 | 75 | 0.0446 | 2021/10/22 05:51:20 | 0B / ?B / ?B |
Rank | User | Size | Time | Date | Statistics |
---|
1 | lynn | 93 | 0.0936 | 2021/10/22 01:34:11 | 0B / 61B / 27B |
Rank | User | Size | Time | Date | Statistics |
---|
1 | btnlq | 86 | 0.1341 | 2021/10/22 03:30:36 | 0B / 49B / 32B |
Rank | User | Size | Time | Date | Statistics |
---|
1 | tails | 91 | 0.0403 | 2021/11/01 15:22:18 | 5B / 41B / 44B |
2 | 鳴神裁4.1号 | 145 | 0.0405 | 2021/10/21 17:54:02 | 0B / 80B / 65B |
Rank | User | Size | Time | Date | Statistics |
---|
1 | tails | 15 | 0.2061 | 2021/10/27 21:42:49 | 6B / 7B / 0B |
2 | whio | 18 | 0.2087 | 2021/10/27 00:38:14 | 8B / 7B / 1B |
Rank | User | Size | Time | Date | Statistics |
---|
1 | 鳴神裁4.1号 | 89 | 0.1198 | 2021/10/21 18:20:11 | 0B / 45B / 0B |
2 | tails | 89 | 0.1451 | 2021/10/21 21:07:39 | 0B / 45B / 0B |
3 | test1 | 89 | 0.1343 | 2021/10/22 05:51:36 | 0B / ?B / ?B |
Rank | User | Size | Time | Date | Statistics |
---|
1 | tails | 533 | 0.0511 | 2021/11/02 13:43:50 | 0B / 299B / 234B |
Rank | User | Size | Time | Date | Statistics |
---|
1 | tails | 28 | 0.0806 | 2021/11/02 15:27:06 | 19B / 5B / 4B |
Language Ranking_
Rank | Lang | User | Size | Score |
1 | gs2 | tails | 15 | 10000 |
2 | z80 | tails | 28 | 5357 |
3 | Perl | tails | 64 | 2343 |
4 | Python3 | btnlq | 86 | 1744 |
5 | FerNANDo | 鳴神裁4.1号 | 89 | 1685 |
6 | C | tails | 91 | 1648 |
7 | Python | lynn | 93 | 1612 |
8 | Lazy-K | tails | 533 | 281 |
return to the top page