Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Pawn Brotherhood solution in Clear category for Pawn Brotherhood by michal_bien
def safe_pawns(pawns):
safe = 0
places = ["a", "b", "c", "d", "e", "f", "g", "h"]
for pawn in pawns:
if pawn[1]=="1":
continue
letter = pawn[0]
prevnumber = str(int(pawn[1])-1)
if letter!="a" and places[places.index(letter)-1]+prevnumber in pawns:
safe+=1
elif letter!="h" and places[places.index(letter)+1]+prevnumber in pawns:
safe+=1
return safe
Oct. 7, 2016