# HG changeset patch # User Paul Boddie # Date 1441749523 -7200 # Node ID cf2a36920a982996ec745c3ee8c7da01c75826fd # Parent b8ace368e6c4d1b94a7f967e4d9f87790dd9dfa1 Made the colour scale more accurate/detailed. diff -r b8ace368e6c4 -r cf2a36920a98 optimiser.py --- a/optimiser.py Tue Sep 08 23:32:16 2015 +0200 +++ b/optimiser.py Tue Sep 08 23:58:43 2015 +0200 @@ -6,13 +6,13 @@ import sys def scale(v): - return (v + 64) / 128 + return (v + 43) / 85 def point(rgb): return tuple(map(scale, rgb)) def index(p): - return p[0] * 9 + p[1] * 3 + p[2] + return p[0] * 16 + p[1] * 4 + p[2] def colour(i): return (255 * (i % 2), 255 * ((i / 2) % 2), 255 * ((i / 4) % 2)) @@ -35,15 +35,22 @@ return by_frequency(bases)[0] tones = [ - "___", "_BB", "BBB", # 00x - "_GG", "_CC", "BCC", # 01x - "GGG", "GCC", "CCC", # 02x - "_RR", "_MM", "BMM", # 10x - "_YY", "_*W", "BBW", # 11x - "GYY", "GGW", "CCW", # 12x - "RRR", "RMM", "MMM", # 20x - "RYY", "RRW", "MMW", # 21x - "YYY", "YYW", "WWW", # 22x + "___", "_BB", "BBB", "BBB", # 00x + "_GG", "_GC", "GGC", "GCC", # 01x + "GGG", "GGC", "GCC", "GCC", # 02x + "GGG", "GCC", "CCC", "CCC", # 03x + "_RR", "_MM", "MMB", "MBB", # 10x + "_YY", "_**", "_*B", "BBW", # 11x + "GYY", "GGW", "GCC", "CCW", # 12x + "GGY", "GGG", "GCC", "CCW", # 13x + "RRR", "RRM", "RMM", "MMM", # 20x + "RYY", "RRW", "RMW", "MMW", # 21x + "YYY", "YYW", "**W", "WWW", # 22x + "YYY", "YYW", "YWW", "WWW", # 23x + "RRR", "RMM", "RMM", "MMM", # 30x + "RRY", "RRY", "RMM", "MMW", # 31x + "YYY", "YYW", "YYW", "WWW", # 32x + "YYY", "YYW", "YYW", "WWW", # 33x ] colours = ["_", "R", "G", "Y", "B", "M", "C", "W"]