Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- AttributeError: 'NoneType' object has no attribute 'append'
- import numpy
- board = numpy.array([[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, 1, 2, 0, 0, 0],
- [0, 0, 0, 2, 1, 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]])
- class AI:
- def __init__(self, board):
- self.board = board
- def flank_search(self):
- free = []
- xcoord = 0
- ycoord = 0
- while 0 <= xcoord and xcoord <= 7 and 0 <= ycoord and ycoord <= 7:
- if self.board[xcoord][ycoord] == 0:
- coord1 = [xcoord, ycoord]
- free = free.append([coord1])
- xcoord += 1
- print free
- return free
- flank = AI(board)
- flank.flank_search()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement