3
\$\begingroup\$

Yet another compression challenge... but it could still be interesting...


Rules

  • Write a program that reads a string of printable ASCII characters, and outputs that string (or most of it) compressed in a tweet-sized message.

  • Write a program that reads the encoded message and outputs the original message (or most of it)

  • External libraries are allowed, internet connection isn't allowed.


Judging

  • 80 pts: properly encode/decode 400 printable ASCII characters
    (since 400 ASCII characters == 2,800 bits == 140 UTF-16 characters)

  • +20 pts: properly handle end-of-string when the input is different than 400 chars
    (encoder's input === decoder's output)

  • +20 pts: code golfing.
    (20pts for the one who does the shortest code that is worth 100pts)

  • +infinity pts: properly encode/decode more than 400 printable ASCII characters (+1 point for each char encoded over 400)


Tests

Here are 400 random chars for the 100 pts challenge:

)!"k-;~|L?=`j'*VBcZ;$'LbRv?:8n.[fc2'"d.Qa>$Sv*)K2Ukq(Xh^9MJ>WeeKVy:FP}^9octSYSxHx%uqpM%51dAVUl$x5S4hG[\2(SN3'BGEt9(`|\jo >xd'k]F6wf"4a<SXLiFTR(4c]J$,uy;N9*f\c19Ww<~|WYY;vR<:#@86JhPRSg$9:wnVPpB\f3uvGWXDa>O%qcXo=q^%#e|9+j''6Rk=i&N5]U]zbvLDu%pz,=A}qZ+T^s/1V,_$-INH).BB].:GPQGwUe({oDT&h\Dk\L$d-T_,.#A4x nPY(zYgU&[W)T~hvta_n4,vCvBDl|KWUlUdqvNB_;#6b35$<g|f[%z(pgICW*E!?@xAS/Q^\@`#bm~fA1n@sbrR~uAUcw!9x:u/PN

Here are 10,000 random chars for the infinity points challenge:

EiAJ}%15Wl5#yc&xD38}>aU6B6zl@XB||'VS@AN<Q=h1OpeiTXTC"1Tx>WH?kG9Jl(%JN'?tXtjZiNS}vmpR+Qg7R2E4e4GiN'BXc9cKRDWUJW-.UeZ/Cd{=O7L<s\ ;7w?6|XmC*5M@ Tm(kdv}^\tm:NlQYfSl&a`Nw y;M\Jy~0I3iGJXbfJW*P{I\{.^/OY,\'} Kx#S-1V<P7)3L&rVV,p=s8\?Ni(qFM[t%o qId;%C}j6QH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,`1.nQFNtOut&VP@k(vrjBby%wTsRE|:=F]zTEG)bvICQ{lfI[p9:2hQD*<!^4"qQU7P7B1)i/u$*{v:{lH&C<!i3{;}yK_#qyZxeDgyE#hc<wSy3gd0!O'x<!{gTB:}P-!Kf@bEBZs[X>.+^x+wS;w!?!OJ~]fMH`K?-'1Ur_eK\:G)&>QVy"1eb9Ie?]UF17J<(Vt`2k6,?G=hG6h\T5KkDAwE$eV+|/W3m8$Ai|+E/w.]h*#\8Yi;WX-]*PBo,X'X@64KZ'4u_k~%Uwvrrkbo-g"vb@2gO}"garNwf&,V/!-43,figAwI9"=%jMtTQSBIOA%wI"1/S3sGLT/ExFbG1n(Qx6h4Edk"C+#Mv.{%h"C'[bM}wTw)*G,h\3dX6g!.T=ATKgpBuIh%<KZQ<#pvd9X?"tp6^)mB4Uf"~4\Q/wU0sUEQ!pejIR-irWQ;ul|Tyl}FH pF>1`vms#,Pl[Ex{XKy6$*s
\$\endgroup\$
  • 5
    \$\begingroup\$ Note that compressions don't work very well on random data. Seems like a stupid challenge for me because encoding random 400 chars into 140 chars is not possible in general. \$\endgroup\$ – Sulthan Nov 26 '13 at 15:09
  • \$\begingroup\$ Can you explain "400 ASCII characters == 2800 bits == 140 UTF-16 characters"? The first equivalence is ok (albeit pessimistic given that the requirement is only to encode printable ASCII), but the second requires that a UTF-16 character be able to store 20 bits. I think you're misunderstanding something about surrogates. \$\endgroup\$ – Peter Taylor Nov 26 '13 at 15:12
  • \$\begingroup\$ FWIW Twitter counts Unicode codepoints after NFC normalisation. However, if we're talking true Unicode that limits to the defined codepoints, of which there are just short of 2^16.75, so ignoring the overcounting due to normalisation's non-injective nature 140 codepoints is only enough for 356.9 printable ASCII characters. \$\endgroup\$ – Peter Taylor Nov 26 '13 at 15:21
  • \$\begingroup\$ Assuming @PeterTaylor's analysis is correct, you may want to consider changing every instance of 400 in your post with 356. \$\endgroup\$ – primo Nov 26 '13 at 15:55
  • \$\begingroup\$ @primo, I state that that's an optimistic calculation. The actual calculation would be a lot more complex, so I think that this question needs serious rethinking and am voting to close it. \$\endgroup\$ – Peter Taylor Nov 26 '13 at 16:25

Browse other questions tagged or ask your own question.