Newsgroups: comp.text.tex Path: utzoo!utgpu!watserv1!maytag!aftermath!ychen From: ychen@aftermath.waterloo.edu (Youyi Chen) Subject: Re: Latex or Postscript for Go boards anyone? Organization: University of Waterloo Date: Sat, 22 Sep 90 05:20:26 GMT Message-ID: <1990Sep22.052026.20863@aftermath.waterloo.edu> Summary: Go, WeiQi, LaTeX, PostScript References: <4962@uqcspe.cs.uq.oz.au> Lines: 334 Following is a sample of LaTeX Go board. I also attach a PostScript program for drawing Go board which I wrote and posted to rec.games.go sometime ago. Youyi Chen ( 4 dan ) %% A Sample of LaTeX Go Board %% Youyi Chen %% University of Waterloo, Dept. of Statistics and Actuarial Science %% ychen@aftermath.waterloo.edu %% Sept. 1990 %% \documentstyle[12pt]{article} \pagestyle{empty} \begin{document} \centerline{{\Huge No Way Out?}} \vspace{.5in} \begin{center} \setlength{\unitlength}{5mm} \begin{picture}(18,18)(1,1) %% moves \put(6,3){\circle*{1}} \put(7,3){\circle*{1}} \put(8,3){\circle*{1}} \put(5,4){\circle*{1}} \put(9,4){\circle*{1}} \put(5,6){\circle*{1}} \put(9,6){\circle*{1}} \put(7,6){\circle*{1}} \put(7,7){\circle*{1}} \put(6,4){\circle{1}} \put(7,4){\circle{1}} \put(8,4){\circle{1}} \put(6,5){\circle{1}} \put(8,5){\circle{1}} %% the board %% horizontal \multiput(1,1)(0,1){3}{\line(1,0){18}} \put(1,4){\line(1,0){4}} \put(9,4){\line(1,0){10}} \put(1,5){\line(1,0){4.5}} \put(6.5,5){\line(1,0){1}} \put(8.5,5){\line(1,0){10.5}} \multiput(1,6)(0,1){14}{\line(1,0){18}} %%vertical \multiput(1,1)(1,0){5}{\line(0,1){18}} \put(6,1){\line(0,1){2}} \put(6,5.5){\line(0,1){13.5}} \put(7,1){\line(0,1){2}} \put(7,4.5){\line(0,1){14.5}} \put(8,1){\line(0,1){2}} \put(8,5.5){\line(0,1){13.5}} \multiput(9,1)(1,0){11}{\line(0,1){18}} %% the stars \multiput(4,4)(6,0){3}{\circle*{0.3}} \multiput(4,10)(6,0){3}{\circle*{0.3}} \multiput(4,16)(6,0){3}{\circle*{0.3}} \end{picture} \end{center} \end{document} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% From ychen Wed Aug 8 17:17:06 EDT 1990 Article 2195 of rec.games.go: Newsgroups: rec.games.go Path: water!ychen >From: ychen@water.waterloo.edu (Youyi Chen) Subject: PostScript WeiQi: A PostScript program for drawing the Go Games. Message-ID: <1990Aug8.211019.1809@water.waterloo.edu> Summary: WeiQi, Go, PostScript. Organization: University of Waterloo References: <1990Aug8.154047.1604@athena.mit.edu> Distribution: na Date: Wed, 8 Aug 90 21:10:19 GMT Lines: 242 Following is a PostScript program for drawing the Go games. A sample game data is supplied in the program. cut lines from --- Cut here ----, send it to a PostScript Laser Printer. You will get a very nice picture of a life and death problem. The program can be used to print any game with stone mark, title and comments. See the comments in the program for details. Youyi Chen. % ------ cut here ----- cut here --- delete this line ----- %!PS-Adobe-1.0 % ******* WeiQi.PS ********1.0** % A PostScript Program for Drawing Go game. % % Youyi Chen. % Wed Aug 8 15:41:30 EDT 1990 % % Youyi Chen ychen@aftermath.waterloo.edu % Department of Statistics and Acturial Science % University of Waterloo % Waterloo, Ontario % Canada, N2L 3G1 % % General: % A sample game is supplied with this program. Send this % program directly to a Postscript printer, you will get % a very interesting ancient Chinese WeiQi life and death % problem drawn by PostScript. % % If you want to print you own games, you only need to edit % the game data, title, comments using the same format % in the example given below, i.e. edit lines between % --- begin game--- and ---- end game ----. % % If you like to keep data and the program separated, % You can either write a unix shell program or use "run" % operator in postscript. % % User Functions: % Title % (string) Title ---- print title. % Comment % (string) Comment --- print comments. % Newline % Newline --- break line in text. % W % n1 n2 (n3) W --- put a white stone at coordinate n1 n2, % and set mark with n3. () gives no mark. % 1 <= n1 <= 19, 1<= n2 <= 19, n3 can be % any character or symbol. % B % n1 n2 (n3) B --- same as W, but for black stone. % StartComment % StarComment --- begin to input comments (setfont). % StartGame % StarGame --- begin to input game data. % CopyLeft: % You are free to use and distribute it. % Please send me your suggestions and comments. % % PostScript is a trademark of Adobe Systems, Incorporated. % -------- Variables and Procedures -------- /unitlength 18 def % board unit length = 0.25 inch /linewidth 0.5 def % board grid linewidth /unit { unitlength mul } def /LM 0 def % left margin for board and comments 24 unit /RM exch def % right margin for comments /TitleFont { /Times-Bold findfont 25 scalefont setfont } def /CommentFont { /Times-Italic findfont 12 scalefont setfont } def /Title { % stack: (title) TitleFont dup stringwidth pop 18 unit sub -0.5 mul 20 unit moveto show } def /StartComment { -2 unit /ypos exch def % board lowleft y margine /lineheight 16 def % distance between lines of text CommentFont LM ypos moveto } def 0.55 unit ceiling /sfs exch def % stone font size /StoneFont { % find font for marking the stones /Helvetica-Bold findfont sfs scalefont setfont } def /StoneRadius % stone radius { unitlength 2.1 div } def /W { % stack: x y (s) /str exch def % draw a white stone at x y with mark s at center unit 1 unit sub /cy exch def unit 1 unit sub /cx exch def newpath cx cy StoneRadius 0 360 arc gsave 1 setgray fill grestore 0 setgray stroke /xp { cx str stringwidth pop 0.5 mul sub } def /yp { cy sfs 0.325 mul sub} def xp yp moveto str show } def /B { % stack: x y (s) /str exch def % draw a black stone at x y with mark s at center unit 1 unit sub /cy exch def unit 1 unit sub /cx exch def newpath cx cy StoneRadius 0 360 arc 0 setgray fill /xp { cx str stringwidth pop 0.5 mul sub } def /yp { cy sfs 0.325 mul sub} def 1 setgray xp yp moveto str show } def /mr {unitlength 7 div} def % ridius of mark circle /SetMark % stack: x y { mr 0 360 arc fill} def % set mark at 9 special points /DrawBoard { linewidth setlinewidth newpath 0 1 unit 18 unit % draw grid { 0 moveto 0 18 unit rlineto } for stroke newpath 0 1 unit 18 unit { 0 exch moveto 18 unit 0 rlineto } for stroke 3 6 15 { unit 3 unit SetMark } for % set marks 3 6 15 { unit 9 unit SetMark } for 3 6 15 { unit 15 unit SetMark} for } def /StartGame { StoneFont } def % A simple text formatter for printing comments /Newline { % moveto next line ypos lineheight sub /ypos exch def LM ypos moveto } def % move to next line /Comment { % stack: str dup stringwidth pop currentpoint pop add RM gt {Newline} if show } def % print string % -------- Main Program -------- 170 300 translate % move the origin .8 .8 scale % set global scale DrawBoard % -------- begin of the sample game --------- (No Way Out?) Title StartComment (Gui-Si:) Comment Newline ( A life and death problem ) Comment (from an ancient Chinese WeiQi book.) Comment Newline Newline Newline Newline Newline (WeiQi.PS) Comment Newline (A PostScript program for drawing Go game.) Comment Newline (PostScript is a trade mark of ) Comment (Adobe System, Incorporated. ) Comment (Weiqi is Go in Chinese.) Comment Newline (Please send any comment and ) Comment (suggestion to ychen@water.waterloo.edu) Comment StartGame % -------- Problem -------- 6 3 () B 7 3 () B 8 3 () B 5 4 () B 9 4 () B 5 6 () B 9 6 () B 7 6 () B 7 7 () B 6 4 () W 6 5 () W 7 4 () W 8 4 () W 8 5 () W % -------- transformation -------- 14 17 () B 13 17 () B 12 17 () B 15 16 () B 11 16 () B 15 14 () B 11 14 () B 13 14 () B 13 13 () B 14 16 () W 14 15 () W 13 16 () W 12 16 () W 12 15 () W % ------ solution --------- 13 12 (1) W 14 14 (2) B 12 14 (3) W 12 13 (4) B 11 15 (5) W 10 15 (6) B 10 14 (7) W 11 13 (8) B 10 16 (9) W % -------- end of the sample game --------- showpage