diff --git a/toys/index.md b/toys/index.md index e8169d7..b512cc3 100644 --- a/toys/index.md +++ b/toys/index.md @@ -14,5 +14,6 @@ Maybe you'll just wonder why I spend so much time on this garbage. * [Grep Dict](grepdict/) runs `grep` on `/usr/share/dict/words`; perfect for cheating on crossword puzzles * If you need to write someone a letter but really don't want to, try my [social letter generator](letter.html) +* [Pocket Mastermind](mastermind.pdf) / [PostScript Source](mastermind.ps) * [Crunt](crunt.html) * [Serpeński Gasket on Tektronix Terminal](serpenski.html) which amazed 4 whole people at my high school in 1991. diff --git a/toys/mastermind.pdf b/toys/mastermind.pdf new file mode 100644 index 0000000..ebc6648 Binary files /dev/null and b/toys/mastermind.pdf differ diff --git a/toys/mastermind.ps b/toys/mastermind.ps new file mode 100644 index 0000000..d5462a0 --- /dev/null +++ b/toys/mastermind.ps @@ -0,0 +1,109 @@ +%!PS-Adobe-3.0 +%%Title: Pocket Mastermind +%%Creator: Neale Pickett +%%Orientation: Landscape +%%DocumentMedia: US-Letter 612 792 80 ( ) ( ) +%%EndComments + +/pagewidth currentpagedevice /PageSize get 0 get def +/pageheight currentpagedevice /PageSize get 1 get def +/r 10 def + +/pie { + 1 dict begin + /r exch def + + gsave + currentpoint translate + + 0 60 360 { + gsave + dup rotate + 120 mod 60 div + 0.4 mul 0.0 add setgray + + 0 0 moveto + 0 r lineto stroke + grestore + } for + + r 0 moveto + 0 0 r 0 360 arc + closepath stroke + + grestore + end +} def + +/grid { + 1 dict begin + /r exch def + + % Big plus + r 2 mul 0 rlineto + r -1 mul r -1 mul rmoveto + 0 r 2 mul rlineto + + r -1 mul r -2 mul rmoveto + 0 r 2 mul rlineto + r 2 mul 0 rlineto + 0 r -2 mul rlineto + r -2 mul 0 rlineto + stroke + end +} def + +/pierow { + 2 dict begin + /gridp exch def + /r exch def + gsave + currentpoint translate + 0 1 3 { + r 2.5 mul mul + 0 moveto + r pie + } for + + gridp { + 4 r 2.6 mul mul + 0 moveto + r 0.7 mul grid + } if + grestore + end +} def + +/board { + 10 dict begin + /r exch def + gsave + r false pierow + 0 r 2.0 mul rmoveto + 0 1 9 { + pop + 0 r 2.2 mul rmoveto + r true pierow + } for + grestore + end +} def + +0 1 1 { + pop + 1 2 3 { + 10 dict begin + gsave + pagewidth 2 div pageheight 2 div translate + 90 mul rotate + pageheight -2 div pagewidth -2 div translate + 50 30 translate + 0 1 3 { + pageheight 4 div mul 0 moveto + r board + } for + grestore + end + } for + showpage +} for