Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import svgwrite
- import time
- """ ╔═══════╗ ╔═══════╗
- ║ Q ║ ║ R ║
- ╚═══════╝ ← 18 px → ╚═══════╝
- ╔═══════╗ ╔═══════╗ ╔═══════╗ ╔═══════╗ ╔═══════╗ ╔═══════╗ ╔═══════╗
- ║ 0,0 ╟───╢ 0,3 ╟───╢ 0,6 ╟-╢ 0,7 ╟-╢ 0,8 ╟───╢ 0,11 ╟───╢ 0,14 ║
- ╚═══╤═══╝ ╚═══╤═══╝ ╚═══╤═══╝ ╚═══╤═══╝ ╚═══╤═══╝ ╚═══╤═══╝ ╚═══╤═══╝
- │ │ │ | │ │ │
- ╔═══╧═══╗ ╔═══╧═══╗ ╔═══╧═══╗ | ╔═══╧═══╗ ╔═══╧═══╗ ╔═══╧═══╗
- ║ 3,0 ╟───╢ 3,3 ╟───╢ 3,6 ║ | ║ 3,8 ╟───╢ 3,11 ╟───╢ 3,14 ║
- ╚═══╤═══╝ ╚═══╤═══╝ ╚═══╤═══╝ | ╚═══╤═══╝ ╚═══╤═══╝ ╚═══╤═══╝
- │ │ │ | │ │ │
- ╔═══╧═══╗ ╔═══╧═══╗ ╔═══╧═══╗ | ╔═══╧═══╗ ╔═══╧═══╗ ╔═══╧═══╗
- ║ 6,0 ╟───╢ 6,3 ╟───╢ 6,6 ║ | ║ 6,8 ╟───╢ 6,11 ╟───╢ 6,14 ║
- ╚═══╤═══╝ ╚═══════╝ ╚═══════╝ | ╚═══════╝ ╚═══════╝ ╚═══╤═══╝
- ╔═══╧═══╗ ╔═══╧═══╗ ╔═══╧═══╗
- ║ 7,0 ╟-------------------------╢ 7,7 ╟-------------------------╢ 7,14 ║
- ╚═══╤═══╝ ╚═══╤═══╝ ╚═══╤═══╝
- ╔═══╧═══╗ ╔═══════╗ ╔═══════╗ | ╔═══════╗ ╔═══════╗ ╔═══╧═══╗
- ║ 8,0 ╟───╢ 8,3 ╟───╢ 8,6 ║ | ║ 8,8 ╟───╢ 8,11 ╟───╢ 8,14 ║
- ╚═══╤═══╝ ╚═══╤═══╝ ╚═══╤═══╝ | ╚═══╤═══╝ ╚═══╤═══╝ ╚═══╤═══╝
- │ │ │ | │ │ │
- ╔═══╧═══╗ ╔═══╧═══╗ ╔═══╧═══╗ | ╔═══╧═══╗ ╔═══╧═══╗ ╔═══╧═══╗
- ║ 11,0 ╟───╢ 11,3 ╟───╢ 11,6 ║ | ║ 11,8 ╟───╢ 11,11 ╟───╢ 11,14 ║
- ╚═══╤═══╝ ╚═══╤═══╝ ╚═══╤═══╝ | ╚═══╤═══╝ ╚═══╤═══╝ ╚═══╤═══╝
- │ │ │ | │ │ │
- ╔═══╧═══╗ ╔═══╧═══╗ ╔═══╧═══╗ ╔═══╧═══╗ ╔═══╧═══╗ ╔═══╧═══╗ ╔═══╧═══╗
- ║ 14,0 ╟───╢ 14,3 ╟───╢ 14,6 ╟-╢ 14,7 ╟-╢ 14,8 ╟───╢ 14,11 ╟───╢ 14,14 ║
- ╚═══════╝ ╚═══════╝ ╚═══════╝ ╚═══════╝ ╚═══════╝ ╚═══════╝ ╚═══════╝
- ╔═══════╗ ╔═══════╗
- ║ S ║ ║ T ║
- ╚═══════╝ ╚═══════╝
- """
- vertices = {
- 'upper': {
- 'a': (0, 0), 'b': (0, 3), 'h': (0, 6),
- 'c': (3, 0), 'o': (3, 3), 'g': (3, 6),
- 'd': (6, 0), 'e': (6, 3), 'f': (6, 6)},
- 'middle': {
- 'a': (0, 0), 'b': ( 0, 7), 'h': (0, 14),
- 'c': (7, 0), 'o': ( 7, 7), 'g': (7, 14),
- 'd': (14, 0), 'e': (14, 7), 'f': (6, 14)},
- 'lower': {
- 'a': ( 8, 0), 'b': ( 8, 3), 'h': ( 8, 6),
- 'c': (11, 0), 'o': (11, 3), 'g': (11, 6),
- 'd': (14, 0), 'e': (14, 3), 'f': (14, 6)}}
- lineAssocs = {
- 'A': ('a','b'), 'B': ('b','h'), 'C': ('a','c'), 'D': ('c','d'),
- 'E': ('d','e'), 'F': ('e','f'), 'G': ('f','g'), 'H': ('g','h'),
- 'I': ('b','o'), 'J': ('c','o'), 'K': ('o','g'), 'L': ('o','e'),
- 'M': ('a','o'), 'N': ('h','o'), 'O': ('o','d'), 'P': ('o','f')}
- def draw(lineName, letterSize):
- for i in lineAssocs[lineName]:
- pass
- def writeOneWord(upper, lower):
- """
- This function writes a single word, such as "utæk". Single words do not have pipes in them.
- """
- if upper != None and lower != None:
- # In this case we have to align the two words together, as such:
- # L L L L L L M M M M N N N
- # L L L L M M M N N N N N N
- explodedUpper = letterize(upper)
- explodedLower = letterize(lower)
- while len(explodedUpper) > len(explodedLower):
- # pad the lower list until it is the same length OR ONE SHORTER than the upper one
- # left first, then right
- explodedLower.insert(0, None)
- if len(explodedUpper) > len(explodedLower):
- explodedLower.append(None)
- while len(explodedUpper) < len(explodedLower):
- # pad the upper list until it is the same length OR ONE SHORTER than the lower one
- # right first, then
- explodedUpper.append(None)
- if len(explodedUpper) < len(explodedLower):
- explodedUpper.insert(0, None)
- for i in range(max(len(explodedUpper), len(explodedLower))):
- writeOneLetter(explodedUpper[i], explodedLower[i])
- elif upper == None:
- for i in letterize(lower):
- writeOneLetter(i)
- else:
- for i in letterize(upper):
- writeOneLetter(i)
- def letterize(word):
- pass
- def writeOneWordSet(word):
- """
- This function writes out exactly one word set. A word set is a string like "utæk|Qvaḻsa".
- A word set must have """
- if "|" in word:
- wordPairs = word.split("|")
- for i in wordPairs[:-2]:
- writeOneWord(i, None)
- writeOneWord(i[-2], i[-1])
Advertisement
Add Comment
Please, Sign In to add comment