diff options
author | Karl Berry <karl@freefriends.org> | 2010-11-27 16:13:31 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-11-27 16:13:31 +0000 |
commit | a71d255dc4a69bebb54dea17ce8e53b28f78fa8e (patch) | |
tree | b971e53b031ec0fd6e56305990c8587e6b1dbd82 /Master/texmf-dist/doc/fonts/chess/chessdiag.Xmf | |
parent | ecb029342d29c71bc14ed1750bfdfeeeba6a6cef (diff) |
chess update from 1992, to get copyright file, etc.
git-svn-id: svn://tug.org/texlive/trunk@20582 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/fonts/chess/chessdiag.Xmf')
-rw-r--r-- | Master/texmf-dist/doc/fonts/chess/chessdiag.Xmf | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/fonts/chess/chessdiag.Xmf b/Master/texmf-dist/doc/fonts/chess/chessdiag.Xmf new file mode 100644 index 00000000000..1023accfcbd --- /dev/null +++ b/Master/texmf-dist/doc/fonts/chess/chessdiag.Xmf @@ -0,0 +1,74 @@ +% This is `chessdiag.mf' version 1.2 as of 10/91 +% METAfounded by Piet Tutelaers (internet: rcpt@urc.tue.nl) + +% file generates a complete chess diagram in a X-window + +% most versions of METAFONT have memorylimits so generating a complete +% diagram of 160 X 160 points for a 300 DPI printer is not possible + +mode_setup; +input chessbase; + +def draw_pieces(text piece_list) = + string piece, location; + for p=piece_list: + l:=length p; + exitunless (l=2) or (l=3); + if l=2: piece:="p"; i:=0; + else: piece:=substring(0,1) of p; i:=1; fi; + column:=ASCII substring(i,i+1) of p - ASCII "a"; + row:=ASCII substring(i+1,i+2) of p - ASCII "1"; + if not odd(column+row): background:=dark; else: background:=light; fi; + scantokens piece(d, column,row); + endfor; + enddef; + +def w(text piece_list) = + color:=white; + empty_board(d); draw_pieces(piece_list); + enddef; + +def b(text piece_list) = + color:=black; + draw_pieces(piece_list); + enddef; + +M=8; % number of squares +d#:=100pt#/M; % size per square +fine#:=1/100*d#; thin#:=1/90*d#; thick#:=1/36*d#; border#:=1/20*d#; +define_blacker_pixels(fine, thin, thick, border); +define_whole_pixels(d); +pickup pencircle scaled fine; fine_pen:=savepen ; % for drawing dark squares +pickup pencircle scaled border; border_pen:=savepen ; % for border ofboard +pickup pencircle scaled thin; thin_pen:=savepen ; % for drawing pieces +pickup pencircle scaled thick; thick_pen:=savepen; % for drawing inside pieces +light=0; dark=1; white=0; black=1; + +% put here the wanted diagram (ex.: mate in three problem) + +w("Kc2","Nb4","Bf8","b3","g7"); +b("Ka3","b6"); + +% Next function draws the picture on the screen (Showit is derived from +% showit in plain.mf). The value of screen_rows is redefined because +% otherwise the MF-picture will be truncated. To fit the picture in a +% X-window the next geometry definition in ~/.Xdefaults is assumed: +% +% Metafont*geometry: 500x500+200+200 +% +% This geometry together with the offset (-40, 460) in the line +% furtheron did the job on my NCD16 X-terminal! Perhaps you need to fiddle +% with the constants to get it right for your display. +screen_rows:=500; +def Openit = openwindow currentwindow + from origin to (screen_rows,screen_cols) at (-40,460) enddef; + def Showit = Openit; let Showit=Showit_; Showit enddef; % first time only + def Showit_ = display currentpicture inwindow currentwindow enddef; + +Showit; + +message("White mates in three moves. Do you see how?"); +StopMe; + +end; + |