Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. def check_church(new_tile):
  2. surrounding_tiles = tile_to_check("Church", new_tile)
  3.  
  4. points = 0
  5.  
  6. if new_tile["Church"]:# is it itself a church that is now surrounded ?
  7. tiles_around = 0
  8. for tile in surrounding_tiles:
  9. if not tile["Empty"]:
  10. tiles_around +=1
  11. if tiles_around == 8: #so it is surrounded
  12. points= 9
  13.  
  14. #is the newly placed tile contributing to the closing of another tile that is a church tile ? First check if it is placed next to a tile church
  15. church_list_to_check =[]
  16. for tile in surrounding_tiles:
  17. if tile["Church"]:
  18. church_list_to_check.append(tile)
  19.  
  20. #second, check if these church tiles are now closed
  21. if church_list_to_check:
  22. for tile in church_list_to_check:
  23. surrounding_tiles = tile_to_check("Church", tile)
  24. tiles_around = 0
  25. for tile in surrounding_tiles:
  26. if not tile["Empty"]:
  27. tiles_around +=1
  28. if tiles_around == 8: #so it is surrounded
  29. points+= 9
  30.  
  31. return points
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement