예제 #1
0
def openFen():
	file_name = tkFileDialog.askopenfilename()
	if(file_name):
		if(file_name[-3:] == "fen"):
			b = chess.fen_translator(open(file_name, mode='r').read())
			for i in range(64):
				board[i].piece = chess.get_piece(i, b) + \
				6 * chess.get_side(i, b) - 1
				board[i].updateImg()
		else:
			tkMessageBox.showwarning("Open file",
			"Unknown file type:\n %s" % file_name)
예제 #2
0
	def run(self):
		global computerThinking
		chess.print_board(b)
		computerThinking = True
		move = chess.pfind_move(b, 1 if playAsWhite else 0, maxTime)
                chess.end()
		chess.take_move(move, b)
		board[chess.get_from(move)].clear()
		board[chess.get_to(move)].piece = chess.get_piece(move) + \
			  6 * chess.get_side(move)
		board[chess.get_to(move)].updateImage()
		computerThinking = False