python coding contest

Claudio Grondi claudio.grondi at freenet.de
Fri Dec 30 13:55:58 EST 2005


roberto.alsina at gmail.com wrote:
> Thomas Heller wrote:
> 
>>X=' _ _ _  |  _| _ |_|_    '
>>Y=0x23018F406A3530EC273F008
>>j="".join
>>seven_seg=lambda n:j(j(c)+"\n"for c in zip(*[X[Y>>m+int(d)*9&7::8]for d in n for m in(6,3,0)]))
> 
> 
> Interesting bit:
> 
> Although there are more 3-char combinations when you read vertically,
> they compact better.
> 
> If A=" ", B="_" and C="|", this 12 char string contains al possible
> combinations:
> 
> BBBABAAACACC
> 
> which is 2 chars shorter than the best for horizontal combinations:
> 
> ABAAACBABCBCAC
> 
> Still, I don't think this vertical idea can go below 123 or 124, but
> it's good :-)
> 
> Now I wonder what the 119 solution is!
> 
I suppose the known 120 solution twisted to work with a one byte shorter 
string as you already found it out providing one example of it above, 
right?  :-)

Claudio



More information about the Python-list mailing list