'Refactored by Sourcery'

This commit is contained in:
Sourcery AI
2023-05-24 23:55:27 +00:00
committed by amjad
parent 7c1e336f14
commit 71d02673a9
70 changed files with 582 additions and 835 deletions

View File

@@ -52,14 +52,15 @@ def line_170(board, g, h, j, k):
def line_150(board, g, h, j, k):
if board[k] != g: # line 150
if (
board[k] == h # line 160
or board[k + 6] != g # line 161
or board[k + 3] != g
): # line 162
return -1 # Goto 170
else:
return k + 3 # Line 163
return (
-1
if (
board[k] == h # line 160
or board[k + 6] != g # line 161
or board[k + 3] != g
)
else k + 3
)
elif board[k + 6] != g: # line 152
if board[k + 6] != 0 or board[k + 3] != g: # line 165
return -1 # Goto 170
@@ -70,16 +71,7 @@ def line_150(board, g, h, j, k):
def line_120(board, g, h, j, k):
if board[j] != g:
if board[j] == h or board[j + 2] != g or board[j + 1] != g:
if board[k] != g:
if board[k + 6] != g and (board[k + 6] != 0 or board[k + 3] != g):
# 450 IF G=1 THEN 465
pass
elif board[j + 2] is not g: # Line 122
pass
elif board[j + 1] is not OccupiedBy.EMPTY:
pass
pass
def line_118(board, g, h):
@@ -123,12 +115,13 @@ def think(board, g, h, moves):
def render_board(board, space_mapping):
vertical_divider = "!"
horizontal_divider = "---+---+---"
lines = []
lines.append(vertical_divider.join(space_mapping[space] for space in board[0:3]))
lines.append(horizontal_divider)
lines.append(vertical_divider.join(space_mapping[space] for space in board[3:6]))
lines.append(horizontal_divider)
lines.append(vertical_divider.join(space_mapping[space] for space in board[6:9]))
lines = [
vertical_divider.join(space_mapping[space] for space in board[:3]),
horizontal_divider,
vertical_divider.join((space_mapping[space] for space in board[3:6])),
horizontal_divider,
vertical_divider.join((space_mapping[space] for space in board[6:9])),
]
return "\n".join(lines)