Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
get_back_coor solution in Clear category for Pawn Brotherhood by oduvan
CHESS_L = '_abcdefgh_'
def get_back_coor(coor, shift):
letter, num = coor
return CHESS_L[CHESS_L.index(letter) + shift] + str(int(num) - 1)
def is_safe(pawn, figures):
return get_back_coor(pawn, -1) in figures or get_back_coor(pawn, 1) in figures
def safe_pawns(pawns):
return len(list(filter(lambda p: is_safe(p, pawns), pawns)))
Sept. 25, 2016
Comments: