I want to have some real Hex and TwixT boards, so I’ve been playing around with PostScript a bit.
I found Larry Doolittle’s Hex board and started editing it without knowing almost anything about PostScript. The results were – you guessed it – disastrous. PostScript is not really intuitive language (for me, at least). But then I found a great PostScript tutorial, which helped me immensely.
First I edited Larry’s Hex board – I added black outline to two opposite sides (for the sides not to get confused), and scaled and rotated the 13×13 board (which is littlegolem standard, therefore defacto universal standard) so that it’s playable with normal sized go stones and fits on A3 sized paper (I am very happy that it fits). You can download my 13×13 hex board on A3 for use with go stones.
The next thing I needed was a TwixT board. This time I only found a pdf, which was exactly not what I wanted. So, with a lot more help of the PostScript tutorial mentioned earlier, I created a PostScript TwixT board.
I made it to be highly customizable, you can find parameters on lines 10 to 21. You can easily change size of the board (the number of holes), the space between holes, holesize, color of holes, filling of holes, color of the guiding lines (or whatever they are called, you know, those lines that help you choose the right move ;-)), width and color of the border, basic line width, and finally horizontal and vertical offset. I sincerely think all those settings could be quite useful to anyone who wants to print a customized TwixT board.
I agree that the code is not really great (I stay true to the “it was difficult to write, so it should be difficult to read” principle), but it works and I think that’s what counts.
Here is a short example of PostScript language:
1 step mul dup moveto
boardsize 2 div 1 sub step mul bs 2 sub step mul lineto stroke
Which means, rewritten to human language:
draw_line_to((boardsize/2 – 1)*step, (bs – 2)*step);
In PostScript, everything is based on LIFO (last in first out) stacks, so when you want to do 3+4, you have to write 3 4 add (3 and 4 are put into the stack and the function “add” takes two values from the top of the stack and returns their sum back on the top).
I could show a lot of other PostScript examples but I think it’s better for you to have a look at the code yourself (it’s heavily uncommented, I didn’t want to take the fun out of it).