The ChessPosition applet

The `Chess Position' applet can be used to show chess positions on a webpage. Below, you find two examples, where the same applet is called, with different parameters.

This is an applet with some limitations - it mainly is an `in between product' for another applet I hope to make once.

The applet is called with width=256, and height=256. Less gives wrong results, and more gives a white border around the position, but not necessarily nicely displayed.

The position is given to the applet via a `parameter tag'

<param name=setup value="rnbqkbnr/pppppppp/////PPPPPPPP/RNBQKBNR">

The parameter is named `setup', and the value is the setup in (more or less) Forsythe notation:

Pieces are denoted with a letter: k, q, r, n, b, p, standing for king, queen, rook, knight, bishop, pawn; where upper case (K, Q, etc.) letters denote black pieces, and lower case letters (k, q, etc.) denote white pieces.

The setup is shown row by row. Between rows, we must have always a / symbol.

A row is described by giving successively the letters of the pieces on the row, with a number denoting that number of empty squares on a row.

So, the second setup has value 6k/5ppp//////2R4K .

You are free to use the applet on your own webpages, if you think it is usefull. The advantage of the applet is that one does not need to make a gif or jpg-file for every position, but can just call the applet with the right parameter. The disadvantage is that it is slower, and several browsers will not print the figure when the webpage with the applet-figure on it is send to a printer.

Comments are welcome.


I plan to make a similar applet for different sized boards, and then for differently shaped boards. If you would like to see it for variants with different pieces, email me and tell which pieces. Also, the next version probably has white instead of yellow white pieces (if you understand what I mean.)

Other plans I don't tell, because I'm not sure they'll come to completion.

Download the files

In the zipfile, you find the necessary files: two class-files, and twelve gif-files, and this file (which gives example codes needed in html-pages that use the applet.)

Questions or comments

Feedback to me:

WWW page created: December 1, 1997.

[Dept. of Computer Science] Hans Bodlaender