示例#1
0
from py_uci import UCIEngine

fen = "3rk2r/pb2n1bp/q1pB1pp1/2P1P3/8/1NN2Q2/PP3RPP/3R2K1 b - - 0 1"

# Show 10 best moves:
e = UCIEngine(multi_pv=10)
e.new_game()
e.set_position(initial_position=fen)
e.find_best_move(10000)
示例#2
0
文件: analyze.py 项目: certik/chess
from chess.pgn import PGNReader
from chess.board import Board
from py_uci import UCIEngine

p = PGNReader(open("op.pgn").read())
b = Board()
b.moves_from_list(p.moves_as_list())
e = UCIEngine()
e.new_game()
e.make_moves(b.get_moves())
best_move, ponder = e.find_best_move(None)
print "computer:", best_move
示例#3
0
from py_uci import UCIEngine
from chess.board import Board

b = Board()
b.move_algebraic("e4")
b.move_algebraic("c5")
b.move_algebraic("Nf3")
b.move_algebraic("d6")
b.move_algebraic("d4")
b.move_algebraic("cxd4")
b.move_algebraic("Nxd4")
b.move_algebraic("Nf6")
b.move_algebraic("Nc3")
b.move_algebraic("a6")
b.move_algebraic("g4")

e = UCIEngine(multi_pv=10)
e.new_game()
e.set_position(moves=b.get_moves())
e.find_best_move(10000)
print b
示例#4
0
文件: play_e2e4.py 项目: certik/chess
from py_uci import UCIEngine
e = UCIEngine()
e.new_game()
e.set_position(moves=["e2e4"])
e.find_best_move()