linux国际象棋,使用通用国际象棋界面

本文介绍了GUI如何通过UCI协议与棋盘游戏引擎进行交互,以实现用户命令的传递和引擎响应。从开始e2e4的棋局到设置引擎参数,如哈希大小,再到引擎搜索最佳走法的过程详细展示。通过简化版的交互流程,揭示了GUI与引擎间复杂的命令通信机制,并建议读者查阅UCI规范以获取更全面的理解。
摘要由CSDN通过智能技术生成

小编典典

假设GUI促进了人类用户和引擎之间的匹配。假设用户以开始e2e4。然后,命令将类似于:

// GUI: tell the engine to use the UCI protocol

uci

// ENGINE: identify

id name Chess Engine

id author John Smith

// ENGINE: send the options that can be changed

// in this case the hash size can have a value from 1 to 128 MB

option name Hash type spin default 1 min 1 max 128

// ENGINE: sent all parameters and is ready

uciok

// GUI: set hash to 32 MB

setoption name Hash value 32

// GUI: waiting for the engine to finish initializing

isready

// ENGINE: finished setting up the internal values and is ready to start

readyok

// GUI: let the engine know if starting a new game

ucinewgame

// GUI: tell the engine the position to search

position startpos moves e2e4

// GUI: tell the engine to start searching

// in this case give it the timing information in milliseconds

go wtime 122000 btime 120000 winc 2000 binc 2000

// ENGINE: send search information continuously during search

// this includes depth, search value, time, nodes, speed, and pv line

info depth 1 score cp -1 time 10 nodes 26 nps 633 pv e7e6

info depth 2 score cp -38 time 22 nodes 132 nps 2659 pv e7e6 e2e4

info depth 3 score cp -6 time 31 nodes 533 nps 10690 pv d7d5 e2e3 e7e6

info depth 4 score cp -30 time 55 nodes 1292 nps 25606 pv d7d5 e2e3 e7e6 g1f3

// ENGINE: return the best move found

bestmove d7d5

我简化了交互的许多方面。一个功能齐全的GUI必须支持许多其他命令,您可以在UCI规范中找到该命令(另一个来源)。您还可以查看现有GUI的工作方式。例如,如果您使用Arena,则可以按F4键以查看命令交互的日志,

2020-06-07

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值