Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def check_church(new_tile):
- surrounding_tiles = tile_to_check("Church", new_tile)
- points = 0
- if new_tile["Church"]:# is it itself a church that is now surrounded ?
- tiles_around = 0
- for tile in surrounding_tiles:
- if not tile["Empty"]:
- tiles_around +=1
- if tiles_around == 8: #so it is surrounded
- points= 9
- #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
- church_list_to_check =[]
- for tile in surrounding_tiles:
- if tile["Church"]:
- church_list_to_check.append(tile)
- #second, check if these church tiles are now closed
- if church_list_to_check:
- for tile in church_list_to_check:
- surrounding_tiles = tile_to_check("Church", tile)
- tiles_around = 0
- for tile in surrounding_tiles:
- if not tile["Empty"]:
- tiles_around +=1
- if tiles_around == 8: #so it is surrounded
- points+= 9
- return points
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement