Advertisement
Guest User

Untitled

a guest
Apr 21st, 2014
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. AttributeError: 'NoneType' object has no attribute 'append'
  2.  
  3. import numpy
  4. board = numpy.array([[0, 0, 0, 0, 0, 0, 0, 0],
  5. [0, 0, 0, 0, 0, 0, 0, 0],
  6. [0, 0, 0, 0, 0, 0, 0, 0],
  7. [0, 0, 0, 1, 2, 0, 0, 0],
  8. [0, 0, 0, 2, 1, 0, 0, 0],
  9. [0, 0, 0, 0, 0, 0, 0, 0],
  10. [0, 0, 0, 0, 0, 0, 0, 0],
  11. [0, 0, 0, 0, 0, 0, 0, 0]])
  12.  
  13. class AI:
  14. def __init__(self, board):
  15. self.board = board
  16.  
  17. def flank_search(self):
  18. free = []
  19. xcoord = 0
  20. ycoord = 0
  21. while 0 <= xcoord and xcoord <= 7 and 0 <= ycoord and ycoord <= 7:
  22. if self.board[xcoord][ycoord] == 0:
  23. coord1 = [xcoord, ycoord]
  24. free = free.append([coord1])
  25. xcoord += 1
  26. print free
  27. return free
  28.  
  29.  
  30. flank = AI(board)
  31. flank.flank_search()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement