Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for Pawn Brotherhood by UFO665
horizontals = "12345678"
verticals = "abcdefgh"
def positions(pos):
v, h = pos
hPos = horizontals.find(h)
vPos = verticals.find(v)
res = []
if hPos > 0:
if vPos > 0:
res.append("".join([verticals[vPos - 1], horizontals[hPos - 1]]))
if vPos < 7:
res.append("".join([verticals[vPos + 1], horizontals[hPos - 1]]))
return res
def safe_pawns(pawns):
return sum(int(any(p in pawns for p in positions(pos))) for pos in pawns)
Dec. 8, 2015