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 mz97
def safe_pawns(pawns):
if len(pawns)==1:
return 0
pa=[]
for i in range(len(pawns)):
p = pawns.pop()
p = ord(p[0])-96 + (ord(p[1])-48)*10 #p[0] - letter ('a'=97); p[1] - digit ('1'=49)
pa.append(p)
safe=0
for i in range(len(pa)):
if (pa[i]-11 in pa) or ((pa[i]-9) in pa):
safe=safe+1
return safe
Oct. 14, 2016