hex2diag is a JavaScript tool to easily add hexagonal boards to a webpage. The
source code was based on the board2diag tool.
First, one has to include the call to the board2diag.js file, in the following
form:
<SCRIPT LANGUAGE="JavaScript" src="hex2diag.js"></SCRIPT>
Then, one can use a new JavaScript part, and make a call to hex2diag. This
version assumes all files are in the same directory (this is easily changed).
Just click on
to download the actual version.
The function has one argument, which is a string of the following form:
- Number of columns of the first row
- Comma
- Number of columns of the maximal row
- Comma
- Number of columns of the bottom row (this just be less than the previous
value, otherwise, it will printed just to the middle row - this is useful
for trapezoid boards)
- String that describes the position. Here:
- a / marks the end of a row
- a . is one empty square
- a ; is one empty cell marked with a green dot
- a : is one empty cell marked with a red dot
- a , is one empty cell marked with a blue dot
- to place stones, use 'xwopqstuv' for black, white, brown,
yellow, gray, blue, green, red, magenta. Use uppercase to mark them.
- to mark empty cell with numbers, use 'a' for 1, 'c' for 2, 'd' for 3'.
- a h is a special piece used to define walls, blocks, ... if you use H
it will blink!
- use number 1,2,3,4,5,6,7,8,9,0 to represent simple stacks of white or
black stones.
- use [abc] to represent composite stacks, use 'e' empty tops, 'w' for
white stone, 'b' for black stone, and 'r' for red stone.
- use @a[direction] to draw arrows, direction are the typical n,w,s,e
and m,o,r,t for nw,ne,sw,se respectively.
- use @d[color][number] to draw dices. Available colors are w(hite) and
b(lue).
Version 0.6 - Dec 2003