Set intersection solution in Clear category for Pawn Brotherhood by Leonix
""" 1) Build a set of coordinates threatened by all pawns.
2) Count how many pawns are placed in coordinates from (1).
threatened = sum((attack_squares(pawn) for pawn in pawns), ())
# This might return coordinates not present in real chess boards, e.g.: i9.
# But since it does not matter for our purposes, we don't bother to check.
row = str(1+int(pawn))
left_col = chr(ord(pawn)-1)
right_col = chr(ord(pawn)+1)
return left_col + row, right_col + row
Aug. 5, 2015