Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Pawn Brotherhood by plutasnyy
def safe_pawns ( pawns ) :
n = 0
for i , R in pawns :
if R < "2" : continue
if i > "a" :
first = chr( ord(i) - 1) + str( int(R) - 1 )
if first in pawns :
n += 1
continue
if i < "h" :
second = chr( ord(i) + 1) + str( int(R) - 1 )
if second in pawns :
n += 1
continue
return n
Oct. 30, 2016