01234567890123456789012345678901234567890123456789012345678901234567890123456789
64596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499 |
<----SKIPPED LINES---->
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]]
where each 0 is replaced by an integer 0,...,69.
'''
# For each element in the string,
# if it is an '{', find the closing '}' and collapse into one element
# if it is not an '{' and we are not in an escaped string, translate
translation = {
' ': 0, 'A': 1, 'B': 2, 'C': 3, 'D': 4,
'E': 5, 'F': 6, 'G': 7, 'H': 8, 'I': 9,
'J': 10, 'K': 11, 'L': 12, 'M': 13, 'N': 14,
'O': 15, 'P': 16, 'Q': 17, 'R': 18, 'S': 19,
'T': 20, 'U': 21, 'V': 22, 'W': 23, 'X': 24,
'Y': 25, 'Z': 26, '1': 27, '2': 28, '3': 29,
'4': 30, '5': 31, '6': 32, '7': 33, '8': 34,
'9': 35, '0': 36, '!': 37, '@': 38, '#': 39,
'$': 40, '(': 41, ')': 42, '-': 44, '+': 46,
'&': 47, '=': 48, ';': 49, ':': 50, "'": 52,
'"': 53, '%': 54, ',': 55, '.': 56, '/': 59,
'?': 60, '°': 62}
# valid codes are those enumerated above plus the seven colors in 63, ..., 69
valid_codes = list(translation.values())
valid_codes.extend([63, 64, 65, 66, 67, 68, 69])
pointer = 0
message_array = []
while pointer < len(s):
if s[pointer] == '{':
end_escape = s.find('}', pointer)
if end_escape == -1:
Log('Escaped sequence missing closing curly brace: "%s"' % s)
escaped_sequence = s[pointer+1 : end_escape]
try:
escaped_value = int(escaped_sequence)
except ValueError:
Log('Escaped sequence "%s" is not a number in message "%s"'
<----SKIPPED LINES---->
|
01234567890123456789012345678901234567890123456789012345678901234567890123456789
64596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499 |
<----SKIPPED LINES---->
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]]
where each 0 is replaced by an integer 0,...,69.
'''
# For each element in the string,
# if it is an '{', find the closing '}' and collapse into one element
# if it is not an '{' and we are not in an escaped string, translate
translation = {
' ': 0, 'A': 1, 'B': 2, 'C': 3, 'D': 4,
'E': 5, 'F': 6, 'G': 7, 'H': 8, 'I': 9,
'J': 10, 'K': 11, 'L': 12, 'M': 13, 'N': 14,
'O': 15, 'P': 16, 'Q': 17, 'R': 18, 'S': 19,
'T': 20, 'U': 21, 'V': 22, 'W': 23, 'X': 24,
'Y': 25, 'Z': 26, '1': 27, '2': 28, '3': 29,
'4': 30, '5': 31, '6': 32, '7': 33, '8': 34,
'9': 35, '0': 36, '!': 37, '@': 38, '#': 39,
'$': 40, '(': 41, ')': 42, '-': 44, '+': 46,
'&': 47, '=': 48, ';': 49, ':': 50, "'": 52,
'"': 53, '%': 54, ',': 55, '.': 56, '/': 59,
'?': 60, '°': 62, 'É': 5}
# valid codes are those enumerated above plus the seven colors in 63, ..., 69
valid_codes = list(translation.values())
valid_codes.extend([63, 64, 65, 66, 67, 68, 69])
pointer = 0
message_array = []
while pointer < len(s):
if s[pointer] == '{':
end_escape = s.find('}', pointer)
if end_escape == -1:
Log('Escaped sequence missing closing curly brace: "%s"' % s)
escaped_sequence = s[pointer+1 : end_escape]
try:
escaped_value = int(escaped_sequence)
except ValueError:
Log('Escaped sequence "%s" is not a number in message "%s"'
<----SKIPPED LINES---->
|