简体   繁体   English

使用 Python 3 为 GNU Chess 编写 API/包装器

[英]Writing an API/wrapper for GNU Chess using Python 3

I am currently working on a Python 3 API/wrapper for GNU Chess.我目前正在为 GNU Chess 开发 Python 3 API/包装器。 I've been doing a bit of research and I am pretty much stuck at the moment.我一直在做一些研究,目前我几乎陷入困境。

There is the Chess Engine Communication Protocol , but I am not sure if that's the path I should go down.国际象棋引擎通信协议,但我不确定这是否是我应该走的路。 There are also Internet Chess Servers , but again I am unsure if that's what I should be looking into.还有Internet Chess Servers ,但我再次不确定这是否是我应该研究的内容。 There is also the Portable Game Notation, but that looks like it's made for human consumption and not computers.还有便携式游戏符号,但看起来它是供人类消费而不是计算机使用的。

So what is the best way to interact with GNU Chess?那么与 GNU Chess 交互的最佳方式是什么? Should I create a subprocess to interact with it/parse it's output?我应该创建一个子进程来与之交互/解析它的输出吗? Is that the best way to go?这是最好的方式吗?

This is an example of me making the opening move in GNU Chess:这是我在 GNU Chess 中开局的一个例子:3]

You need to be more specific in your request.您需要在请求中更加具体。 Have you tried anything?你有没有尝试过什么? Do you have any existing code?你有任何现有的代码吗?

I for myself would certainly explore the Chess Engine Communication Protocol if this is the official API to interact with GNU Chess.如果这是与 GNU Chess 交互的官方 API,我自己肯定会探索国际象棋引擎通信协议。 If there is an official API to interact with some software, this is usually the best way to go.如果有官方 API 可以与某些软件交互,这通常是最好的方法。

The Chess Engine protocol link you have in your question is the key to your question.您在问题中拥有的国际象棋引擎协议链接是您问题的关键。 You'll need to study the protocol to parse outputs and send inputs to GNUChess.您需要研究解析输出并将输入发送到 GNUChess 的协议。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM