Commit dc64fe71 authored by Nathan/Eilisha Shiraini's avatar Nathan/Eilisha Shiraini
Browse files

Linted the code

parent 676591c7
def matrixSize(layers, compact):
if compact:
return 11 + layers * 4
else:
return 15 + layers * 4 + 2 * (((14 + layers * 4) // 2 - 1) // 15)
if compact:
return 11 + layers * 4
else:
return 15 + layers * 4 + 2 * (((14 + layers * 4) // 2 - 1) // 15)
def positionMatrix(layers, compact):
size = matrixSize(layers, compact)
if compact:
baseSize = 11 + layers * 4
alignment = list(range(11 + layers * 4))
else:
baseSize = 14 + layers * 4
alignment = [0] * baseSize
origCenter = baseSize // 2
center = size // 2
for i in range(origCenter):
offset = i + i // 15
alignment[origCenter - i - 1] = center - offset - 1
alignment[origCenter + i] = center + offset + 1
matrix = [[-1] * size for _ in range(size)]
rowOffset = 0
for i in range(layers):
rowSize = (layers - i) * 4 + (9 if compact else 12)
for j in range(rowSize):
columnOffset = j * 2
for k in range(2):
matrix[alignment[i * 2 + k]][alignment[i * 2 + j]] = rowOffset + columnOffset + k
matrix[alignment[i * 2 + j]][alignment[baseSize - 1 - i * 2 - k]] = rowOffset + rowSize * 2 + columnOffset + k
matrix[alignment[baseSize - 1 - i * 2 - k]][alignment[baseSize - 1 - i * 2 - j]] = rowOffset + rowSize * 4 + columnOffset + k
matrix[alignment[baseSize - 1 - i * 2 - j]][alignment[i * 2 + k]] = rowOffset + rowSize * 6 + columnOffset + k
rowOffset += rowSize * 8
return matrix
size = matrixSize(layers, compact)
if compact:
baseSize = 11 + layers * 4
alignment = list(range(11 + layers * 4))
else:
baseSize = 14 + layers * 4
alignment = [0] * baseSize
origCenter = baseSize // 2
center = size // 2
for i in range(origCenter):
offset = i + i // 15
alignment[origCenter - i - 1] = center - offset - 1
alignment[origCenter + i] = center + offset + 1
matrix = [[-1] * size for _ in range(size)]
rowOffset = 0
for i in range(layers):
rowSize = (layers - i) * 4 + (9 if compact else 12)
for j in range(rowSize):
columnOffset = j * 2
for k in range(2):
matrix[alignment[i * 2 + k]][alignment[i * 2 + j]] = rowOffset + columnOffset + k
matrix[alignment[i * 2 + j]][alignment[baseSize - 1 - i * 2 - k]] = rowOffset + rowSize * 2 + columnOffset + k
matrix[alignment[baseSize - 1 - i * 2 - k]][alignment[baseSize - 1 - i * 2 - j]] = rowOffset + rowSize * 4 + columnOffset + k
matrix[alignment[baseSize - 1 - i * 2 - j]][alignment[i * 2 + k]] = rowOffset + rowSize * 6 + columnOffset + k
rowOffset += rowSize * 8
return matrix
def positionList(layers, compact):
size = matrixSize(layers, compact)
matrix = positionMatrix(layers, compact)
lst = [(-1, -1)] * (size * size)
for x, row in enumerate(matrix):
for y, cell in enumerate(row):
if cell != -1:
lst[cell] = (x, y)
del lst[lst.index((-1,-1)):]
return lst
size = matrixSize(layers, compact)
matrix = positionMatrix(layers, compact)
lst = [(-1, -1)] * (size * size)
for x, row in enumerate(matrix):
for y, cell in enumerate(row):
if cell != -1:
lst[cell] = (x, y)
del lst[lst.index((-1, -1)):]
return lst
COMPACT_POS_MATRIX = [positionMatrix(i, True) for i in range(1, 5)]
FULL_POS_MATRIX = [positionMatrix(i, False) for i in range(1, 33)]
COMPACT_POS_LIST = [positionList(i, True) for i in range(1, 5)]
FULL_POS_LIST = [positionList(i, False) for i in range(1, 33)]
\ No newline at end of file
FULL_POS_LIST = [positionList(i, False) for i in range(1, 33)]
......@@ -44,5 +44,3 @@ def fromwords(data, wordsize):
word = data.popleft()
for i in range(wordsize - 1, -1, -1):
yield bool(word & (1 << i))
......@@ -9,4 +9,4 @@ COMPACT_TOTAL_BITS = [28] + [len(l) for l in positions.COMPACT_POS_LIST]
FULL_TOTAL_BITS = [40] + [len(l) for l in positions.FULL_POS_LIST]
COMPACT_WORD_COUNT = [c // s for c, s in zip(COMPACT_TOTAL_BITS, WORD_SIZE_FOR_LAYERS)]
FULL_WORD_COUNT = [c // s for c, s in zip(FULL_TOTAL_BITS, WORD_SIZE_FOR_LAYERS)]
\ No newline at end of file
FULL_WORD_COUNT = [c // s for c, s in zip(FULL_TOTAL_BITS, WORD_SIZE_FOR_LAYERS)]
......@@ -188,14 +188,14 @@ never-returning-functions=sys.exit
[BASIC]
# Naming style matching correct argument names.
argument-naming-style=snake_case
argument-naming-style=camelCase
# Regular expression matching correct argument names. Overrides argument-
# naming-style.
#argument-rgx=
# Naming style matching correct attribute names.
attr-naming-style=snake_case
attr-naming-style=camelCase
# Regular expression matching correct attribute names. Overrides attr-naming-
# style.
......@@ -235,7 +235,7 @@ const-naming-style=UPPER_CASE
docstring-min-length=-1
# Naming style matching correct function names.
function-naming-style=snake_case
function-naming-style=camelCase
# Regular expression matching correct function names. Overrides function-
# naming-style.
......@@ -250,7 +250,7 @@ good-names=i,
_
# Include a hint for the correct naming format with invalid-name.
include-naming-hint=no
include-naming-hint=yes
# Naming style matching correct inline iteration names.
inlinevar-naming-style=any
......@@ -260,7 +260,7 @@ inlinevar-naming-style=any
#inlinevar-rgx=
# Naming style matching correct method names.
method-naming-style=snake_case
method-naming-style=camelCase
# Regular expression matching correct method names. Overrides method-naming-
# style.
......@@ -287,7 +287,7 @@ no-docstring-rgx=^_
property-classes=abc.abstractproperty
# Naming style matching correct variable names.
variable-naming-style=snake_case
variable-naming-style=camelCase
# Regular expression matching correct variable names. Overrides variable-
# naming-style.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment