Difference between revisions of "Chinese Chess"

From Chessprogramming wiki
Jump to: navigation, search
(2020 ...)
 
(33 intermediate revisions by 2 users not shown)
Line 3: Line 3:
 
[[FILE:Xiangqi Board.svg|border|right|thumb|Xiangqi board, with pieces in their starting positions <ref>[https://en.wikipedia.org/wiki/Xiangqi Xiangqi from Wikipedia]</ref> ]]  
 
[[FILE:Xiangqi Board.svg|border|right|thumb|Xiangqi board, with pieces in their starting positions <ref>[https://en.wikipedia.org/wiki/Xiangqi Xiangqi from Wikipedia]</ref> ]]  
 
   
 
   
'''Chinese Chess''', or '''Xiangqi''' 象棋 <ref>[https://groups.google.com/d/msg/rec.games.chinese-chess/gcreEzzU3yQ/HvWOlP7yaYkJ Xiang Qi Is Not The Elephant Game] by Stephen Leary, [[Computer Chess Forums|rec.games.chinese-chess]], November 18, 1994</ref>,<br/>
+
'''Chinese Chess''', or '''Xiangqi''' 象棋 <ref>[https://groups.google.com/d/msg/rec.games.chinese-chess/gcreEzzU3yQ/HvWOlP7yaYkJ Xiang Qi Is Not The Elephant Game] by Stephen Leary, [[Computer Chess Forums|rec.games.chinese-chess]], November 18, 1994</ref>,<br/> is a chess variant which is very popular in East Asia, especially in China and Vietnam. The Chinese Chess set includes a board and 32 pieces for two players. The board has ten horizontal lines called [[Ranks|ranks]] and nine vertical lines called [[Files|files]]. Pieces are located not in the cells but intersectional points of ranks and files which are 90 in total. In the middle of the board the central seven files are interrupted by a horizontal space called the “River”, which splits the board into two parts. <span id="Palace"></span>Each side of the board has a “Palace” a 3x3 area in the central base. The two sides are usually distinguished by colors, traditional names are red or black <ref>[[Shi-Jim Yen]], [[Jr-Chang Chen]], [[Tai-Ning Yang]], [[Shun-Chin Hsu]] ('''2004''') ''[https://www.researchgate.net/publication/220174553_Computer_Chinese_Chess Computer Chinese Chess]''. [[ICGA Journal#27_1|ICGA Journal, Vol. 27, No. 1]], [https://pdfs.semanticscholar.org/223d/ef59c884503f18610bba314034157f55aacd.pdf pdf]</ref> but now they can be called white and black as chess. Sometimes the Xiangqi board could be considered as the presentation of the war between two countries when the standard chess presents for a battle only.
is a chess variant which is very popular in east Asia, specially in China and Vietnam. The Chinese Chess set includes a board and 32 pieces for two players. The board has ten horizontal lines called [[Ranks|ranks]] and nine vertical lines called [[Files|files]]. In the middle of the board the central seven files are interrupted by a horizontal space called the “River”, which splits the board into two parts. <span id="Palace"></span>Each side of the board has a “Palace” a 3x3 area in the central base. The seven kind of pieces are placed on the intersections and move and capture according to their individual ability and restriction along the lines including the “River banks”. The two sides are usually distinguished by color, being red or black <ref>[[Shi-Jim Yen]], [[Jr-Chang Chen]], [[Tai-Ning Yang]], [[Shun-Chin Hsu]] ('''2004'''). ''[https://www.researchgate.net/publication/220174553_Computer_Chinese_Chess Computer Chinese Chess]''. [[ICGA Journal#27_1|ICGA Journal, Vol. 27, No. 1]], [https://pdfs.semanticscholar.org/223d/ef59c884503f18610bba314034157f55aacd.pdf pdf]</ref> .
 
  
Basically the rules are similar to chess. The object of the game is to [[Checkmate|checkmate]] or [[Stalemate|stalemate]] (is a win as well) the opponent King aka General. However, partly due to the freedom and power of the Rook over other pieces, and the limited freedom of the King, it is forbidden to [[Repetitions|repeat]] perpetually a direct thread (i.e. perpetual check 長將, perpetual thread of capture 長捉, a check and then a threat of mate 一將一殺, or a combination of these). This needs to be taken into account in the [[Chinese Chess Board Representation|board representation]].  
+
=Pieces=
 +
There are 7 types: King, Advisor, Elephant, Rook, Cannon, Horse, and Pawn. Typically those pieces are made from small, simple wood pieces which some symbols (new way) or Chinese characters (traditional way) written on them. As the Chinese characters, pieces on the white side may use different characters than their counterparts on the black side. They are the same pieces, but names on the White side are subtly more noble than those on the Black side <ref>[http://ancientchess.com/page/play-xiangqi.htm How to Play Xiangqi - Chinese Chess]</ref>.
  
=Pieces=
+
Cannon is the most interesting piece in Chinese chess.
Pieces on the red side bear different characters than their counterparts on the black side. They are the same pieces, but names on the Red side are subtly more noble than those on the Black side <ref>[http://ancientchess.com/page/play-xiangqi.htm How to Play Xiangqi - Chinese Chess]</ref>.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 76: Line 75:
 
|}
 
|}
  
<span id="Engines"></span>
+
=Rules=
==Xiangqi Variants==  
+
==Basic==
 +
Basic rules are similar to chess with some modifications. Pieces can move and capture according to their individual ability and restriction along the lines including the “Riverbanks”. Xiangqi doesn’t have rules such as castles, en-passants, promotions. Instead it has some limitations such as King, Advisors must move inside their own Palaces, Horses and Elephants can be blocked (from moving), two King cannot “face” each other (stands in the same column without any piece between). The object of the game is to [[Checkmate|checkmate]] or [[Stalemate|stalemate]] (is a win as well) the opponent King aka General.
 +
 
 +
==3-Folk Rules==
 +
When a position repeated 3 time (3 folks) the game will be terminated too. However, partly due to the freedom and power of the Rook over other pieces, and the limited freedom of the King, it is forbidden to [[Repetitions|repeat]] perpetually a direct thread (i.e. a perpetual check 長將, perpetual thread of capture 長捉, a check and then a threat of mate 一將一殺, or a combination of these). If no side violates the forbidden, game will be ruled as a draw.
 +
 
 +
Ruling the game when 3 forks happen is the hardest thing for fully understanding, installing for both players and software.
 +
 
 +
=Notations=
 +
* [[FEN]]: Chinese Chess can use [[Forsyth-Edwards Notation]] to save down positions, ignored some fields such as Castling and En passant target square. Here is FEN of the starting position: rheakaehr/9/1c5c1/p1p1p1p1p/9/9/P1P1P1P1P/1C5C1/9/RHEAKAEHR w - - 0 1
 +
 
 +
* [[Traditional Chinese Chess Notation]]
 +
* [[SAN]]
 +
* [[WXF]]
 +
 
 +
=Programming=  
 +
Chinese chess is quite similar to chess in multi-aspects thus its software can be developed and tested in similar ways. It can use almost all chess techniques, from traditional methods using [[Board Representation]], [[Alpha-Beta]] [[search]], [[Evaluation]], [[Opening Book]], [[Endgame Tablebases]]... to new ones using [[NNUE]], [[AlphaZero]] methods...
 +
 
 +
However its programming is a bit harder to gain high levels due to some reasons:
 +
 
 +
a) The board is significantly larger (90 vs 64, 40% larger)
 +
 
 +
b) Even there’s no diagonal slide moves (such as Bishops), its pieces have more limitations, been blockable, Cannons have a special way to capture... The board size (90) can't fit 64-bit integer either, the number of columns 9 can't help quick devices... All may make move generators be more complex and slower
 +
 
 +
c) The search trees are usually larger. For example, when comparing Perft results at deep 7, Xiangqi number is 72 times as large
 +
 
 +
d) Evaluation of positions may require more knowledge, especially endgame positions
 +
 
 +
e) Rules 3-fork repetitions are hard to implement and maybe so slow
 +
 
 +
* [[Chinese Chess Board Representation]]
 +
* [[Chinese Chess Perft Results]]
 +
 
 +
=Sub variants=  
 
* [[Banqi]]
 
* [[Banqi]]
 
* [[Jeiqi]]
 
* [[Jeiqi]]
 
<span id="Engines"></span>
 
<span id="Engines"></span>
=Xiangqi Engines=  
+
 
 +
=Engines=  
 
* [[:Category:Xiangqi|Xiangqi Engines]]
 
* [[:Category:Xiangqi|Xiangqi Engines]]
  
Line 180: Line 213:
 
* [[Pham Hong Nguyen|Nguyen Hong Pham]] ('''2018'''). ''A completed implementation for Xiangqi rules''. [[ICGA Journal#40_3|ICGA Journal, Vol. 40, No. 3]]
 
* [[Pham Hong Nguyen|Nguyen Hong Pham]] ('''2018'''). ''A completed implementation for Xiangqi rules''. [[ICGA Journal#40_3|ICGA Journal, Vol. 40, No. 3]]
 
* [[Ting-Yu Lin]], [[Jr-Chang Chen]], [[Tsan-sheng Hsu]] ('''2018'''). ''The number of effective moves for Chinese chess''. [[CG 2018]], [[ICGA Journal#40_4|ICGA Journal, Vol. 40, No. 4]]
 
* [[Ting-Yu Lin]], [[Jr-Chang Chen]], [[Tsan-sheng Hsu]] ('''2018'''). ''The number of effective moves for Chinese chess''. [[CG 2018]], [[ICGA Journal#40_4|ICGA Journal, Vol. 40, No. 4]]
 +
* [[Wen-Jie Tseng]], [[Jr-Chang Chen]], [[I-Chen Wu]], [[Tinghan Wei]] ('''2018'''). ''Comparison Training for Computer Chinese Chess''. [https://arxiv.org/abs/1801.07411 arXiv:1801.07411]
 +
==2020 ...==
 +
* [[Maximilian Langer]] ('''2021'''). ''Evaluation of Monte-Carlo Tree Search for Xiangqi''. B.Sc. thesis, [[Darmstadt University of Technology|TU Darmstadt]], [https://ml-research.github.io/papers/langer2021xiangqi.pdf pdf]
  
 
=Forum Posts=  
 
=Forum Posts=  
Line 210: Line 246:
 
* [http://www.talkchess.com/forum3/viewtopic.php?f=7&t=67877 Xiangqi evaluation] by [[Harm Geert Muller]], [[CCC]], July 01, 2018
 
* [http://www.talkchess.com/forum3/viewtopic.php?f=7&t=67877 Xiangqi evaluation] by [[Harm Geert Muller]], [[CCC]], July 01, 2018
 
* [http://www.talkchess.com/forum3/viewtopic.php?f=7&t=69386 A proposal for Jeiqi notation] by [[Pham Hong Nguyen|Nguyen Pham]], [[CCC]], December 26, 2018   
 
* [http://www.talkchess.com/forum3/viewtopic.php?f=7&t=69386 A proposal for Jeiqi notation] by [[Pham Hong Nguyen|Nguyen Pham]], [[CCC]], December 26, 2018   
 +
==2020 ...==
 +
* [http://www.talkchess.com/forum3/viewtopic.php?f=2&t=76400 Xiangqi chess engine in javascript - YouTube tutorial series] by [[Maksim Korzh]], [[CCC]], January 24, 2021
 +
* [http://www.talkchess.com/forum3/viewtopic.php?f=7&t=76391 Did anyone write a xiangqi chess engine?] by [[Maksim Korzh]], [[CCC]], January 27, 2021
 +
* [http://www.talkchess.com/forum3/viewtopic.php?f=7&t=76430 Chinese chess Xiangqi perft results] by [[Maksim Korzh]], [[CCC]], January 27, 2021 » [[Chinese Chess Perft Results]]
 +
* [http://www.talkchess.com/forum3/viewtopic.php?f=2&t=76464 Wukong Xiangqi - Chinese chess engine] by [[Maksim Korzh]], [[CCC]], January 31, 2021
 +
* [http://www.talkchess.com/forum3/viewtopic.php?f=2&t=80642 SEE test suite for Xiangqi (Chinese chess)] by [[Pham Hong Nguyen|Nguyen Pham]], [[CCC]], September 08, 2022
  
 
=External Links=  
 
=External Links=  
Line 226: Line 268:
 
* [http://home.hccnet.nl/h.g.muller/XQ.html XiangQi (Chinese Chess)] by [[Harm Geert Muller]]
 
* [http://home.hccnet.nl/h.g.muller/XQ.html XiangQi (Chinese Chess)] by [[Harm Geert Muller]]
 
: [http://home.hccnet.nl/h.g.muller/XQwinboard.html WinBoard and XiangQi] by [[Harm Geert Muller]]
 
: [http://home.hccnet.nl/h.g.muller/XQwinboard.html WinBoard and XiangQi] by [[Harm Geert Muller]]
* [http://lpforth.forthfreak.net/endgame-en.html Chinese Chess Endgame Databases Query System] by [[Jih-tung Pai]]
+
* [http://lpforth.forthfreak.net/endgame-en.html Chinese Chess Endgame Databases Query System] by [[Jih Tung Pai]]
 
* [http://www.xqbase.com/protocol/cchess_ucci.htm 中国象棋电脑应用规范(五):中国象棋通用引擎协议] Universal Chinese Chess Protocol (UCCI)
 
* [http://www.xqbase.com/protocol/cchess_ucci.htm 中国象棋电脑应用规范(五):中国象棋通用引擎协议] Universal Chinese Chess Protocol (UCCI)
 
* [http://www.xqbase.com/league.htm 电脑象棋联赛 - 象棋百科全书 - Computer Chess League - Chess Encyclopedia]
 
* [http://www.xqbase.com/league.htm 电脑象棋联赛 - 象棋百科全书 - Computer Chess League - Chess Encyclopedia]
 +
* [https://www.youtube.com/watch?v=r3g2wxFLTVY&list=PLmN0neTso3Jw59oLgLUwSTZ_AO_u-pwWt Discovering Chinese chess Xiangqi to create game engine for it] by [[Maksim Korzh]], January 22, 2021, [https://en.wikipedia.org/wiki/YouTube YouTube] Videos
 +
==Source Code==
 +
* [https://github.com/NeymarL/ChineseChess-AlphaZero GitHub - NeymarL/ChineseChess-AlphaZero: Implement AlphaZero/AlphaGo Zero methods on Chinese chess] » [[AlphaZero]]
 +
* [https://github.com/maksimKorzh/wukong-xiangqi GitHub - maksimKorzh/wukong-xiangqi: Didactic Chinese chess Xiangqi engine] by [[Maksim Korzh|Code Monkey King]]
 +
==Xiangqi Cloud Database==
 +
* [https://www.chessdb.cn/query_en/ Xiangqi Cloud Database Query Interface] by [[Bojun Guo|noobpwnftw]]
  
 
=References=  
 
=References=  
 
<references />
 
<references />
 
 
'''[[Games|Up one Level]]'''
 
'''[[Games|Up one Level]]'''

Latest revision as of 05:57, 28 September 2022

Home * Games * Chinese Chess

Xiangqi board, with pieces in their starting positions [1]

Chinese Chess, or Xiangqi 象棋 [2],
is a chess variant which is very popular in East Asia, especially in China and Vietnam. The Chinese Chess set includes a board and 32 pieces for two players. The board has ten horizontal lines called ranks and nine vertical lines called files. Pieces are located not in the cells but intersectional points of ranks and files which are 90 in total. In the middle of the board the central seven files are interrupted by a horizontal space called the “River”, which splits the board into two parts. Each side of the board has a “Palace” a 3x3 area in the central base. The two sides are usually distinguished by colors, traditional names are red or black [3] but now they can be called white and black as chess. Sometimes the Xiangqi board could be considered as the presentation of the war between two countries when the standard chess presents for a battle only.

Pieces

There are 7 types: King, Advisor, Elephant, Rook, Cannon, Horse, and Pawn. Typically those pieces are made from small, simple wood pieces which some symbols (new way) or Chinese characters (traditional way) written on them. As the Chinese characters, pieces on the white side may use different characters than their counterparts on the black side. They are the same pieces, but names on the White side are subtly more noble than those on the Black side [4].

Cannon is the most interesting piece in Chinese chess.

Images Name Notation [5] Value [6] Movement Restriction
Xiangqi General (Trad).svg
帥、將 King
(General)
K moves and captures
one orthogonal step
may not leave the palace
The two kings may not face
each other along the same file
with no intervening piece
Xiangqi Advisor (Trad).svg
仕, 士 Advisor

(Guard)

A 2 moves and captures
one diagonal step
may not leave the palace
Xiangqi Elephant (Trad).svg
相、象 Elephant E 2 moves and captures
two diagonal points
may not jump over intervening
pieces,may not cross the river
Xiangqi Horse (Trad).svg
傌, 馬 Horse H 4 moves and captures
one orthogonal step
plus one diagonal step
blocked by orthogonal adjacent
pieces
Xiangqi Chariot (Trad).svg
俥, 車 Rook
(ChaRiot)
R 9 moves and captures
any distance orthogonally
may not jump over intervening
pieces
Xiangqi Cannon (Trad).svg
炮, 炮 Cannon C moves any distance orthogonally - captures by jumping a
single piece, friend or foe, in-between the orthogonal path
of attack towards the captured piece
Xiangqi Soldier (Trad).svg
兵、卒 Pawn
(Soldier)
P
(S)
1
2
moves and captures one step forward -
once crossed the river, also one point sideways

Rules

Basic

Basic rules are similar to chess with some modifications. Pieces can move and capture according to their individual ability and restriction along the lines including the “Riverbanks”. Xiangqi doesn’t have rules such as castles, en-passants, promotions. Instead it has some limitations such as King, Advisors must move inside their own Palaces, Horses and Elephants can be blocked (from moving), two King cannot “face” each other (stands in the same column without any piece between). The object of the game is to checkmate or stalemate (is a win as well) the opponent King aka General.

3-Folk Rules

When a position repeated 3 time (3 folks) the game will be terminated too. However, partly due to the freedom and power of the Rook over other pieces, and the limited freedom of the King, it is forbidden to repeat perpetually a direct thread (i.e. a perpetual check 長將, perpetual thread of capture 長捉, a check and then a threat of mate 一將一殺, or a combination of these). If no side violates the forbidden, game will be ruled as a draw.

Ruling the game when 3 forks happen is the hardest thing for fully understanding, installing for both players and software.

Notations

  • FEN: Chinese Chess can use Forsyth-Edwards Notation to save down positions, ignored some fields such as Castling and En passant target square. Here is FEN of the starting position: rheakaehr/9/1c5c1/p1p1p1p1p/9/9/P1P1P1P1P/1C5C1/9/RHEAKAEHR w - - 0 1

Programming

Chinese chess is quite similar to chess in multi-aspects thus its software can be developed and tested in similar ways. It can use almost all chess techniques, from traditional methods using Board Representation, Alpha-Beta search, Evaluation, Opening Book, Endgame Tablebases... to new ones using NNUE, AlphaZero methods...

However its programming is a bit harder to gain high levels due to some reasons:

a) The board is significantly larger (90 vs 64, 40% larger)

b) Even there’s no diagonal slide moves (such as Bishops), its pieces have more limitations, been blockable, Cannons have a special way to capture... The board size (90) can't fit 64-bit integer either, the number of columns 9 can't help quick devices... All may make move generators be more complex and slower

c) The search trees are usually larger. For example, when comparing Perft results at deep 7, Xiangqi number is 72 times as large

d) Evaluation of positions may require more knowledge, especially endgame positions

e) Rules 3-fork repetitions are hard to implement and maybe so slow

Sub variants

Engines

Computer Olympiads

Photos

XiangqiGraz2003.jpg

Xiangqi winners in Graz 2003, Pascal Tang, Zhi-Jian Tu and Shun-Chin Hsu [7]

ChineseChessOlympiad2005.JPG

Xiangqi winners Taipei 2005 with TD Jaap van den Herik and representative of the sponsor Acer Inc.,
Mingyang Zhao (Gold), Ming-Cheng Cheng (Silver) and Jiao Wang (Bronze) [8]

ChineseChess2013.jpg

Yokohama 2013, Wen-Jie Tseng, Shi-Jim Yen, Harm Geert Muller and Jaap van den Herik [9]

Publications

1981 ...

  • Y.T. Zhang (1981). Application of Artificial Intelligence in Computer Chinese Chess. M.Sc. thesis, Department of Electrical Engineering, National Taiwan University (Chinese)
  • Shun-Chin Hsu, D.H. Huang (1985). Design and Implementation of a Chinese Chess Knowledge Base. Proceedings of NCS, pp. 505-509. (Chinese)
  • Robert Nisonoff, M. Stephanie Ricks (1988). To Catch a King: East Meets West in the Game of Chess. PC Magazine, October 31, 1988, pp. 506 » EGA Chess, Xian
  • Nick Jacobs (1989). Xian, a Chinese Chess Program. Heuristic Programming in AI 1

1990 ...

2000 ...

2002

2003

2004

2005 ...

2006

2007

2008

2009

2010 ...

2011

2013

2014

2015 ...

2020 ...

Forum Posts

1994

2000 ...

Re: Tony Marsland and Chinese Chess in Maastricht (slightly O.T.) by Pham Hong Nguyen, CCC, July 30, 2002

2010 ...

2015 ...

2020 ...

External Links

References