Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Pawn Brotherhood by tomkun
from string import ascii_lowercase
def safe_pawns(pawns):
to_coord = lambda x:ascii_lowercase.index(x)+1
coords = {(to_coord(x),int(y)) for x,y in pawns}
has_coord = coords.__contains__
return sum(any(map(has_coord, [((x-1),(y-1)), ((x+1),(y-1))])) for x,y in coords)
Feb. 21, 2015
Comments: