The most important member is $ROWS, $ALLOWEDCOLOR and $MOVENUMBER are respectively the description of chessboard layout ,which side to play and the move number to be.
FEN format is a text string representation of a chess placement. Strange or reasonable! Chinese Chess is very similar to International Chess. The International Chess format can directly adopt.
Example: "rnbakabnr//1c5c/p1p1p1p1p///P1P1P1P1P/1C5C//RNBAKABNR w - - 0 1/x04"
Click the first line and press down arrow on keyboard to animate the move (It's true, Google BLOG can do things like that !):
Here is the brief explanation:
"KRNCABP" (white side) are same as "帥車馬包仕相兵" (red side). These Chinese characters are just my personal favourite!
"krncabp" (black side) are same as "將車馬炮士象卒" (green side)
The rows are delimited by '/', there are at most 10 rows on the chessboard. The numeric between the chess letters are the number of spaces. Any unrecognised letters are treated as 1, i.e. a space.
The letter followed ('w' in the example) is the side to move. 'w', 'W', 'r' or 'R' means red to move. 'b', 'B', 'g', or 'G' means green to move.
The last numeric (1 in the example) is the move number. The other letters('- - 0') are not used, just in compliant with the original FEN format.
I added the new feature like '/x04' in the example to denote the last picked chess, the first digit is the row number(0 means the topmost row) the last digit is the position counted from the left(0 means leftmost). This new feature is optional.
I have written a C++ and then a Java program of recording and playing Chinese Chess. Now I want to rewrite it in PHP and make it playable on web page. Why PHP ? It's because, I believe, PHP is the most popular computer language at present. It is web-oriented, free and well documented on web. Most important, I want to play the chess game on Internet. The program result is ready seen. Unlike Java and C, PHP needs no compilation. All programmers like the feature, PHP's syntax is less strict! No need (or less) to worry about declaration of variables and functions. Array and Regex are powerful and easy in PHP ! The PHP 5 is OOP, so I would like to try.
This blog serves as the personal record of my work. But any constructive ideas are welcomed.
Chinese Chess trains people's mind, makes people dare to think, to move and to change. There should not be one and only one party!