Article View: comp.lang.postscript
Article #7004Re: Postscript board drawing routine?
From: Emil Rainero
Date: Fri, 18 Mar 1988 16:29
Date: Fri, 18 Mar 1988 16:29
103 lines
2735 bytes
2735 bytes
In article <22210@bbn.COM> cosell@bbn.com (Bernie Cosell) writes:
>Does anyone have PostScript code for drawing a GO board (pushing my luck:
>including, if possible, code to draw stones with numbers superimposed in the
>usual way)? Thanks!
> __
> / ) Bernie Cosell
> /--< _ __ __ o _ BBN Labs, Cambridge, MA 02238
>/___/_(<_/ (_/) )_(_(<_ cosell@bbn.com
There was a problem with the NeWS go program. They forgot to set the line
width correctly (it was pretty ugly on the LW). This greatly modified go
drawing program should work nicely. Enjoy.
%!PSAdobe-1.0
%%Creator: Emil Rainero, Webster Research Center, Xerox Corporation
%%Title: go board
/gridsize 39 def % how big a grid for the board
% translate the appropriate amount
clippath pathbbox pop pop translate
% set the scale
clippath pathbbox gridsize div exch gridsize div exch
/yscale exch def /xscale exch def clear
xscale xscale scale
% mustn't forget to set the line width
1 xscale div setlinewidth
% set the font
/Helvetica findfont 0.4 scalefont setfont
-.4 -.4 translate
% clear the clipping region to white
1 setgray clippath fill 0 setgray
% fill the contents of the go board with a color
1 1 moveto 1 gridsize lineto gridsize gridsize lineto gridsize 1 lineto
closepath
.745 .478 .314 setrgbcolor %Brown (looks like wood, get it?)
fill
/drawgrid {
0 setgray
1 1 gridsize {
dup 1 moveto dup gridsize lineto
dup 1 exch moveto gridsize
exch lineto
} for
stroke
} bind def
/centershow
{
dup stringwidth -2.0 div exch -2.0 div exch pop -.1 rmoveto
show
} bind def
/black {
moveto
gsave
currentpoint
newpath
.5 0 360 arc 0 setgray fill
grestore
1 setgray ( ) cvs
centershow
} bind def
/white {
moveto
gsave
currentpoint
newpath
.5 0 360 arc gsave 1 setgray fill grestore 0 setgray stroke
grestore
0 setgray ( ) cvs
centershow
} bind def
% draw the grid
drawgrid
% draw the stones
1 1 1 white
2 3 3 black
10 5 1 black
100 5 2 white
1000 5 3 white
% all done
showpage
--
Emil Rainero -- Xerox Webster Research Center
UUCP: {seismo,allegra,decvax,cmcl2,topaz}!rochester!rocksanne!rainero
Arpa Internet: Rainero.wbst@xerox.arpa
Technical Details
Message-ID:
<544@rocksanne.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!bbn!rochester!rocksanne!raineroReferences:
<22210@bbn.COM>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!bbn!rochester!rocksanne!rainero From: rainero@rocksanne.UUCP (Emil Rainero) Newsgroups: comp.lang.postscript Subject: Re: Postscript board drawing routine? Message-ID: <544@rocksanne.UUCP> Date: 18 Mar 88 16:29:54 GMT References: <22210@bbn.COM> Reply-To: rainero@rocksanne.UUCP (Emil Rainero) Organization: Xerox Corp., Webster, NY Lines: 103