xiangqidiag: a tool to show Xiangqi diagrams in webpages
XiangqidiagXiangqidiag is a tool to include Xiangqi (Chinese Chess) diagrams into webpages. We have a large number of small pictures, showing one position on the Xiangqi-board, with or without a piece, and the tool automatically selects the right pictures and puts them in place to show the full diagram. Using the tool is not hard. Here, it is explained how this can be done for webpages on the chessvariants.com website; it can be done similarly on other websites: if you want to use the tool for your own website, please email Hans Bodlaender.
To use the tool, follow the following two steps.
2. Call a function that makes the diagramNow, call a function of the script. The function is called xiangqidiag, xiangqidiag1, xiangqidiag2, xiangqidiaga, xiangqidiag1a, xiangqidiag2a. The options are as follows:
- xiangqidiag, xiangqidiag1, xiangqidiag2 give diagrams with a transparent background.
- xiangqidiaga, xiangqidiag1a, xiangqidiag2a give diagrams with a yellow background.
- xiangqidiag1 and xiangqidiag1a should be used when calling one level deep in the directory structure.
- xiangqidiag2 and xiangqidiag2a should be used when calling two levels deep in the directory structure.
- xiangqidiag and xiangqidiaga are given a second argument that is the path to the place where the pictures are. This can e.g., be used when at the top level or three levels deep.
- K, k
- R, r
- E, e
- C, c
- M, m
- P, p
- H, h (or: N, n)
- Horse or knight
The end of a row must be marked with a slash: /.
Empty spaces are denoted by a number: the number of empty spaces; or a point ( . ) for one empty space. Thus, the opening setup of Xiangqi goes to the string: rhemkmehr/9/.c5c./p.p.p.p.p/9/9/P.P.P.P.P/.C5C./9/RHEMKMEHR
At depth one, we can then write:
with a result:
For making an empty board with yellow background, one writes:
More diagramsAn example page giving diagrams for all pieces on all squares can be seen here.
Written by Hans Bodlaender
WWW page created: October 19, 2001.