Advertisement
Guest User

Untitled

a guest
Oct 19th, 2019
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. positive_count = self.get_neighbours_count_with_positive_value(i, j)
  2. value = -1
  3. if self.board[i][j] == 0:
  4. if positive_count == 3:
  5. value = 1
  6. elif self.board[i][j] > 0:
  7. if positive_count == 2 or positive_count == 3:
  8. value = self.board[i][j] + 1
  9. elif positive_count == 1 or positive_count == 4 or positive_count == 5:
  10. value = 0
  11. elif positive_count == 0 or positive_count == 6 or positive_count == 8:
  12. value = self.board[i][j] - 1
  13.  
  14. if value > self.max_val:
  15. value = self.max_val
  16.  
  17. if value < 0:
  18. value = 0
  19.  
  20. return value
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement