Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Pawn Brotherhood solution in Uncategorized category for Pawn Brotherhood by capback250
# migrated from python 2.7
def safe_pawns(coords):
cors = "abcdefgh"
defend = 0
for i in coords:
c1 = ""
c2 = ""
for j in i:
if j.isalpha():
if chr(ord(j)+1).isalpha():
c1 += chr(ord(j)+1)
if chr(ord(j)-1).isalpha():
c2 += chr(ord(j)-1)
if chr(ord(j)-1) == "`":
c2 += "0"
if j.isdigit():
c1 += str(int(j)-1)
c2 += str(int(j)-1)
if len(c1) == 2:
if str(coords).find(c1) != -1 or str(coords).find(c2) != -1:
defend += 1
return defend
Aug. 6, 2015