Chess player: Difference between revisions

→‎{{libheader|python-chess}}: try to avoid mate in one
(→‎{{libheader|python-chess}}: try to avoid mate in one)
Line 1,015:
for yourmove in board.legal_moves:
board.push(yourmove)
if board.result() == "1-0": # Has White won? If so, avoid move.
board.pop()
moves[mymove] = -1000
break
v = Counter(board.fen().split()[0])
p = (9 * (v['q']-v['Q']) + 5 * (v['r']-v['R']) + 3 * (v['b']-v['B'])
Anonymous user