# HG changeset patch # User Brian Neal # Date 1384399062 21600 # Node ID faf16a57301ef54fe09f1cc8fbf710b93690ad59 # Parent 9f472cf80a5dd38eae9bbcc28f4ffe7a824b224f OCR'ed the twenties switch wiring data. Wrote some scaffolding code to process the OCR'ed data to turn it into Python code. diff -r 9f472cf80a5d -r faf16a57301e purple/switch.py --- a/purple/switch.py Tue Nov 12 21:13:13 2013 -0600 +++ b/purple/switch.py Wed Nov 13 21:17:42 2013 -0600 @@ -72,3 +72,187 @@ [4, 6, 1, 2, 5, 3], [5, 2, 4, 3, 6, 1], ] + + +TWENTIES_1 = """ +6 19 14 1 10 4 2 7 13 9 8 16 3 18 15 11 5 12 20 17 +4 5 16 17 14 1 20 15 3 8 18 11 12 13 10 19 2 6 9 7 +17 1 13 6 15 11 19 12 16 18 10 3 7 14 8 20 4 9 2 5 +3 14 20 4 6 16 8 19 2 12 17 9 5 1 11 10 7 13 15 18 +19 6 8 20 13 5 18 4 10 3 16 15 14 12 7 2 17 11 1 9 +2 11 9 14 7 19 6 3 18 13 12 8 10 15 16 17 20 4 5 1 +16 7 6 18 9 10 13 1 17 2 5 4 11 19 20 14 8 15 3 12 +1 20 7 16 12 14 5 18 15 10 13 6 8 3 4 9 11 17 19 2 +17 9 11 8 20 18 7 14 1 16 15 5 19 2 6 12 4 10 13 3 +12 8 17 9 3 20 4 10 14 5 7 18 2 16 13 6 1 19 15 11 +20 1 16 11 2 17 9 4 8 15 10 13 3 18 14 5 6 7 12 19 +5 4 15 2 13 19 6 16 12 14 8 7 17 10 18 3 9 1 11 20 +15 17 10 19 16 2 11 8 9 7 3 14 18 13 12 1 5 20 6 4 +11 12 7 3 8 15 16 6 4 20 2 5 1 9 19 18 10 14 17 13 +12 16 2 7 4 8 15 19 5 1 11 9 20 17 6 14 13 3 18 10 +8 15 18 1 12 11 17 14 20 16 13 19 9 7 3 4 2 5 10 6 +7 3 5 18 17 13 19 20 14 11 9 10 2 6 1 15 12 16 4 8 +10 13 4 14 18 3 2 17 11 19 20 1 6 12 9 7 15 8 5 16 +13 7 9 12 20 16 14 10 19 6 1 2 11 4 5 3 18 17 8 15 +1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 +9 20 12 5 10 17 1 13 7 15 4 3 16 8 18 11 19 2 14 6 +18 15 2 13 1 7 10 5 19 17 6 20 9 11 12 8 3 4 16 14 +16 18 19 10 11 20 5 9 1 4 12 13 7 6 17 2 14 15 3 8 +5 8 1 15 19 9 12 2 6 3 14 17 4 20 16 13 18 10 7 11 +14 10 4 8 9 12 3 11 17 20 19 6 15 5 2 18 16 7 1 13 +""" + +TWENTIES_2 = """ +15 9 1 5 17 19 3 2 10 8 11 18 12 16 6 13 20 4 14 7 +12 6 15 2 4 9 8 16 19 17 5 11 20 7 10 18 1 14 13 3 +4 18 5 8 16 1 12 15 20 14 13 17 11 2 7 9 6 3 10 19 +6 11 2 20 14 7 18 12 15 3 8 5 10 1 17 19 9 16 4 13 +7 2 13 3 9 4 17 14 1 12 18 20 6 11 16 15 5 8 19 10 +5 17 14 7 10 9 19 20 8 13 1 2 16 3 4 12 11 18 6 15 +8 4 3 11 19 13 2 9 12 16 10 17 14 15 20 6 18 1 7 5 +20 1 16 10 15 8 14 11 18 5 3 7 13 17 19 4 2 9 12 6 +9 8 7 15 5 2 4 13 17 1 11 6 19 18 14 10 3 20 16 12 +10 12 11 18 8 16 20 17 5 6 9 3 4 19 13 7 1 14 15 2 +11 7 14 4 18 20 6 1 13 19 12 15 5 9 16 2 17 10 8 3 +2 3 9 10 13 14 15 16 7 11 20 12 18 6 1 5 8 17 19 4 +16 10 15 1 17 3 13 9 4 7 6 8 2 14 5 11 12 19 18 20 +19 16 18 12 3 13 9 10 6 2 17 14 11 4 7 20 15 5 1 8 +18 14 12 19 1 7 10 6 11 15 5 9 8 20 17 4 3 13 2 16 +20 3 19 2 4 5 11 14 9 10 18 16 15 12 8 7 13 6 17 1 +3 6 4 14 2 12 16 5 18 20 7 19 1 15 9 8 10 11 13 17 +5 15 20 9 10 17 1 19 13 12 4 2 7 6 11 14 16 8 3 18 +14 20 13 17 5 18 8 4 2 15 16 1 9 19 3 6 7 10 12 11 +8 11 1 6 19 14 5 18 17 3 10 13 12 20 15 16 4 2 7 9 +17 19 6 1 12 15 20 7 16 9 3 11 13 10 2 18 8 4 5 14 +1 5 12 20 6 11 14 8 9 7 19 4 3 13 10 17 18 16 15 2 +16 8 10 13 11 6 19 5 3 4 15 20 17 2 18 1 14 7 9 12 +19 13 8 16 20 10 7 1 2 18 14 6 9 5 12 3 17 15 11 4 +13 1 17 15 7 4 16 3 14 5 2 10 18 8 11 9 19 12 20 6 +""" + +TWENTIES_3 = """ +7 19 11 3 20 1 10 6 16 12 17 13 8 9 4 18 5 14 15 2 +15 17 14 2 12 13 8 3 1 19 9 4 10 7 11 20 16 6 18 5 +2 11 20 12 1 19 4 10 9 14 6 15 13 3 7 16 18 8 5 17 +16 3 12 9 4 20 6 19 18 2 5 8 14 11 10 1 15 17 13 7 +12 18 16 4 9 3 15 13 6 20 8 2 7 10 5 19 14 1 17 11 +13 9 5 6 8 7 12 17 14 18 20 10 2 19 11 15 4 3 1 16 +4 7 2 15 17 10 19 5 8 16 1 12 3 13 6 14 20 9 11 18 +9 6 4 10 18 16 8 14 5 12 17 1 20 15 13 19 2 11 7 3 +5 14 18 17 13 15 11 12 7 8 3 6 1 2 20 4 9 10 16 19 +11 16 9 18 3 12 5 15 10 1 14 17 2 4 19 6 8 7 13 20 +19 8 3 15 14 5 1 11 2 10 12 16 18 20 17 7 13 4 9 6 +1 12 17 13 9 7 14 2 15 4 5 11 6 16 3 8 18 19 20 10 +3 4 10 12 1 18 2 8 14 13 19 7 16 6 15 9 17 20 5 11 +9 11 6 5 10 4 17 19 13 15 7 2 12 18 14 20 1 16 8 3 +8 13 14 16 19 12 20 7 10 3 15 9 4 17 1 11 5 2 6 18 +18 16 15 4 2 17 13 12 6 11 20 19 14 5 9 1 8 7 3 10 +14 1 7 20 6 13 16 18 12 9 4 17 5 11 2 3 10 15 19 8 +17 19 1 11 7 2 18 4 3 8 10 5 15 12 16 9 6 13 20 14 +10 15 2 14 11 6 7 1 16 20 13 3 9 8 18 17 19 5 12 4 +20 9 8 6 12 11 2 5 4 7 16 14 17 3 15 10 13 19 18 1 +11 20 13 8 16 10 18 14 19 6 15 4 1 17 7 5 3 9 2 12 +16 5 10 19 4 18 15 17 1 3 2 20 11 6 8 13 7 12 14 9 +6 10 19 16 5 9 1 20 17 4 11 18 7 14 13 2 12 8 3 15 +8 7 5 1 15 14 9 16 11 17 18 6 19 20 3 12 4 2 10 13 +13 2 17 7 14 8 3 9 20 5 16 10 6 1 12 15 11 18 4 19 +""" + +import pprint + +def process_twenties(s): + data = s.split() + data = [int(s) for s in data] + n = 0 + table = [] + for i in range(25): + row = [] + for j in range(20): + row.append(data[n]) + n += 1 + table.append(row) + pprint.pprint(table) + +process_twenties(TWENTIES_1) +process_twenties(TWENTIES_2) +process_twenties(TWENTIES_3) + +""" +[[6, 19, 14, 1, 10, 4, 2, 7, 13, 9, 8, 16, 3, 18, 15, 11, 5, 12, 20, 17], + [4, 5, 16, 17, 14, 1, 20, 15, 3, 8, 18, 11, 12, 13, 10, 19, 2, 6, 9, 7], + [17, 1, 13, 6, 15, 11, 19, 12, 16, 18, 10, 3, 7, 14, 8, 20, 4, 9, 2, 5], + [3, 14, 20, 4, 6, 16, 8, 19, 2, 12, 17, 9, 5, 1, 11, 10, 7, 13, 15, 18], + [19, 6, 8, 20, 13, 5, 18, 4, 10, 3, 16, 15, 14, 12, 7, 2, 17, 11, 1, 9], + [2, 11, 9, 14, 7, 19, 6, 3, 18, 13, 12, 8, 10, 15, 16, 17, 20, 4, 5, 1], + [16, 7, 6, 18, 9, 10, 13, 1, 17, 2, 5, 4, 11, 19, 20, 14, 8, 15, 3, 12], + [1, 20, 7, 16, 12, 14, 5, 18, 15, 10, 13, 6, 8, 3, 4, 9, 11, 17, 19, 2], + [17, 9, 11, 8, 20, 18, 7, 14, 1, 16, 15, 5, 19, 2, 6, 12, 4, 10, 13, 3], + [12, 8, 17, 9, 3, 20, 4, 10, 14, 5, 7, 18, 2, 16, 13, 6, 1, 19, 15, 11], + [20, 1, 16, 11, 2, 17, 9, 4, 8, 15, 10, 13, 3, 18, 14, 5, 6, 7, 12, 19], + [5, 4, 15, 2, 13, 19, 6, 16, 12, 14, 8, 7, 17, 10, 18, 3, 9, 1, 11, 20], + [15, 17, 10, 19, 16, 2, 11, 8, 9, 7, 3, 14, 18, 13, 12, 1, 5, 20, 6, 4], + [11, 12, 7, 3, 8, 15, 16, 6, 4, 20, 2, 5, 1, 9, 19, 18, 10, 14, 17, 13], + [12, 16, 2, 7, 4, 8, 15, 19, 5, 1, 11, 9, 20, 17, 6, 14, 13, 3, 18, 10], + [8, 15, 18, 1, 12, 11, 17, 14, 20, 16, 13, 19, 9, 7, 3, 4, 2, 5, 10, 6], + [7, 3, 5, 18, 17, 13, 19, 20, 14, 11, 9, 10, 2, 6, 1, 15, 12, 16, 4, 8], + [10, 13, 4, 14, 18, 3, 2, 17, 11, 19, 20, 1, 6, 12, 9, 7, 15, 8, 5, 16], + [13, 7, 9, 12, 20, 16, 14, 10, 19, 6, 1, 2, 11, 4, 5, 3, 18, 17, 8, 15], + [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], + [9, 20, 12, 5, 10, 17, 1, 13, 7, 15, 4, 3, 16, 8, 18, 11, 19, 2, 14, 6], + [18, 15, 2, 13, 1, 7, 10, 5, 19, 17, 6, 20, 9, 11, 12, 8, 3, 4, 16, 14], + [16, 18, 19, 10, 11, 20, 5, 9, 1, 4, 12, 13, 7, 6, 17, 2, 14, 15, 3, 8], + [5, 8, 1, 15, 19, 9, 12, 2, 6, 3, 14, 17, 4, 20, 16, 13, 18, 10, 7, 11], + [14, 10, 4, 8, 9, 12, 3, 11, 17, 20, 19, 6, 15, 5, 2, 18, 16, 7, 1, 13]] + +[[15, 9, 1, 5, 17, 19, 3, 2, 10, 8, 11, 18, 12, 16, 6, 13, 20, 4, 14, 7], + [12, 6, 15, 2, 4, 9, 8, 16, 19, 17, 5, 11, 20, 7, 10, 18, 1, 14, 13, 3], + [4, 18, 5, 8, 16, 1, 12, 15, 20, 14, 13, 17, 11, 2, 7, 9, 6, 3, 10, 19], + [6, 11, 2, 20, 14, 7, 18, 12, 15, 3, 8, 5, 10, 1, 17, 19, 9, 16, 4, 13], + [7, 2, 13, 3, 9, 4, 17, 14, 1, 12, 18, 20, 6, 11, 16, 15, 5, 8, 19, 10], + [5, 17, 14, 7, 10, 9, 19, 20, 8, 13, 1, 2, 16, 3, 4, 12, 11, 18, 6, 15], + [8, 4, 3, 11, 19, 13, 2, 9, 12, 16, 10, 17, 14, 15, 20, 6, 18, 1, 7, 5], + [20, 1, 16, 10, 15, 8, 14, 11, 18, 5, 3, 7, 13, 17, 19, 4, 2, 9, 12, 6], + [9, 8, 7, 15, 5, 2, 4, 13, 17, 1, 11, 6, 19, 18, 14, 10, 3, 20, 16, 12], + [10, 12, 11, 18, 8, 16, 20, 17, 5, 6, 9, 3, 4, 19, 13, 7, 1, 14, 15, 2], + [11, 7, 14, 4, 18, 20, 6, 1, 13, 19, 12, 15, 5, 9, 16, 2, 17, 10, 8, 3], + [2, 3, 9, 10, 13, 14, 15, 16, 7, 11, 20, 12, 18, 6, 1, 5, 8, 17, 19, 4], + [16, 10, 15, 1, 17, 3, 13, 9, 4, 7, 6, 8, 2, 14, 5, 11, 12, 19, 18, 20], + [19, 16, 18, 12, 3, 13, 9, 10, 6, 2, 17, 14, 11, 4, 7, 20, 15, 5, 1, 8], + [18, 14, 12, 19, 1, 7, 10, 6, 11, 15, 5, 9, 8, 20, 17, 4, 3, 13, 2, 16], + [20, 3, 19, 2, 4, 5, 11, 14, 9, 10, 18, 16, 15, 12, 8, 7, 13, 6, 17, 1], + [3, 6, 4, 14, 2, 12, 16, 5, 18, 20, 7, 19, 1, 15, 9, 8, 10, 11, 13, 17], + [5, 15, 20, 9, 10, 17, 1, 19, 13, 12, 4, 2, 7, 6, 11, 14, 16, 8, 3, 18], + [14, 20, 13, 17, 5, 18, 8, 4, 2, 15, 16, 1, 9, 19, 3, 6, 7, 10, 12, 11], + [8, 11, 1, 6, 19, 14, 5, 18, 17, 3, 10, 13, 12, 20, 15, 16, 4, 2, 7, 9], + [17, 19, 6, 1, 12, 15, 20, 7, 16, 9, 3, 11, 13, 10, 2, 18, 8, 4, 5, 14], + [1, 5, 12, 20, 6, 11, 14, 8, 9, 7, 19, 4, 3, 13, 10, 17, 18, 16, 15, 2], + [16, 8, 10, 13, 11, 6, 19, 5, 3, 4, 15, 20, 17, 2, 18, 1, 14, 7, 9, 12], + [19, 13, 8, 16, 20, 10, 7, 1, 2, 18, 14, 6, 9, 5, 12, 3, 17, 15, 11, 4], + [13, 1, 17, 15, 7, 4, 16, 3, 14, 5, 2, 10, 18, 8, 11, 9, 19, 12, 20, 6]] + +[[7, 19, 11, 3, 20, 1, 10, 6, 16, 12, 17, 13, 8, 9, 4, 18, 5, 14, 15, 2], + [15, 17, 14, 2, 12, 13, 8, 3, 1, 19, 9, 4, 10, 7, 11, 20, 16, 6, 18, 5], + [2, 11, 20, 12, 1, 19, 4, 10, 9, 14, 6, 15, 13, 3, 7, 16, 18, 8, 5, 17], + [16, 3, 12, 9, 4, 20, 6, 19, 18, 2, 5, 8, 14, 11, 10, 1, 15, 17, 13, 7], + [12, 18, 16, 4, 9, 3, 15, 13, 6, 20, 8, 2, 7, 10, 5, 19, 14, 1, 17, 11], + [13, 9, 5, 6, 8, 7, 12, 17, 14, 18, 20, 10, 2, 19, 11, 15, 4, 3, 1, 16], + [4, 7, 2, 15, 17, 10, 19, 5, 8, 16, 1, 12, 3, 13, 6, 14, 20, 9, 11, 18], + [9, 6, 4, 10, 18, 16, 8, 14, 5, 12, 17, 1, 20, 15, 13, 19, 2, 11, 7, 3], + [5, 14, 18, 17, 13, 15, 11, 12, 7, 8, 3, 6, 1, 2, 20, 4, 9, 10, 16, 19], + [11, 16, 9, 18, 3, 12, 5, 15, 10, 1, 14, 17, 2, 4, 19, 6, 8, 7, 13, 20], + [19, 8, 3, 15, 14, 5, 1, 11, 2, 10, 12, 16, 18, 20, 17, 7, 13, 4, 9, 6], + [1, 12, 17, 13, 9, 7, 14, 2, 15, 4, 5, 11, 6, 16, 3, 8, 18, 19, 20, 10], + [3, 4, 10, 12, 1, 18, 2, 8, 14, 13, 19, 7, 16, 6, 15, 9, 17, 20, 5, 11], + [9, 11, 6, 5, 10, 4, 17, 19, 13, 15, 7, 2, 12, 18, 14, 20, 1, 16, 8, 3], + [8, 13, 14, 16, 19, 12, 20, 7, 10, 3, 15, 9, 4, 17, 1, 11, 5, 2, 6, 18], + [18, 16, 15, 4, 2, 17, 13, 12, 6, 11, 20, 19, 14, 5, 9, 1, 8, 7, 3, 10], + [14, 1, 7, 20, 6, 13, 16, 18, 12, 9, 4, 17, 5, 11, 2, 3, 10, 15, 19, 8], + [17, 19, 1, 11, 7, 2, 18, 4, 3, 8, 10, 5, 15, 12, 16, 9, 6, 13, 20, 14], + [10, 15, 2, 14, 11, 6, 7, 1, 16, 20, 13, 3, 9, 8, 18, 17, 19, 5, 12, 4], + [20, 9, 8, 6, 12, 11, 2, 5, 4, 7, 16, 14, 17, 3, 15, 10, 13, 19, 18, 1], + [11, 20, 13, 8, 16, 10, 18, 14, 19, 6, 15, 4, 1, 17, 7, 5, 3, 9, 2, 12], + [16, 5, 10, 19, 4, 18, 15, 17, 1, 3, 2, 20, 11, 6, 8, 13, 7, 12, 14, 9], + [6, 10, 19, 16, 5, 9, 1, 20, 17, 4, 11, 18, 7, 14, 13, 2, 12, 8, 3, 15], + [8, 7, 5, 1, 15, 14, 9, 16, 11, 17, 18, 6, 19, 20, 3, 12, 4, 2, 10, 13], + [13, 2, 17, 7, 14, 8, 3, 9, 20, 5, 16, 10, 6, 1, 12, 15, 11, 18, 4, 19]] + """