Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for i in range(size):
- for j in range(size):
- if board[i][j] != ai and board[i][j] != pl:
- copy = board[i][j]
- board[i][j] = ai
- if win(ai) == 1 or tie() == 1:
- if x:
- print(name + ' Moved To Grid', i * size + j + 1)
- return
- board[i][j] = copy
- for i in range(size):
- for j in range(size):
- if board[i][j] != ai and board[i][j] != pl:
- copy = board[i][j]
- board[i][j] = pl
- if win(pl) == 1 or tie() == 1:
- board[i][j] = ai
- if x:
- print(name + ' Moved To Grid', i * size + j + 1)
- return
- board[i][j] = copy
- for i in range(size):
- for j in range(size):
- if board[i][j] != ai and board[i][j] != pl:
- copy = board[i][j]
- board[i][j] = ai
- if countWins(ai, pl) > 1:
- l += 1
- r = [i, j]
- wins2.append(r)
- board[i][j] = copy
- for i, j in board.empty_cells():
- for i, j in empty_cells(board):
- def would_win_if_moved_to(player, location) -> bool:
- ''' Return true if player would win if their glyph was placed at location. '''
- # TODO
- pass
- for locn in empty_cells(board):
- if would_win_if_moved_to(ai, locn):
- # Go for the win!
- move_to(locn)
- for locn in empty_cells(board):
- if would_win_if_moved_to(player, locn):
- # Block opponent win!
- move_to(locn)
- for locn in moves_to_win(ai):
- return locn
- for locn in moves_to_block_win(player):
- return locn
- wins2 = [locn for locn in empty_cells(board) if wins_after_move_to(ai, locn) > 1]
- print("line 1")
- print("line 2")
- print("line 3")
- text = """
- line 1
- line 2
- line 3
- """.strip('n')
- print(textwrap.dedent(text))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement