现代 PC 上合理的国际象棋引擎当然是可行的,特别是如果您足够老,还记得有许多国际象棋程序在 1 和 2 MHz 8 位机器上只使用几 K 内存,就可以玩得很好。 如今,您可以用解释性语言制作一个国际象棋引擎,并击败顶级 6502 或 Z80 程序员,编写他最紧张、最快的代码。
我和 Dan Spracklen 一起工作,他在 1978 年用他的作品制作了最初的 Sargon妻子凯瑟琳. Kathleen 的兄弟负责 Apple II 的移植,我和他以及他的儿子一起工作。 (我和这些人一起工作的时候,国际象棋为消费者带来利润的生意已经完成了。我记得有一个人推出了 Atari ST 和 Amiga Chess 游戏,当时它们的市场确实不大。)
A reasonable chess engine on modern PCs is certainly doable, especially if you're old enough to remember there were many Chess programs that used just a few K of memory on 1 and 2 MHz 8-bit machines that could play pretty well. You can whip out a chess engine in an interpreted language nowadays and beat the pants off a top 6502 or Z80 programmer coding his tightest fastest stuff.
I got to work with Dan Spracklen, who did the original Sargon in 1978 with his wife Kathleen. Kathleen's brother did the port to Apple II, and I worked with him and with his son. (At the time I worked with these guys, the chess-for-consumer-profit business was done. I remember one guy who brought out Atari ST and Amiga Chess games and there was really not much market for them by that time.)
"Computer Gamesmanship" is a terrific introduction to chess programming as hobbyists performed it in 1983. It's still a delight to read. Covers the good stuff: alpha-beta, minimax, etc.
It's a good enough book that you can start there and then learn about the advances made since.
To make a good one is hard, but probably at about the right level for a graduate project (when I took my batchelor's in Computer Science, a friend of mine wrote a chess engine for his final year dissertation).
And yes there are Open Source ones, the leading contender being GNU Chess, which is very well respected.
It depends on the strength level you are targeting and your programming skills.
Assuming you area an experienced programmer, here's my opinion (i know lots of engines, but never coded one):
*A very simple engine, that can beat an beginner/amateur(ELO 1200-1600): lots of code, but easy.
*A engine, that can beat a 'club player' (ELO 1800-2000): it starts to get hard, you'll need
opening books, optimizations and a solid AI
*A engine that can beat a master: hard, you'll need some years of previous experience
*A top engine (like Rybka, Houdini, Stockfish, Hiarcs), that can beat any human being on earth 99% of time: this is a tremendous effort, you'll need a LOT of patience and years of experience.
Every year at my university, the Introduction to AI course (3rd year course) requires students to create a chess program from scratch along with a paper, and we covered a chapter about adversarial search in lecture so that students have enough knowledge to do it.
For us, the project can be done either on our own or with another (obviously expecting a better program if done with a partner, such as deeper ply, etc.).
Because the Computer Graphics course is also a 3rd year course, students are allowed to combine the final project of that with the final project of the AI course.
Since I happen to be in my 3rd year and am taking both courses (which have now ended with the first semester), I teamed up with a friend who's also in both courses and we've been working on the program since the end of our exams (which was around Dec. 21) and it's due on Jan. 11.
It's completely doable within a month (especially as a graduate project). We're making a 3d chess program thus it requires more work than just a chess engine of course.
The hardest parts will be deciding on a board representation, implementing all the rules (en passant, castling, promotion, etc.), creating a heuristic function, and the game tree (which is usually done with alpha-beta pruning).
Here is the site which we're using to document progress, and later host the code and the paper once we're done (it's a bit empty right now). http://sites.google.com/site/chessatbrock/
You need to generate all the vaild moves for the given state. Then for every possibility you should to check the opponents possible moves. If there is at least one of them which makes your position worse then you should not follow that branch. To do this you need some kind of scoring to determine how well you are doing. Chess already have some rules about which unit worth how much points. It is enough to look ahead only a few steps like this. Beating the program will still be challenging.
This is of course far from perfect: real players can sacrifice some units to achieve long term goals. This algorithm will not do that.
We did a mancala AI followed by a chess AI in Algorithms and Data Structures (sophomore CS).
However, the professor provided big chunks of the chess engine, and we had to do things like improve the decision function, implement checkmate, and other things.
All depend of the goal that you fix about the AI of the game !
if it's a 2 players game.. easy ! But the AI is quite hard ...Right, the well know open source is GNU Chess !
In my undergrad AI course we spent half a semester creating various chess engines and testing them out using XBoard or WinBoard. Then at the end of the semester we had a tournament where the student's chess engines competed with each other in XBoard. Overall it worked out pretty well.
Interfacing to XBoard is fairly easy if I recall correctly. Here are some links.
I'm not sure if this gets you everything you want, I think our chess engines had to create their own board representations and come up with moves on their own, but at least it gets you a graphical board that knows the rules and has a GUI.
I have spent the last year building my own chess engine in C#. It was not all that difficult. During my work I have made mistakes, I have found that information on the internet was just not presented clearly, and much of it was simply copied from other sites.
In order to make life easier for someone else going through this process, I have been documenting the development of my chess engine and posted much of the source code on my blog:
Crafty 是顶级的国际象棋引擎之一,并且完全开源。 然而,我不鼓励您将它用于学生项目,它是用 C 编写的,非常复杂且很难理解,因为它是高度优化的。
出于教育目的,我建议您查看 Adam Berents 网站,其中他描述了他实施时所经历的过程C# 语言的国际象棋引擎。 当然,源代码也是可用的。 在我看来,这是一个很好的起点。
Crafty is one of the top chess engines and completely open source. However I would discourage you from using it for a student project it's written in C, very complex and very hard to understand because it is highly optimized.
For educational purposes I would recommend taking a look at Adam Berents site where he describes the process he went through when he implemented a chess engine in C#. The source code is available as well of course. It's an excellent point to start from, in my opinion.
I cannot answer on your question, but I can answer to your final comment
"It would be a fun project to have
different teams work on chess engines
and then let them play against each
other ... "
This is already done on FICS chess server. I suggest you to login there (needs telnet) and check the documentation as well, you will probably be able to get in touch with people able to give you specific hints on their chessbots
发布评论
评论(13)
现代 PC 上合理的国际象棋引擎当然是可行的,特别是如果您足够老,还记得有许多国际象棋程序在 1 和 2 MHz 8 位机器上只使用几 K 内存,就可以玩得很好。 如今,您可以用解释性语言制作一个国际象棋引擎,并击败顶级 6502 或 Z80 程序员,编写他最紧张、最快的代码。
我和 Dan Spracklen 一起工作,他在 1978 年用他的作品制作了最初的 Sargon妻子凯瑟琳. Kathleen 的兄弟负责 Apple II 的移植,我和他以及他的儿子一起工作。 (我和这些人一起工作的时候,国际象棋为消费者带来利润的生意已经完成了。我记得有一个人推出了 Atari ST 和 Amiga Chess 游戏,当时它们的市场确实不大。)
” 计算机游戏技巧”是对国际象棋编程的精彩介绍,就像业余爱好者在 1983 年进行的那样读起来还是很愉快的。 涵盖了好东西:alpha-beta、极小极大等。
这是一本足够好的书,您可以从那里开始,然后了解此后取得的进展。
A reasonable chess engine on modern PCs is certainly doable, especially if you're old enough to remember there were many Chess programs that used just a few K of memory on 1 and 2 MHz 8-bit machines that could play pretty well. You can whip out a chess engine in an interpreted language nowadays and beat the pants off a top 6502 or Z80 programmer coding his tightest fastest stuff.
I got to work with Dan Spracklen, who did the original Sargon in 1978 with his wife Kathleen. Kathleen's brother did the port to Apple II, and I worked with him and with his son. (At the time I worked with these guys, the chess-for-consumer-profit business was done. I remember one guy who brought out Atari ST and Amiga Chess games and there was really not much market for them by that time.)
"Computer Gamesmanship" is a terrific introduction to chess programming as hobbyists performed it in 1983. It's still a delight to read. Covers the good stuff: alpha-beta, minimax, etc.
It's a good enough book that you can start there and then learn about the advances made since.
做出一个好的作品很难,但对于研究生项目来说可能已经达到了合适的水平(当我攻读计算机科学专业时,我的一个朋友为他最后一年的论文编写了一个国际象棋引擎)。
是的,有开源的,领先的竞争者是 GNU Chess,它非常受尊重。
To make a good one is hard, but probably at about the right level for a graduate project (when I took my batchelor's in Computer Science, a friend of mine wrote a chess engine for his final year dissertation).
And yes there are Open Source ones, the leading contender being GNU Chess, which is very well respected.
这取决于您的目标强度水平和您的编程技能。
假设您是一位经验丰富的程序员,这是我的观点(我知道很多引擎,但从未编码过):
*一个非常简单的引擎,可以击败初学者/业余爱好者(ELO 1200-1600):代码很多,但是很简单。
*一个引擎,可以击败“俱乐部玩家”(ELO 1800-2000):它开始变得困难,你需要
打开书籍、优化和可靠的人工智能
*一个可以击败大师的引擎:很难,你需要几年的经验
*一个顶级引擎(如 Rybka、Houdini、Stockfish、Hiarcs),可以击败任何人类99% 的时间都在地球上:这是一项巨大的努力,您需要大量的耐心和多年的经验。
我就是这么看的!
It depends on the strength level you are targeting and your programming skills.
Assuming you area an experienced programmer, here's my opinion (i know lots of engines, but never coded one):
*A very simple engine, that can beat an beginner/amateur(ELO 1200-1600): lots of code, but easy.
*A engine, that can beat a 'club player' (ELO 1800-2000): it starts to get hard, you'll need
opening books, optimizations and a solid AI
*A engine that can beat a master: hard, you'll need some years of previous experience
*A top engine (like Rybka, Houdini, Stockfish, Hiarcs), that can beat any human being on earth 99% of time: this is a tremendous effort, you'll need a LOT of patience and years of experience.
That's how i see it!
每年在我的大学,人工智能入门课程(第三年课程)都要求学生从头开始创建一个国际象棋程序并附上一篇论文,我们在讲座中介绍了关于对抗性搜索的一章,以便学生有足够的知识来做这件事。
对于我们来说,该项目可以自己完成,也可以与其他人一起完成(显然,如果与合作伙伴一起完成,则期望有更好的计划,例如更深的层等)。
由于计算机图形学课程也是三年级课程,因此学生可以将其期末项目与人工智能课程的期末项目结合起来。
由于我碰巧是大三,并且正在修读这两门课程(现已在第一学期结束),因此我与一位也修读这两门课程的朋友合作,自我们的课程结束以来,我们一直在致力于该计划。考试(12 月 21 日左右),截止日期为 1 月 11 日。
一个月内完全可以完成(尤其是作为研究生项目)。 我们正在制作一个 3D 国际象棋程序,因此它需要的工作当然不仅仅是国际象棋引擎。
最难的部分是决定棋盘表示、实施所有规则(过路、易位、晋级等)、创建启发式函数和游戏树(通常通过 alpha-beta 修剪来完成)。
这是我们用来记录进度的网站,并在完成后托管代码和论文(现在有点空)。 http://sites.google.com/site/chessatbrock/
Every year at my university, the Introduction to AI course (3rd year course) requires students to create a chess program from scratch along with a paper, and we covered a chapter about adversarial search in lecture so that students have enough knowledge to do it.
For us, the project can be done either on our own or with another (obviously expecting a better program if done with a partner, such as deeper ply, etc.).
Because the Computer Graphics course is also a 3rd year course, students are allowed to combine the final project of that with the final project of the AI course.
Since I happen to be in my 3rd year and am taking both courses (which have now ended with the first semester), I teamed up with a friend who's also in both courses and we've been working on the program since the end of our exams (which was around Dec. 21) and it's due on Jan. 11.
It's completely doable within a month (especially as a graduate project). We're making a 3d chess program thus it requires more work than just a chess engine of course.
The hardest parts will be deciding on a board representation, implementing all the rules (en passant, castling, promotion, etc.), creating a heuristic function, and the game tree (which is usually done with alpha-beta pruning).
Here is the site which we're using to document progress, and later host the code and the paper once we're done (it's a bit empty right now). http://sites.google.com/site/chessatbrock/
您需要生成给定状态的所有有效移动。 然后,对于每一种可能性,你应该检查对手可能的举动。 如果其中至少有一个使您的处境变得更糟,那么您不应该遵循该分支。 为此,您需要某种评分来确定您的表现。 国际象棋已经有一些关于哪个单位值多少分的规则。 像这样向前看几步就足够了。 击败该计划仍然具有挑战性。
这当然远非完美:真正的玩家可以牺牲一些单位来实现长期目标。 该算法不会这样做。
You need to generate all the vaild moves for the given state. Then for every possibility you should to check the opponents possible moves. If there is at least one of them which makes your position worse then you should not follow that branch. To do this you need some kind of scoring to determine how well you are doing. Chess already have some rules about which unit worth how much points. It is enough to look ahead only a few steps like this. Beating the program will still be challenging.
This is of course far from perfect: real players can sacrifice some units to achieve long term goals. This algorithm will not do that.
我们在算法和数据结构中做了一个曼卡拉人工智能,然后是国际象棋人工智能(二年级计算机科学)。
然而,教授提供了国际象棋引擎的大部分内容,我们必须做一些事情,比如改进决策功能、实现将死等等。
We did a mancala AI followed by a chess AI in Algorithms and Data Structures (sophomore CS).
However, the professor provided big chunks of the chess engine, and we had to do things like improve the decision function, implement checkmate, and other things.
一切都取决于你对游戏人工智能设定的目标!
如果这是一个 2 人游戏.. 简单! 但人工智能相当困难......对,众所周知的开源是 GNU Chess!
一些算法:http://www.vclcomponents.com/s/0__/source_code_genic_algorithm_chess
这是一个国际象棋编程维基!
All depend of the goal that you fix about the AI of the game !
if it's a 2 players game.. easy ! But the AI is quite hard ...Right, the well know open source is GNU Chess !
Some algorithms : http://www.vclcomponents.com/s/0__/source_code_genetic_algorithm_chess
Here is a chess programming wiki !
在我的本科人工智能课程中,我们花了半个学期的时间创建各种国际象棋引擎并使用 XBoard 或 WinBoard 对其进行测试。 然后在学期结束时,我们举办了一场锦标赛,学生的国际象棋引擎在 XBoard 中相互竞争。 总的来说,效果很好。
如果我没记错的话,与 XBoard 的接口相当容易。 这里有一些链接。
http://www.gnu.org/software/xboard/
XBoard 界面
http://www.tim-mann.org/xboard/engine-intf.html< /a>
我不确定这是否能让你得到你想要的一切,我认为我们的国际象棋引擎必须创建自己的棋盘表示并自行想出动作,但至少它为你提供了一个知道规则的图形棋盘并有一个图形用户界面。
In my undergrad AI course we spent half a semester creating various chess engines and testing them out using XBoard or WinBoard. Then at the end of the semester we had a tournament where the student's chess engines competed with each other in XBoard. Overall it worked out pretty well.
Interfacing to XBoard is fairly easy if I recall correctly. Here are some links.
http://www.gnu.org/software/xboard/
interface for XBoard
http://www.tim-mann.org/xboard/engine-intf.html
I'm not sure if this gets you everything you want, I think our chess engines had to create their own board representations and come up with moves on their own, but at least it gets you a graphical board that knows the rules and has a GUI.
这可能太简单了,但仍然是值得学习的有趣课程:我向您展示 ZX81棋牌游戏
This is probably too simple, but still, interesting lessons to be learned: I present to you the ZX81 Chess game
去年我用 C# 构建了自己的国际象棋引擎。 这并不是那么困难。 在工作中我也犯过错误,我发现互联网上的信息表达得不够清晰,而且很多都是从其他网站复制过来的。
为了让其他人更容易经历这个过程,我一直在记录我的国际象棋引擎的开发,并在我的博客上发布了大部分源代码:
http://www.chessbin.com
我什至创建了一个 国际象棋游戏开发工具包将帮助您开始开发自己的国际象棋引擎,其中包含:
我的网站基本上是专门为像您这样的人服务的; 想要开始构建自己的国际象棋引擎的人。
I have spent the last year building my own chess engine in C#. It was not all that difficult. During my work I have made mistakes, I have found that information on the internet was just not presented clearly, and much of it was simply copied from other sites.
In order to make life easier for someone else going through this process, I have been documenting the development of my chess engine and posted much of the source code on my blog:
http://www.chessbin.com
I have even created a Chess Game Development Kit that will get you started in developing your own chess engine, which contains:
My site is basically dedicated for people just like you; people that want to get started on building their own chess engine.
是的,这绝对在学生项目的范围内。 以下是我的存档中的一些链接,可帮助您入门:
Yes, this is definitely within the scope of a student project. Here are some links from my archive to get you started:
Crafty 是顶级的国际象棋引擎之一,并且完全开源。 然而,我不鼓励您将它用于学生项目,它是用 C 编写的,非常复杂且很难理解,因为它是高度优化的。
出于教育目的,我建议您查看 Adam Berents 网站,其中他描述了他实施时所经历的过程C# 语言的国际象棋引擎。 当然,源代码也是可用的。 在我看来,这是一个很好的起点。
Crafty is one of the top chess engines and completely open source. However I would discourage you from using it for a student project it's written in C, very complex and very hard to understand because it is highly optimized.
For educational purposes I would recommend taking a look at Adam Berents site where he describes the process he went through when he implemented a chess engine in C#. The source code is available as well of course. It's an excellent point to start from, in my opinion.
我无法回答你的问题,但我可以回答你的最终评论
这已经在 FICS 国际象棋服务器上完成。我建议您登录那里(需要 telnet)并检查文档,您可能能够与能够为您提供有关他们的国际象棋机器人的具体提示的人取得联系
I cannot answer on your question, but I can answer to your final comment
This is already done on FICS chess server. I suggest you to login there (needs telnet) and check the documentation as well, you will probably be able to get in touch with people able to give you specific hints on their chessbots