Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Pawn Brotherhood by estelle.doriot
def protect(pawn: str) -> set[str]:
c, r = tuple(pawn)
return {chr(ord(c) - 1) + str(int(r) + 1), chr(ord(c) + 1) + str(int(r) + 1)}
def safe_pawns(pawns: set[str]) -> int:
return sum(
any(pawn in protect(other_pawn) for other_pawn in pawns) for pawn in pawns
)
July 30, 2023
Comments: