Coffee Chinese Chess

 

I. How to use Coffee Chinese Chess Applet

1. Unzip coffeecc.zip which contains

Do not unzip the jar file, nor add any other files into it (because some browsers like Netscape could work faultily).

2. Upload coffeecc.jar, piece.gif, sound directory to your web site.

3. Add following code to your html (the simplest sample HTML source):

Sample HTML source 1:

<applet archive=coffeecc.jar code=coffeecc.class width=450 height=370></applet>

4. Customize parameters as the following part.

 

II. Setup parameters

Note:

 

Parameter tables:

Parameters for appearances

Description Parameter Value Default value
Turn on / off sound sound 0/off, 1/on off
Turn on / off notation tag notationtag 0/off, 1/on on
Turn off all control panels (0) or use control panel 1, 2 or 3 controlpanel 0, 1, 2, 3 1
Turn on the answer button and set game in answer mode answer / answerbutton 0/off, 1/on off
Turn on / off start button startbutton 0/off, 1/on on
Turn on / off side pointer sidepointer 0/off, 1/on on
Turn on / off the copyright line (the bottom line - fair function, isn't it?) copyright 0/off, 1/on on
Set board background color boardbackgroundcolor integer of color 0xff (blue)
Set board fore color boardforecolor integer of color 0xffffff (white)
Set background color backgroundcolor integer of color 0xffffff (white)
Set game fore color of game info line (the top line) gameinfoforecolor integer of color 0x0 (black)
Piece image file name pieceimage a picture file name piece.gif
Board image file name boardimage a picture file name  
Turn on / off copy button (new) copy 0/off, 1/on on

Parameters for setting players

Description Parameter Value Default value
Who moves first movefirst / whomovefirst 1 / red / white, 2 / blue / black 1
Name of red player whiteplayer / redplayer a string blank
Name of blue player blackplayer / blueplayer a string blank
Kind of red player whiteplayerkind / redplayerkind 0 /human, 1/computer human
Kind of blue player blackplayerkind/blueplayerkind 0/human, 1/compute computer
Game information (top line) gameinfo / gameinformation a string blank

Parameters for setting game levels

Description Parameter Value Default value
Activate or turn off interactive (like a picture of board game) active 0/off, 1/on on
Set depth for move computing. The deeper you set, the better the move is found, but the longer it takes. depth integer from 1 5

Parameters for opening book

Description Parameter Value Default value
Open a game with all moves of a opening book (one of 145 opening book) openingbook integer from 0 to 144  

Parameters for input game

Description Parameter Value Default value
Open a game and stay at move number movebegin integer 1
Set board (see details below) position    
Set board (see details below) board    
Set board (see details below) piece    
The move list (see details below) movelist / themovelist    
Move notation movenotation 1/WXF, 2/ICCS 1
Set file name following wxf notation for reading a game (see details below) wxffilename a file name  
Read WXF game from parameter (new) wxfgame WXF game  
Set board based on FEN (new) FEN FEN notation  


a) Details of parameter position

This parameter is used for setting up initial positions of all 32 pieces. Each piece is represented by two characters, the first for column and the second for row.
The normal start position for all 32 piece is 

<param name=
"position" value="A0B0C0D0E0F0G0H0I0B2H2A3C3E3G3I3A9B9C9D9E9F9G9H9I9B7H7A6C6E6G6I6">

For disabling any piece at startup, change that piece position to "Z0". For convenience, you may add spaces and commas to separate pieces.

b) Details of parameter board

This parameter is used for setting up initial 90 positions of board. Pieces are represented by characters: K, R, C, H, E, A, P, k, r, c, h, e, a, p - the initial characters of King, Rook, Cannon, Horse, Elephant,  Advisor, Pawn, lower case characters for blue side, and upper case for red side. The empty position is written by a dot (.).
For convenience, you may add spaces and commas to separate pieces.

For example:

<param name=board value="....ka...,....a....,P...e....,.........,........H, .........,......r..,.........,...RA....,....KA...,">

c) Details of parameter piece

This parameter is used for setting up initial positions of the existing pieces. Pieces are represented by:

For convenience, you may add spaces and commas to separate pieces.

For example:

<param name=piece value="Ke0 Pf5 Ch5 Re6 kf8 ci7 rc3 rh2">

 

d) Details of parameter movelist
The format of each move step either P1+1[comment] for WXF or B2-E2[comment] for ICCS. If you do not need comment, simply let it blank or remove both brackets.

The move list may be long, but do not break in the middle of the move list. For convenience, you may add spaces and commas to move list.

If you need to display more than one move list, name the second movelist1, third movelist2 and so on. For using them, turn on the answer button.

For example:

<param name=movelist value="C8.5,C4.3,C6+7,R2+3,C6.3,P3+1,K5.6,P3.4[Good game]">

 

e) Details file format for parameter wxffilename

The above methods for input of a game may be not flexible for your home page, where you need to update a new game frequently. This method could be more relevant. When updating a new game, you need to upload only one small text file, following the WXF notation. You could see examples of game1.txt, game2.txt and game3.txt and see example of demo of some purposes.

 

f) Details of wxfgame

This method inputs a game on WXF format from parameter.

Note:

<param name=wxfgame value="FORMAT WXF <br />GAME Hu Ronghua(W)Wan Chunlin <br />RESULT 1-0 <br />RED Hu Ronghua ; IGM ;<br />BLACK Wan Chunlin ; CM ;<br />START{1. C2.5 h8+7 2. H2+3 r9.8 3. R1.2 h2+3 <br />}END">

g) Details of FEN

That method is for setting up a board based on FEN notation. For example:

<param name=fen value="3a1k3/4a3h/9/6R1H/5r3/9/4r4/4C4/9/4K1E2 w - - - 1">

 

III. Some sample HTML sources

a. Sample HTML source 2 - turn on the sound, change color of board:

<applet archive=coffeecc.jar code=coffeecc.class width=450 height=370 >
<param name=
"sound" value="on">
<param name=
"boardbackgroundcolor" value="0xffff00">
<param name=
"boardforecolor" value="0xff">
</applet>

b. Sample HTML source 3 - turn off all control panel, change one picture file of pieces and use the other for board:

<applet archive="coffeecc.jar" code="coffeecc.class" width="370" height="420" >
<param name=
"controlpanel" value="0">
<param name=
"pieceimage" value="demo/piece2d.gif">
<param name=
"boardimage" value="demo/board2d.gif">
</applet>

c. Sample HTML source 4 - set up game information, turn off notation tag and copyright line:

<applet archive="coffeecc.jar" code="coffeecc.class" width="430" height="406">
<param name=
"gameinfo" value="THE WORLD CHINESE CHESS CHAMPIONSHIP">
<param name=
"gameinfoforecolor" value="0x80">
<param name=
"notationtag" value="off">
<param name=
"redplayer" value="World Champion Challeger">
<param name=
"blueplayer" value="World Champion">
<param name=
"copyright" value="off">
</applet>

d. Sample HTML source 5 - set up a puzzle and answer:

<applet code="coffeecc.class" width="440" height="350">
<param name=
"copyright" value="0">
<param name=
"sound" value="on">
<param name=
"controlpanel" value="1">
<param name=
"ply" value="9">
<param name=
"answer" value="1">
<param name=
"startbutton" value="0">
<param name=
"piece" value="Ke0,Cg4,Ha5,Ci5,Pb6,Pf8,Ri8,ad9,ke9,ch9,ae8,rh6,pe5,pi4,pg2,pf1,pb0">
<param name=
"movelist" value="R1.2,R8-2,C1+4 A5-6,C3+5A6+5,C3-6A5-6,C3.5A4+5, P4+1K5.4,P4.5K4+1,H9+7K4+1,H7+8K4-1,C1-1P2.3,H8-7K4+1,H7-5K4-1, C5.6P3.4,K5.6R8.9,H5+7K4+1,H7-6K4.5,H6+4K5.4,P8.7K4-1,H4-6A5+4,H6+5K4.5,C6.5">
<param name=
"pieceimage" value="images\2dsmall.gif">
<param name=
"boardbackgroundcolor" value="0xffffff">
<param name=
"boardforecolor" value="0xb0b0bb">
</applet>

e. Sample HTML source 6 - Read a game from file:

<applet archive="coffeecc.jar" code="coffeecc.class" width="360" height="311" >
<param name=
"pieceimage" value="demo/piecesmall.gif">
<param name=
"movebegin" value="15">
<param name=
"controlpanel" value="2">
<param name=
"blueplayerkind" value="0">
<param name=
"startbutton" value="off">
<param name=
"copyright" value="0">
<param name=
"wxffilename" value="game1.txt">
</applet>

 

f. Sample HTML source 7 - Read a game from parametter:

<applet archive="coffeecc.jar" code="coffeecc.class" width="360" height="311" >
<param name=
"blueplayerkind" value="0">
<param name="wxfgame" value="FORMAT WXF <br />GAME Hu Ronghua(W)Wan Chunlin <br />RESULT 1-0 <br />RED Hu Ronghua ; IGM ;<br />BLACK Wan Chunlin ; CM ;<br />START{1. C2.5 h8+7 2. H2+3 r9.8 3. R1.2 h2+3 <br />}END">
</applet>

 

 

 

Go to my home page
Email: Pham Hong Nguyen