python coding contest

Claudio Grondi claudio.grondi at freenet.de
Fri Dec 30 15:59:26 EST 2005


André wrote:
> For the few that might be interested, I will be posting the details of
> a 117 character long solution to the challenge on my blog
> http://aroberge.blogspot.com/.
> 
> Enjoy!
> 
> André
> 
It doesn't work for me as described on that page.
The output is scrumbled. It seems, that the 12 bytes long string ' _ 
|_|_ _| |' is the reason, as the index [11] to it gives '|' not the 
expected '| |'.

There are a total of 24 following 14 bytes strings possible for use in 
coding of indexes to all necessary character triples:

   '   | |_ _ _|_|'
   '   | |_|_ _ _|'
   '   |_ _ _| |_|'
   '   |_ _ _|_| |'
   '   |_| |_ _ _|'
   '   |_|_ _ _| |'
   ' _   | |_ _|_|'
   ' _   | |_|_ _|'
   ' _   |_ _| |_|'
   ' _   |_ _|_| |'
   ' _   |_| |_ _|'
   ' _   |_|_ _| |'
   ' _ _| |_   |_|'
   ' _ _| |_|_   |'
   ' _ _|_   | |_|'
   ' _ _|_   |_| |'
   ' _ _|_| |_   |'
   ' _ _|_|_   | |'
   ' _| |_ _   |_|'
   ' _| |_|_ _   |'
   ' _|_ _   | |_|'
   ' _|_ _   |_| |'
   ' _|_| |_ _   |'
   ' _|_|_ _   | |'

so I tried all which made sense in the context of '0' conversion and 
found out, that it should be the

   ' _   |_|_ _| |'

not the at http://aroberge.blogspot.com/

   ' _ |_|_ _| |'

given one to make the described algorithm work as expected.
Anyway, the code with the two bytes longer string is 117 bytes long, so 
the announcement of a 117 bytes long code keeps what it promises.

Excellent work!

What I wonder about is, how the author arrived at that solution? Trying 
all of the 24 available 14 byte strings to see which one produces the 
coding table which can be used as it was used? Trial-and-error over 
using division, modulo, shifting, masking? What was the path of thought 
to arrive at that? Knowing the solution seems to be of little value if 
not knowing how to arrive at it when a similar problem comes up in the 
future.

Claudio
P.S. By the way: on Windows XP with UltraEdit there was no problem to 
input the special characters. There is an ASCII table and a HEX editor 
mode available for it. Any hints which free editor makes it possible, too?



More information about the Python-list mailing list