Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
without matrix solution in Clear category for Pawn Brotherhood by t4d3uszk
def safe_pawns(pawns: set) -> int:
safe = 0
for pawn in pawns:
[file, rank] = pawn
pos1 = chr(ord(file)-1) + str(int(rank)-1)
pos2 = chr(ord(file)+1) + str(int(rank)-1)
safe += (pos1 in pawns) or (pos2 in pawns)
return safe
July 22, 2019