Commit 6b9988e2 by Peter Billam

### greatly improving, but not released yet

parent e1bcbcec
This diff is collapsed.
html/chess.html 0 → 100644
 chess.ps Manual

chess.ps

NAME

chess.ps - Some useful chess-handling stuff in PostScript

SYNOPSIS

(/home/wherever/ps/lib/chess.ps) run
% to send it to a printer see include_run . . .

gsave 100 200 translate
(1rbq1rk1/1pp1ppbp/p1np1np1/8/2PPP3/2N1BP2/PP1QN1PP/R3KB1R w) false fen2board
5 2 0 true  (X)  Marker
5 6 0 false (13) MarkerSm
grestore

DESCRIPTION

This module implements in PostScript a few simple procedures for drawing chess diagrams,

This code is rolled into the fen2img application, written in Lua

PROCEDURES

position_array  flip   Board

This procedure is evolved from the original by Joao Pedro Neto in homepages.di.fc.ul.pt/~jpn/gv/pstools.htm and homepages.di.fc.ul.pt/~jpn/gv/tabs/chess-template.eps

The position_array has 64 elements. When laid out in rows of 8, it looks like the board seen from White's side:

[ -4 -2 -3 -5 -6  0  0 -4
-1  0  0  0  0 -1  0  0
0  0  0  0 -1  0  0 -1
0 -1  0 -2  1  0  2  5
0 -3 -1  1  0  0  0  3
0  0  2  0  0  0  0  0
0  1  0  0  0  1  1  1
4  0  0  0  6  3  0  4 ] false Board
where 0 means the square is empty, the positive numbers are White pieces, and their negatives the Black pieces. 1=pawn, 2=knight, 3=bishop, 4=rook, 5=queen and 6=king.

The boolean flip determines whether the board will be shown rotated 180 degrees, from Black's point of view.

fen_str  flip   fen2board

This procedure wraps the above Board procedure to accept the position in FEN syntax, see wikipedia

The boolean flip determines whether the board will be shown rotated 180 degrees, from Black's point of view.

row  col  grey_ratio  boolean_charpath  str   Marker

A grey_ratio of 0.0 means black, of 1.0 means white. Often, a grey_ratio of about 0.4 when charpath is false seems visually balanced against a grey_ratio of 0.0 when charpath is true

If boolean_charpath is true then the character is printed in outline only, which gives a much lighter visual impression.

VARIABLES

/Chess.dx   40   def
The size of the square, in point.   The default is 40
/Chess.markersize   0.7   def
The relative size of marker-letters inside the squares.
The default is 0.7, but if you wish, eg: to number a dozen or more 'corresponding' squares in an endgame analysis, then /Chess.markersize 0.5 def may be more appropriate.

INSTALL

To install: go to www.pjb.com.au/comp/free/chess.ps.txt and save the file to your local disc.
Rename it to chess.ps and move it into some appropriate directory such as ~/ps/lib . . .

Or, first change directory to where you keep your PostScript libraries:
cd /home/wherever/ps/lib/
(or wherever)   and then either:
wget -O chess.ps http://www.pjb.com.au/comp/free/chess.ps.txt
or:
curl http://www.pjb.com.au/comp/free/chess.ps.txt -o chess.ps

It also needs a particular TrueType font to be installed:
homepages.di.fc.ul.pt/~jpn/gv/tabs/chessfont.zip
This unzips to reveal the  CHEQ_TT.TTF  font,
which you can install on linux by moving it into /usr/share/fonts/truetype/

AUTHOR

Peter J Billam   www.pjb.com.au/comp/contact.html

CHANGES

20180415 first released version

en.wikipedia.org/wiki/Forsyth-Edwards_Notation
homepages.di.fc.ul.pt/~jpn/gv/pstools.htm
homepages.di.fc.ul.pt/~jpn/gv/tabs/chessfont.zip
include_run
http://www.pjb.com.au/
the PostScript Language Reference Manual (Adobe).

Back to P J B Computing or to www.pjb.com.au . . .

 ... ... @@ -19,7 +19,7 @@ (/home/pjb/ps/lib/chess.ps) run %---------------- Constants ------------------- /dx 40 def % the size of the piece /Chess.dx 40 def % the size of the piece /coordsize { dx 0.55 mul } def % the size of the coordinates /insidesize { dx 0.7 mul } def % the size of the letters inside the squares ... ... @@ -82,5 +82,37 @@ on a full FEN string.) def /Times-Roman 16 selectfont /y 200 def long_string 180 {400 y moveto show /y y 19 sub def} BreakIntoLines showpage %%Page: 3 3 %%BeginPageSetup %%EndPageSetup /xmax currentpagedevice (PageSize) get 0 get def /ymax currentpagedevice (PageSize) get 1 get def (/home/pjb/ps/lib/chess.ps) run gsave 40 80 translate (8/8/8/8/8/8/8/8 w) false fen2board 7 3 0.0 true (NOW) Marker 7 4 0.0 true (13) Marker 7 5 0.3 false (WW) Marker 7 6 0.3 false (ll) Marker 6 3 0.0 true (x) Marker 6 4 0.0 true (x) Marker 6 5 0.3 false (x) Marker 6 6 0.3 false (x) Marker 5 3 0.0 true (.) Marker 5 4 0.0 true (.) Marker 5 5 0.3 false (.) Marker 5 6 0.3 false (.) Marker 4 3 0.0 true (2) Marker 4 4 0.0 true (2) Marker 4 5 0.3 false (2) Marker 4 6 0.3 false (2) Marker 3 3 0.1 true (X) Marker 3 4 0.1 true (X) Marker 3 5 0.1 false (X) Marker 3 6 0.1 false (X) Marker grestore showpage %%EOF
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!