Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for Pawn Brotherhood by TovarischZhukov
def find(pawns, elem):
return (((ord(elem[0]) - 1) >= ord("a")) and ((int(elem[1]) - 1) >= 0) and "%s%i" % (chr(ord(elem[0]) - 1), int(elem[1]) - 1) in pawns) \
or (((ord(elem[0]) + 1) <= ord("h")) and ((int(elem[1]) - 1) >= 0) and "%s%i" % (chr(ord(elem[0]) + 1), int(elem[1]) - 1) in pawns)
def safe_pawns(pawns):
return len({elem for elem in list(pawns) if find(pawns, elem)})
Dec. 5, 2015