Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Shorter solution in Clear category for Pawn Brotherhood by maxadamski
from itertools import permutations
def issafe(a, b):
ax, ay = ord(a[0]), int(a[1])
bx, by = ord(b[0]), int(b[1])
return abs(ax - bx) == 1 and ay == by + 1
def safe_pawns(pawns):
return len({a for a, b in permutations(pawns, 2) if issafe(a, b)})
Oct. 21, 2017
Comments: