I wrote a Chinese Chess Program 软件分享: 智慧中国象棋 (Chinese Chess)

in #cn7 years ago (edited)

I wrote a Chinese Chess freeware in 2005 (12 years) ago (as the bachelor final year project). The project was initially written and compiled under Delphi 7. Later I moved the code to Delphi 2007. Today, I have modified the codebase to be able to compile this baby under Delphi XE8

Delphi XE8 is unicode, and supports the Parallel Library (e.g. Parallel.For, Parallel.ForEach) so you will be experiencing performance gains in this case, a higher intelligence. 

For those who do not know how to play Chinese chess, here is the introduction from wiki and here is the quick-how-to.   

Download Zhihui Chinese Chess Software 3.0.0.501

ITERATIVE DEEPENING

In AI (Artificial Intelligence), the idea of Iterative Deepening is often used in the chess-game-playing. It has the concept as follows:

while (still_has_time) {
   search_depth ++ ; // increase the search depts;
   best_move = do_search(search_depth);
}
apply_best_move(best_move);

This may seem odd at first: why waste time doing searches for depth = 4 if we have time to do depth = 6 ? The answer is that modern search algorithms (Alpha-beta) benefit from Hash table so that the previous searches will store the values that can be used in the future searches so that it actually speeds up the searches. For example, it may be faster if doing search with depth 4 + 6 than doing search 6 directly. 

 In game playing, the Iterative Deepening does not limit the computer for its ‘intelligence’ by design. That means, as the hardware becomes faster and faster, within the same amount of time period, the AI can actually do more searches, which yields a higher intelligence (no upper bound)!The computer will keep thinking if there is time! 

 64-bit application is built and bundled into the setup. So you will notice that an extra icon (64-bit) will be added to the desktop icon. You will possibly benefit for performance gains. The 64-bit enjoys ‘unlimited’ RAM. The 32-bit chess AI can only use up to 3.5GB RAM under LAA mode.The future updates include parallel alphabeta pruning algorithms and using the latest compilers (Delphi 101 Berlin) to compile both 32-bit and 64-bit chess program. 

 十几年前(2005年)我本科的毕业设计做了一个中国象棋的 桌面程序 智慧 中国象棋 (Xiang Qi)
一款完全免费的 中国象棋 (Xiang Qi) 游戏 

 后来认识媳妇之后 改名成 ‘智慧’ 我俩名字的一个字. 最开始代码是在DELPHI 7下编译的 后来移到 DELPHI 2007 最近休假 又整了整代码 移到了 DELPHI XE8 下编译. 

 DELPHI XE8 下支持 多线程并行语句 例如 Parallel.For, Parallel.ForEach, 而且DELPHI XE8UNICODE的. 新版本的代码质量速度效率要比以前的版本好一些. 

 不懂玩象棋的人可以看维基百科 https://zh.wikipedia.org/wiki/%E8%B1%A1%E6%A3%8B 

 我写了一个英文(很久之前, 未更新)的 英文简介 

版本 3.0.0.501: 点这里下载 

持续深入算法 ITERATIVE DEEPENING

在人工智能里, 持续深入算法 Iterative Deepening 很常用于棋类程序中. 这个概念很简单:

while (还有时间) {
   搜索深度 ++ ;
   best_move = do_search(搜索深度);
}
apply_best_move(best_move);

这个代码看起来第一眼好像做了很多无用功 – 既然要搜索 深度为 6 为什么要先搜索深度为 5? 其实搜索算法 (例如 Alpha-beta 剪枝) 会用到 哈希表 用于保存之前搜索的一些经验. 这些经验能对之后的搜索有着速度的提高作用 所以直接搜索 深度为6可能没有搜索深度4+深度6来得快. 

 而且最为主要的是: 当时间还有的时候就继续加深搜索深度(电脑继续思考) 这样程序就不会受限于搜索固定深度. 比如在好电脑快电脑上 同样的时间算法搜索的深度更深这样智力也就更强!这个程序的棋力 大概是 6秒内想三个回合 中局和 残局的时候 能想 4到6个回合 

Thank you for reading my post, feel free to FOLLOW and Upvote @justyy which motivates me to create more quality posts. 

非常感谢阅读, 欢迎FOLLOW和Upvote @justyy 能激励我创作更多更好的内容.     

// 根据我的博文  这里这里 整理而得。

 

广告一下微信群用于讨论各类编程技术:只要您对技术感兴趣都可以加群哈。

 近期热贴 Recent Popular Posts 

  1. Technology-driven or Business-model-driven? 技术优先还是商业模式优先 – 献给在30多岁还在写代码的朋友们 
  2. One Day Visit to Fen Drayton Lake (Photography) - 村庄附近的 Fen Drayton 湖
  3. One Night in Luton. 回到Luton十一年前打工的酒巴Brookes喝酒
  4. One Day Travel (Photography) Fen Drayton Lake + St Ives 英国 Fen Drayton Lake 坐公交到 St Ives 游玩
  5. What is Data Overfitting in Machine Learning? 机器学习中的过拟现象
  6. Just throw away the things you don't need 断舍离
  7. Microsoft Interview Question – Get the Area of the Triangle 微软面试题:三角形的面积是多少?


Sort:  

Lovely post. Thanks for sharing

please resteem if you like it, thanks!

哇,这可得要说声。。佩服。

隔行如隔山啊, 其实不难的。

你这是往人工智能方向走么?

哈哈。。只是兴趣

这是开源的吗?如果是,哪里可以获取源码?

还不是开源的, 代码写得太烂了 不好意思拿出来。

Coin Marketplace

STEEM 0.25
TRX 0.25
JST 0.039
BTC 95803.39
ETH 3334.91
USDT 1.00
SBD 3.31