Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Pawn Brotherhood by Pouf
def safe_pawns(pawns):
safePawns = 0
for pawn in pawns:
col = pawn[0]
row = pawn[1]
defenseRow = str(int(row)-1)
defenseLeft = chr(ord(col)-1) + defenseRow
defenseRight = chr(ord(col)+1) + defenseRow
if defenseLeft in pawns or defenseRight in pawns:
safePawns += 1
return safePawns
Oct. 24, 2014
Comments: