mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-01-25 23:11:02 +08:00
Translated 20150227 Chess in a Few Bytes.md
This commit is contained in:
parent
4434dc0e36
commit
47956ac89a
@ -1,116 +0,0 @@
|
||||
Translating by FSSlc
|
||||
|
||||
Chess in a Few Bytes
|
||||
================================================================================
|
||||
I am showing my age by mentioning that my introduction to computing was a ZX81, a home computer produced by a UK developer (Sinclair Research) which had a whopping 1KB of RAM. The 1KB is not a typographical error, the home computer really shipped with a mere 1KB of onboard memory. But this memory limitation did not prevent enthusiasts producing a huge variety of software. In fact the machine sparked a generation of programming wizards who were forced to get to grips with its workings. The machine was upgradable with a 16KB RAM pack which offered so many more coding possibilities. But the unexpanded 1KB machine still inspired programmers to release remarkable software.
|
||||
|
||||
![1K ZX Chess ](http://www.linuxlinks.com/portal/content2/reviews/Games2/1KZXChess.jpg)
|
||||
|
||||
My favourite ZX81 games were Flight Simulation, 3D Monster Maze, Galaxians, and above all 1K ZX Chess. Only the latter was written for the unexpanded ZX81. In fact, David Horne's 1K ZX Chess was coded in a mere 672 bytes of RAM. However, the game managed to implement most chess rules, and offer a computer opponent. While some important rules were omitted (castling, pawn promotion, and en passant capture), it was still amazing to be able to play against artificial intelligence. The game took up a fair chunk of my misspent youth.
|
||||
|
||||
1K ZX Chess remained the smallest implementation of chess on any computer for 33 years until the record was broken by BootChess this year, and subsequently by Toledo AtomChess. These three games do not implement all of the chess rules, so for completeness I have included my favourite small implementation of chess that implements a complete set of chess rules.
|
||||
|
||||
Linux has a good range of extremely strong chess engines such as Stockfish, Critter, Togo II, Crafty, GNU Chess, and Komodo. The chess engines featured in this article offer no match to a good chess engine, but they show how much can be achieved with a minuscule codebase.
|
||||
|
||||
----------
|
||||
|
||||
![](http://www.linuxlinks.com/portal/content2/png/ToledoAtomchess.png)
|
||||
|
||||
![](http://www.linuxlinks.com/portal/content/reviews/Games2/Screenshot-Toledo.png)
|
||||
|
||||
You may have seen a considerable amount of press coverage about BootChess, a chess program written in 487 bytes of code, smashing the record of the then smallest chess program, 1K ZX Chess. Óscar Toledo Gutiérrez took up the mantle and decided to code an even more compact chess game. Toledo Atomchess is a mere 481 bytes of x86 assembly code which fits in a boot sector. The engine plays a reasonable game of chess given the limitations of its incredibly small codebase.
|
||||
|
||||
Features include:
|
||||
|
||||
- Basic chess movements
|
||||
- ASCII text representation of chess board
|
||||
- Moves are entered in algebraic form
|
||||
- Search depth of 3-ply
|
||||
|
||||
Obviously, to fit the chess of game into 481 bytes, the author had to make some sacrifices. These limitations include:
|
||||
|
||||
- No promotion of pawns
|
||||
- No castling
|
||||
- No en passant
|
||||
- No move validation
|
||||
|
||||
The author has also written chess programs in C, JavaScript and Java; each are very small implementations of chess.
|
||||
|
||||
- Website: [nanochess.org/chess6.html][1]
|
||||
- Developer: Óscar Toledo Gutiérrez
|
||||
- License: Free for non-commercial use
|
||||
- Version Number: -
|
||||
|
||||
----------
|
||||
|
||||
![](http://www.linuxlinks.com/portal/content2/png/BootChess.png)
|
||||
|
||||
![](http://www.linuxlinks.com/portal/content/reviews/Games2/Screenshot-BootChess.png)
|
||||
|
||||
BootChess is an extremely small computer implementation of chess. The game is crammed into a mere 487 bytes and runs on Windows, Mac OS X and Linux operating systems. The board and pieces of BootChess are represented by text alone, with P representing pawns, Q used for the queens and full stops entered for empty squares.
|
||||
|
||||
Features include:
|
||||
|
||||
- Graphic text representation of chess board and use input
|
||||
- Bootsector sized (512 bytes) with a playable chess game
|
||||
- x86 bios hardware only bootstrap (no software dependencies)
|
||||
- All main legal moves including double square pawn start
|
||||
- Pawn promotion to queen (contrary to 1k ZX Chess)
|
||||
- CPU artificial intelligence called taxiMax > minMax half-ply
|
||||
- Hard-coded Spanish white pieces opening
|
||||
|
||||
Again, there are some important limitations. Omissions include:
|
||||
|
||||
- Under-promotion
|
||||
- En passant pawn capture
|
||||
- No castling
|
||||
- 3-repetition rule
|
||||
- 50 move draw rule
|
||||
- No opening or closing books
|
||||
- One or more minMax/negaMax full plies for artificial intelligence
|
||||
|
||||
- Website: [www.pouet.net/prod.php?which=64962][2]
|
||||
- Developer: Olivier "Baudsurfer/RSi" Poudade
|
||||
- License: WTFPL v2
|
||||
- Version Number: .02
|
||||
|
||||
----------
|
||||
|
||||
![](http://www.linuxlinks.com/portal/content2/png/Micro-Max.png)
|
||||
|
||||
![](http://www.linuxlinks.com/portal/content/reviews/Games2/Screenshot-Micro-Max.png)
|
||||
|
||||
Micro-Max is a 133-line chess source which is written in C
|
||||
|
||||
The author has implemented a (hash) transposition table, the engine checks the legality of the input moves, and full FIDE rules except for for under-promotions.
|
||||
|
||||
Features include:
|
||||
|
||||
- Recursive negamax search
|
||||
- Quiescence search with recaptures
|
||||
- Recapture extensions
|
||||
- Iterative deepening
|
||||
- Best-move-first 'sorting'
|
||||
- Hash table storing score and best move
|
||||
- Full FIDE rules (except under promotion) and move-legality checking
|
||||
|
||||
There is also a stripped-down 1433-character version, but allowing you to play under-promotions for full FIDE-rule compliance.
|
||||
|
||||
- Website: [home.hccnet.nl/h.g.muller/max-src2.html][3]
|
||||
- Developer: Harm Geert Muller
|
||||
- License: The MIT License
|
||||
- Version Number: 3.2
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.linuxlinks.com/article/20150222033906262/ChessBytes.html
|
||||
|
||||
作者:Frazer Kline
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[1]:http://nanochess.org/chess6.html
|
||||
[2]:http://www.pouet.net/prod.php?which=64962
|
||||
[3]:http://home.hccnet.nl/h.g.muller/max-src2.html
|
114
translated/share/20150227 Chess in a Few Bytes.md
Normal file
114
translated/share/20150227 Chess in a Few Bytes.md
Normal file
@ -0,0 +1,114 @@
|
||||
几 KB 的国际象棋程序
|
||||
================================================================================
|
||||
当我提及到我用来介绍计算(注:这里翻译的有问题)的是一台 ZX81 电脑时,我已经暴露了我的年龄。ZX81 是一个由英国(UK,the United Kingdom) 开发者(Sincilair 研究所)生产的家庭电脑,它拥有"高达" 1KB 的随机存储器(RAM)。上面的 1kB 并不是打印错误,这个家庭电脑确实只配置有 1KB 的板载内存。但这个内存大小上的限制并没有阻止爱好者制作种类繁多的软件。事实上,这个机器引发了一代编程奇才的出现,这迫使他们掌握让程序在该机上正常运行的方法。这个机器可以通过一个 16 KB 的 RAM 包来进行升级,这就提供了更多的编程可能。但未经扩展的 1KB 机器仍然激励着编程者发布卓越的软件。
|
||||
|
||||
![1K ZX Chess ](http://www.linuxlinks.com/portal/content2/reviews/Games2/1KZXChess.jpg)
|
||||
|
||||
我最喜爱的 ZX81 游戏有: Flight Simulation, 3D Monster Maze, Galaxians, 以及最重要的 1K ZX Chess。 只有最后一个程序是为未扩展的 ZX81 电脑设计的。事实上,David Horne 开发的 1K ZX Chess 只使用了仅仅 672 字节的 RAM(注:如果读者有兴趣,可以看看 [这里](http://users.ox.ac.uk/~uzdm0006/scans/1kchess/)对该程序的代码及解释)。尽管如此,该游戏尽力去实现大多数的国际象棋规则,并提供了一个计算机虚拟对手。虽然一些重要的规则被忽略了(如:王车易位,兵的升变,和吃过路兵)
|
||||
(注:参考了[这里](http://zh.wikibooks.org/zh/%E5%9B%BD%E9%99%85%E8%B1%A1%E6%A3%8B/%E8%A7%84%E5%88%99)和[这里](http://en.wikipedia.org/wiki/Rules_of_chess)),但能够和人工智能相对抗,这仍然令人惊讶。这个游戏占据了我逝去的青春里的相当一部分。
|
||||
|
||||
1K ZX Chess 保持着在任何计算机上国际象棋的最小实现的地位长达 33 年,直到今年由 BootChess 打破了该记录,紧接着由 Toledo AtomChess 打破。这三个程序都没有实现所有的国际象棋规则,所以为了完整性,我介绍了我最喜爱的,实现了所有国际象棋规则的极小的国际象棋。
|
||||
|
||||
Linux 有着一系列极其强大的国际象棋引擎,如 Stockfish, Critter, Togo II, Crafty, GNU Chess, 和 Komodo 。 在这篇文章精选的国际象棋程序虽敌不过一个好的国际象棋程序,但它们展示了使用微不足道的代码库究竟可以实现多少东西。
|
||||
----------
|
||||
|
||||
![](http://www.linuxlinks.com/portal/content2/png/ToledoAtomchess.png)
|
||||
|
||||
![](http://www.linuxlinks.com/portal/content/reviews/Games2/Screenshot-Toledo.png)
|
||||
|
||||
你可能已经看到了大量有关 BootChess 新闻报道,一个只用 487 字节写就的国际象棋程序,一举打破了先前最小的国际象棋程序,1K ZX Chess 的记录。Óscar Toledo Gutiérrez 拿起外套并决定编写一个更加紧凑的国际象棋游戏。Toledo Atomchess 是仅有 481 字节的 x86 汇编代码,它适合在引导扇区里。 在给定的极小代码库限制下,这个引擎实现了一个适当的国际象棋游戏。
|
||||
|
||||
特点包括:
|
||||
|
||||
- 基本的象棋移动
|
||||
- 象棋盘的 ASCII 文本表现
|
||||
- 以代数形式来输入移动(注:如 D2D4)
|
||||
- 3 层的搜索深度
|
||||
|
||||
显然,为了将这个国际象棋程序压缩到 481 字节中,作者必须做出某些牺牲,这些局限包括:
|
||||
|
||||
- 没有兵的升变
|
||||
- 没有王车易位
|
||||
- 没有吃过路兵
|
||||
- 没有移动确认
|
||||
|
||||
该作者也使用 C,JavaScript 和 Java 来写这个国际象棋程序,每种实现都非常小。
|
||||
|
||||
- 网站: [nanochess.org/chess6.html][1]
|
||||
- 开发者: Óscar Toledo Gutiérrez
|
||||
- 协议: 对非商业使用免费(Free for non-commercial use)
|
||||
- 版本号: -
|
||||
|
||||
----------
|
||||
|
||||
![](http://www.linuxlinks.com/portal/content2/png/BootChess.png)
|
||||
|
||||
![](http://www.linuxlinks.com/portal/content/reviews/Games2/Screenshot-BootChess.png)
|
||||
|
||||
BootChess 是一个国际象棋的极其小巧的计算机实现。这个程序被塞进到仅仅 487 字节里,并可运行在 Windows, Mac OS X 和 Linux 等操作系统。BootChess 的棋盘和棋子单独用文本表示,其中 P 代表兵, Q 用来代表王后,以及输入的任何停顿代表空白方块。
|
||||
|
||||
特点包括:
|
||||
|
||||
- 象棋棋盘和用户输入的图形化文本表示
|
||||
- 引导扇区大小(512 字节)的可玩的象棋游戏
|
||||
- 只需 x86 bios 硬件引导程序(没有软件依赖)
|
||||
- 所有主要的正规移动包括 double square pawn start(注:这个我没有查到是什么意思)
|
||||
- 兵升变为王后(与 1k ZX Chess 相反)
|
||||
- 名为 taxiMax > minMax half-ply 的 CPU 人工智能
|
||||
- 硬编码的西班牙白子开局
|
||||
|
||||
同样,它也存在一些重要的限制。这些遗漏包括:
|
||||
|
||||
- 正在推广
|
||||
- 吃过路兵
|
||||
- 没有王车易位
|
||||
- 3 次位置重复和局规则(注:下一步之前,同样的移动出现了两次;可以参考[这里](http://www.netplaces.com/chess-basics/ending-the-game/three-position-repetition.htm))
|
||||
- 50 步移动和局规则(注:在连续的50个回合内,双方既没有棋子被吃掉,也没有兵被移动过,则和局;可以参考[这里](http://www.chessvariants.org/d.chess/chess.html))
|
||||
- 没有开放或封闭的书籍
|
||||
- 一个或多个 minMAX/negaMax 全层人工智能
|
||||
|
||||
- 网站: [www.pouet.net/prod.php?which=64962][2]
|
||||
- 开发者: Olivier "Baudsurfer/RSi" Poudade
|
||||
- 协议: WTFPL v2
|
||||
- 版本号: .02
|
||||
|
||||
----------
|
||||
|
||||
![](http://www.linuxlinks.com/portal/content2/png/Micro-Max.png)
|
||||
|
||||
![](http://www.linuxlinks.com/portal/content/reviews/Games2/Screenshot-Micro-Max.png)
|
||||
|
||||
Micro-Max 是一个用 C 写就的 133 行象棋源程序。
|
||||
|
||||
作者实现了一个 hash 变换表,该引擎检查输入移动的合法性,以及支持 FIDE(注: World Chess Federation 缩写,[这里](https://www.fide.com/)为其官网) 的全部规则,除了正在推广的规则。
|
||||
|
||||
特点包括:
|
||||
|
||||
- 递归的 negamax 搜索
|
||||
- 重新夺回的静态搜索
|
||||
- 重新夺回规则的扩展
|
||||
- 迭代深化
|
||||
- 最好的先走策略 `排序`
|
||||
- 存储分数和最佳移动的 Hash 表
|
||||
- 完整的 FIDE 规则(不包括正在推广的规则) 和移动合法性检查
|
||||
|
||||
同样存在一个简装的 1433个字符的版本,但允许你使用符合 FIDE 规则的正在推广的规则。
|
||||
|
||||
- 网站: [home.hccnet.nl/h.g.muller/max-src2.html][3]
|
||||
- 开发者: Harm Geert Muller
|
||||
- 协议: The MIT License
|
||||
- 版本号: 3.2
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.linuxlinks.com/article/20150222033906262/ChessBytes.html
|
||||
|
||||
作者:Frazer Kline
|
||||
译者:[FSSlc](https://github.com/FSSlc)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[1]:http://nanochess.org/chess6.html
|
||||
[2]:http://www.pouet.net/prod.php?which=64962
|
||||
[3]:http://home.hccnet.nl/h.g.muller/max-src2.html
|
Loading…
Reference in New Issue
Block a user