#define BOARD_MAX 18 #define BOARD_SIZE 19 % set colors /board_color 0 0 0 rgbcolor def % black /line_color 1 1 1 rgbcolor def % white /draw_board { % - => - (draw the playing surface) board_color setcolor clippath fill line_color setcolor 0 1 BOARD_MAX { dup 0 moveto 0 BOARD_MAX rlineto 0 exch moveto BOARD_MAX 0 rlineto } for stroke pause } def /makewin { % - => - (builds a test window) /GoWindow DefaultWindow % create a subclass dictbegin /FrameLabel ( 1st Go board ) def dictend classbegin /PaintClient { draw_board } def /PaintIcon { draw_board } def /ClientPath { % x y w h => - 4 2 roll translate BOARD_SIZE div exch BOARD_SIZE div exch scale . 5 .5 translate -.5 -.5 BOARD_SIZE BOARD_SIZE rectpath } def /IconPath {ClientPath} def classend def /win framebuffer /new GoWindow send def % cliche /reshapefromuser win send % resize window /map win send % draw it } def makewin