%!PS
%% From Template.ps
%% The methods to support Latin Squares puzzles, 6x6, one page, 12
/inch { 72 mul } def
/Onesq { 24 } def
/Halfsq { Onesq 2 div } def
/Strongline { 0.05 inch setlinewidth } def
/Mediumline { 0.03 inch setlinewidth } def
/Thinline { 0.01 inch setlinewidth } def
/BigFont { /Helvetica findfont 18 scalefont setfont } def
/SmallFont { /Helvetica findfont 14 scalefont setfont } def
/LegendFont { /Helvetica findfont 12 scalefont setfont } def
/TinyFont { /Helvetica findfont 8 scalefont setfont } def
%%%%%%%%%%%%%%%%%%%
%% include Utilities.ps
%%%%%%%%%%%%%%%%%%%
/ShowNum {
%%% Displays a number (converts to string, then show)
%%% Surround by gsave and grestore if don't want to move cursor
20 string cvs show
} def
/ShowStack {
%%% Displays all numbers on stack
%%% -- warning, this will corrupt all subsequent operations!
0 0 moveto
{
20 string cvs show
-1.5 inch -1 inch rmoveto
} repeat
} def
/CharHeight {
%%% Displays height of string argument, in points
%%% (needn't be char, string works ok)
CharCenter
exch
pop
2 mul
} def
/CharWidth {
%%% Displays width of string argument, in points
%%% (needn't be char, string works ok)
CharCenter
pop
2 mul
} def
/CharCenter {
%% returns xdisp ydisp for string argument
gsave
newpath
0 0 moveto
false charpath
flattenpath
pathbbox
exch
4 -1 roll
exch sub 2 div
3 1 roll
sub 2 div
grestore
} def
/CenterText {
%% puts text in center, horizontally and vertically
dup CharCenter rmoveto
show
} def
/FooText {
%% puts text in center, horizontally and vertically
CharCenter
2 div exch 2 div
0 0 moveto
4 -1 roll exch sub
3 -1 roll moveto
show
} def
%%%%%%%%%%%%%%%%%%%
%% end include Utilities.ps
%%%%%%%%%%%%%%%%%%%
/PageIntro {
%% takes two arguments, xbound and ybound
%% xBound yBound PageIntro
%% position page, start at upper left
%% -- the intro is moving the starting point down and over
1.0 inch 10.5 inch translate
1 1 scale
neg Onesq mul exch Onesq mul exch translate
%% exch pop
%% neg Onesq mul 0 exch translate
} def
/LatinSqGrid {
%% usage: xBound yBound LatinSqGrid
%% first, duplicate stack appropriately
%% need to end up with
%% yBound yBound xBound
%% xBound xBound yBound
%% xBound yBound xBound
dup 3 -1 roll exch
dup 3 -1 roll exch
exch dup 3 -1 roll
exch dup 3 -1 roll
exch dup 3 -1 roll
dup 3 -1 roll exch
exch dup 3 -1 roll
exch
%% see TestStack
%% first, outer, darker circumference
%% uses xBound yBound xBound
Strongline
gsave
%% xBound used here:
Onesq mul 0 rlineto
%% yBound used here:
0 exch Onesq mul rlineto
%% xBound used here:
Onesq mul neg 0 rlineto
closepath
stroke
grestore
%% 6 {
%% ShowNum
%% 0.15 inch 0.15 inch rmoveto
%% } repeat
%% next, inner, lighter crosshatch
Thinline
%% -- horizontals
%% uses xBound xBound yBound
gsave
0 Onesq rmoveto
%% yBound used here:
-1 add
{
dup dup
%% xBound used here:
Onesq mul 0 rlineto
%% xBound used here:
Onesq mul neg Onesq rmoveto
}
repeat
pop pop
stroke
grestore
%% -- verticals
Onesq 0 rmoveto
gsave
%% uses yBound yBound xBound
%% xBound here:
-1 add
{
dup dup
%% yBound:
0 exch Onesq mul rlineto
%% yBound:
Onesq exch Onesq mul neg rmoveto
}
repeat
pop pop
stroke
grestore
} def
/VertShortStroke {
%% draws a vertical medium-weight short stroke
%% two arguments, i and j of the (interior) grid;
%% line is between [i-1][j] and [i][j]
%% -- to the left of gridbox i, j
%% [but remember, we count 0,0 == lower left]
gsave
Mediumline
0 0 moveto
Onesq mul exch Onesq mul exch rmoveto
0 Onesq rlineto
stroke
grestore
} def
/HorizShortStroke {
%% draws a horizontal medium-weight short stroke
%% two arguments, i and j of the (interior) grid;
%% line is between [i][j-1] and [i][j]
%% -- underneath gridbox i, j
gsave
0 0 moveto
Mediumline
Onesq mul exch Onesq mul exch rmoveto
Onesq 0 rlineto
stroke
grestore
} def
/TextChar {
%% draws a letter
%% three arguments, char ch, and i and j of the (interior) grid;
%% syntax is ch i j TextChar
gsave
0 0 moveto
%% compute center of gridbox
Onesq mul exch Onesq mul exch rmoveto
Halfsq Halfsq rmoveto
CenterText
%% stroke
grestore
} def
/BasePageIntro {
%% parameters to page intro suitable for six-by-six
-1.5 6 PageIntro
} def
/Difficulty {
%% writes the Difficulty legend
%% takes one argument, the difficulty string
gsave Onesq 1.7 mul Onesq -0.7 mul moveto
%% gsave Onesq 1.5 mul Onesq -0.7 mul moveto
%% -- values for five
SmallFont (Difficulty: ) show show grestore
} def
/VerticalOffset {
%% determines vertical spacing between adjacent puzzles
0 Onesq -7 mul translate
%% 0 Onesq -6.5 mul translate
%% -- values for five
} def
/VerticalNegativeOffset {
%% counteracts vertical spacing between adjacent puzzles
0 Onesq 7 mul translate
%% -- if changing the parameters, do both of these!
} def
/HorizontalOffset {
%% determines horizontal spacing between adjacent puzzles
Onesq 8 mul 0 translate
} def
/NewColumn {
%% goes to top of new column
%% one argument -- number in column
{
VerticalNegativeOffset
} repeat
HorizontalOffset
} def
/Legend {
%% writes a small copyright message
gsave
1.25 inch -7.5 inch moveto
gsave
LegendFont
gsave
(Instructions: Complete grid by filling empty cells with letters A-F.)
show
grestore
0 -0.175 inch rmoveto
gsave
(When solved, each row/column/jigsaw piece holds all six letters.)
show
grestore
0 -0.175 inch rmoveto
gsave
(Solutions guaranteed unique. More puzzle pages at www.latinsquares.com.)
show
grestore
0 -0.175 inch rmoveto
gsave
TinyFont
(Daily Series created) show
show
( \(c\)2005 E.Anderson eric@latinsquares.com all rights reserved) show
grestore
grestore
} def
/Instructions {
} def
/Serial {
gsave
4.8 inch 9.7 inch rmoveto
show
grestore
} def
%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Example
%%%%%%%%%%%%%%%%%%%%%%%%%%
BigFont
BasePageIntro
( 1023 Wed Nov 9 21:45:56 PST 2005 ) Legend
Instructions
( Puzzle Set 1023 Z ) Serial
%%% Transformed puzzle 011112011222003332044332044535445555
%%% Transformed letters 081912311027
0 0 moveto
gsave 6 6 LatinSqGrid
1 1 VertShortStroke
1 2 VertShortStroke
2 1 VertShortStroke
2 2 VertShortStroke
2 3 VertShortStroke
2 4 VertShortStroke
3 3 VertShortStroke
3 4 VertShortStroke
4 0 VertShortStroke
4 2 VertShortStroke
5 1 VertShortStroke
5 3 VertShortStroke
5 5 VertShortStroke
0 1 HorizShortStroke
0 5 HorizShortStroke
1 3 HorizShortStroke
1 5 HorizShortStroke
2 1 HorizShortStroke
2 4 HorizShortStroke
3 1 HorizShortStroke
3 3 HorizShortStroke
3 5 HorizShortStroke
4 1 HorizShortStroke
4 2 HorizShortStroke
4 3 HorizShortStroke
4 5 HorizShortStroke
5 4 HorizShortStroke
grestore
gsave
(B)1 1 TextChar
(A)1 3 TextChar
(C)2 5 TextChar
(D)3 4 TextChar
(E)4 2 TextChar
(F)5 4 TextChar
grestore
(0) Difficulty
VerticalOffset 0 0 moveto
%%% Transformed puzzle 001222011122013142033544035554335544
%%% Transformed letters 340621350801
0 0 moveto
gsave 6 6 LatinSqGrid
1 2 VertShortStroke
1 4 VertShortStroke
2 1 VertShortStroke
2 3 VertShortStroke
3 0 VertShortStroke
3 2 VertShortStroke
3 4 VertShortStroke
4 1 VertShortStroke
4 3 VertShortStroke
5 1 VertShortStroke
5 5 VertShortStroke
0 3 HorizShortStroke
0 4 HorizShortStroke
1 2 HorizShortStroke
1 5 HorizShortStroke
2 1 HorizShortStroke
2 2 HorizShortStroke
2 3 HorizShortStroke
2 4 HorizShortStroke
2 5 HorizShortStroke
3 2 HorizShortStroke
3 3 HorizShortStroke
3 5 HorizShortStroke
4 1 HorizShortStroke
4 4 HorizShortStroke
4 5 HorizShortStroke
5 2 HorizShortStroke
5 4 HorizShortStroke
grestore
gsave
(A)0 4 TextChar
(C)1 3 TextChar
(B)1 5 TextChar
(D)3 2 TextChar
(F)5 0 TextChar
(E)5 1 TextChar
grestore
(0) Difficulty
VerticalOffset 0 0 moveto
%%% Transformed puzzle 012222011122000113405533455553444433
%%% Transformed letters 350023021805
0 0 moveto
gsave 6 6 LatinSqGrid
1 2 VertShortStroke
1 3 VertShortStroke
2 0 VertShortStroke
2 1 VertShortStroke
2 3 VertShortStroke
2 4 VertShortStroke
3 1 VertShortStroke
3 2 VertShortStroke
3 3 VertShortStroke
3 5 VertShortStroke
4 1 VertShortStroke
4 4 VertShortStroke
5 1 VertShortStroke
5 2 VertShortStroke
5 3 VertShortStroke
5 4 VertShortStroke
0 4 HorizShortStroke
0 5 HorizShortStroke
1 2 HorizShortStroke
1 5 HorizShortStroke
2 1 HorizShortStroke
2 3 HorizShortStroke
3 2 HorizShortStroke
3 4 HorizShortStroke
3 5 HorizShortStroke
4 1 HorizShortStroke
4 5 HorizShortStroke
5 2 HorizShortStroke
grestore
gsave
(C)0 0 TextChar
(B)0 3 TextChar
(A)0 5 TextChar
(E)3 0 TextChar
(D)3 5 TextChar
(F)5 0 TextChar
grestore
(0) Difficulty
VerticalOffset 0 0 moveto
%%% Transformed puzzle 011222001332011342013342055344555544
%%% Transformed letters 130610092421
0 0 moveto
gsave 6 6 LatinSqGrid
1 1 VertShortStroke
1 2 VertShortStroke
1 4 VertShortStroke
2 1 VertShortStroke
2 4 VertShortStroke
3 3 VertShortStroke
4 0 VertShortStroke
4 3 VertShortStroke
4 4 VertShortStroke
5 2 VertShortStroke
5 5 VertShortStroke
0 3 HorizShortStroke
0 5 HorizShortStroke
1 1 HorizShortStroke
1 3 HorizShortStroke
1 4 HorizShortStroke
2 1 HorizShortStroke
2 2 HorizShortStroke
2 3 HorizShortStroke
2 5 HorizShortStroke
3 1 HorizShortStroke
3 2 HorizShortStroke
3 4 HorizShortStroke
3 5 HorizShortStroke
4 2 HorizShortStroke
4 3 HorizShortStroke
4 5 HorizShortStroke
5 2 HorizShortStroke
grestore
gsave
(C)1 1 TextChar
(B)1 2 TextChar
(A)1 5 TextChar
(D)2 4 TextChar
(E)3 2 TextChar
(F)4 5 TextChar
grestore
(0) Difficulty
3 NewColumn 0 0 moveto
%%% Transformed puzzle 000111022111023344022344523334555554
%%% Transformed letters 301721041924
0 0 moveto
gsave 6 6 LatinSqGrid
1 3 VertShortStroke
1 4 VertShortStroke
2 0 VertShortStroke
2 1 VertShortStroke
2 2 VertShortStroke
2 3 VertShortStroke
3 3 VertShortStroke
4 1 VertShortStroke
4 3 VertShortStroke
4 5 VertShortStroke
5 1 VertShortStroke
5 2 VertShortStroke
5 3 VertShortStroke
5 4 VertShortStroke
0 3 HorizShortStroke
1 3 HorizShortStroke
1 5 HorizShortStroke
2 2 HorizShortStroke
2 4 HorizShortStroke
2 5 HorizShortStroke
3 2 HorizShortStroke
3 3 HorizShortStroke
3 5 HorizShortStroke
4 1 HorizShortStroke
4 4 HorizShortStroke
4 5 HorizShortStroke
5 1 HorizShortStroke
grestore
gsave
(A)0 1 TextChar
(B)2 0 TextChar
(D)3 2 TextChar
(C)3 4 TextChar
(E)4 5 TextChar
(F)5 5 TextChar
grestore
(0) Difficulty
VerticalOffset 0 0 moveto
%%% Transformed puzzle 000011002231222331423331455551444455
%%% Transformed letters 332817122935
0 0 moveto
gsave 6 6 LatinSqGrid
1 1 VertShortStroke
1 2 VertShortStroke
1 3 VertShortStroke
2 2 VertShortStroke
2 4 VertShortStroke
2 5 VertShortStroke
3 3 VertShortStroke
3 5 VertShortStroke
4 1 VertShortStroke
4 2 VertShortStroke
4 3 VertShortStroke
4 4 VertShortStroke
5 0 VertShortStroke
5 2 VertShortStroke
5 3 VertShortStroke
5 4 VertShortStroke
0 2 HorizShortStroke
1 1 HorizShortStroke
1 2 HorizShortStroke
1 4 HorizShortStroke
2 1 HorizShortStroke
2 3 HorizShortStroke
3 1 HorizShortStroke
3 4 HorizShortStroke
3 5 HorizShortStroke
4 1 HorizShortStroke
4 5 HorizShortStroke
5 2 HorizShortStroke
grestore
gsave
(B)2 0 TextChar
(A)2 5 TextChar
(D)4 0 TextChar
(C)4 1 TextChar
(F)5 0 TextChar
(E)5 2 TextChar
grestore
(0) Difficulty
VerticalOffset 0 0 moveto
%%% Transformed puzzle 001111200131220333220433254444555554
%%% Transformed letters 130819122622
0 0 moveto
gsave 6 6 LatinSqGrid
1 1 VertShortStroke
1 3 VertShortStroke
1 5 VertShortStroke
2 0 VertShortStroke
2 2 VertShortStroke
2 4 VertShortStroke
3 2 VertShortStroke
4 0 VertShortStroke
4 1 VertShortStroke
4 3 VertShortStroke
4 4 VertShortStroke
5 1 VertShortStroke
5 2 VertShortStroke
5 3 VertShortStroke
5 5 VertShortStroke
0 4 HorizShortStroke
1 1 HorizShortStroke
1 2 HorizShortStroke
1 3 HorizShortStroke
1 5 HorizShortStroke
2 3 HorizShortStroke
2 4 HorizShortStroke
3 2 HorizShortStroke
3 3 HorizShortStroke
3 4 HorizShortStroke
4 4 HorizShortStroke
4 5 HorizShortStroke
5 1 HorizShortStroke
grestore
gsave
(A)1 3 TextChar
(C)2 4 TextChar
(B)2 5 TextChar
(E)3 1 TextChar
(D)3 4 TextChar
(F)4 3 TextChar
grestore
(0) Difficulty
VerticalOffset 0 0 moveto
%%% Transformed puzzle 000111020314220314253314255334255544
%%% Transformed letters 260023012505
0 0 moveto
gsave 6 6 LatinSqGrid
1 0 VertShortStroke
1 2 VertShortStroke
1 4 VertShortStroke
2 5 VertShortStroke
3 3 VertShortStroke
3 4 VertShortStroke
4 1 VertShortStroke
4 3 VertShortStroke
5 1 VertShortStroke
5 2 VertShortStroke
0 3 HorizShortStroke
1 1 HorizShortStroke
1 2 HorizShortStroke
1 3 HorizShortStroke
1 4 HorizShortStroke
1 5 HorizShortStroke
2 1 HorizShortStroke
2 2 HorizShortStroke
2 3 HorizShortStroke
2 4 HorizShortStroke
3 1 HorizShortStroke
3 2 HorizShortStroke
3 4 HorizShortStroke
3 5 HorizShortStroke
4 1 HorizShortStroke
4 3 HorizShortStroke
4 5 HorizShortStroke
5 2 HorizShortStroke
5 5 HorizShortStroke
grestore
gsave
(C)0 0 TextChar
(B)0 4 TextChar
(A)0 5 TextChar
(D)3 0 TextChar
(F)4 3 TextChar
(E)4 4 TextChar
grestore
(0) Difficulty
3 NewColumn 0 0 moveto
%%% Transformed puzzle 000011220031233331223441255541555444
%%% Transformed letters 120117062225
0 0 moveto
gsave 6 6 LatinSqGrid
1 1 VertShortStroke
1 4 VertShortStroke
1 5 VertShortStroke
2 2 VertShortStroke
2 3 VertShortStroke
2 4 VertShortStroke
3 1 VertShortStroke
3 2 VertShortStroke
3 4 VertShortStroke
4 2 VertShortStroke
4 3 VertShortStroke
4 4 VertShortStroke
5 0 VertShortStroke
5 2 VertShortStroke
5 5 VertShortStroke
0 2 HorizShortStroke
1 1 HorizShortStroke
1 2 HorizShortStroke
1 4 HorizShortStroke
2 1 HorizShortStroke
2 5 HorizShortStroke
3 1 HorizShortStroke
3 3 HorizShortStroke
3 4 HorizShortStroke
4 1 HorizShortStroke
4 2 HorizShortStroke
4 5 HorizShortStroke
5 3 HorizShortStroke
grestore
gsave
(A)0 4 TextChar
(B)1 5 TextChar
(D)2 0 TextChar
(C)2 5 TextChar
(E)3 1 TextChar
(F)4 4 TextChar
grestore
(0) Difficulty
VerticalOffset 0 0 moveto
%%% Transformed puzzle 001112011222013425003425333455344455
%%% Transformed letters 200112043113
0 0 moveto
gsave 6 6 LatinSqGrid
1 1 VertShortStroke
1 2 VertShortStroke
1 4 VertShortStroke
2 0 VertShortStroke
2 2 VertShortStroke
2 3 VertShortStroke
3 4 VertShortStroke
4 1 VertShortStroke
4 4 VertShortStroke
4 5 VertShortStroke
5 3 VertShortStroke
5 4 VertShortStroke
0 1 HorizShortStroke
0 4 HorizShortStroke
1 3 HorizShortStroke
1 5 HorizShortStroke
2 1 HorizShortStroke
2 2 HorizShortStroke
2 3 HorizShortStroke
2 4 HorizShortStroke
2 5 HorizShortStroke
3 1 HorizShortStroke
3 2 HorizShortStroke
3 3 HorizShortStroke
3 4 HorizShortStroke
4 2 HorizShortStroke
4 3 HorizShortStroke
5 2 HorizShortStroke
5 5 HorizShortStroke
grestore
gsave
(B)0 1 TextChar
(A)0 4 TextChar
(D)2 4 TextChar
(C)2 5 TextChar
(E)3 3 TextChar
(F)5 4 TextChar
grestore
(0) Difficulty
VerticalOffset 0 0 moveto
%%% Transformed puzzle 001112000122031124333224355554355444
%%% Transformed letters 352932210020
0 0 moveto
gsave 6 6 LatinSqGrid
1 1 VertShortStroke
1 3 VertShortStroke
2 0 VertShortStroke
2 3 VertShortStroke
2 4 VertShortStroke
3 2 VertShortStroke
3 3 VertShortStroke
3 5 VertShortStroke
4 1 VertShortStroke
4 2 VertShortStroke
4 3 VertShortStroke
4 4 VertShortStroke
5 1 VertShortStroke
5 2 VertShortStroke
0 1 HorizShortStroke
0 4 HorizShortStroke
1 2 HorizShortStroke
1 3 HorizShortStroke
2 1 HorizShortStroke
2 2 HorizShortStroke
2 4 HorizShortStroke
2 5 HorizShortStroke
3 1 HorizShortStroke
3 3 HorizShortStroke
4 1 HorizShortStroke
4 5 HorizShortStroke
5 3 HorizShortStroke
5 5 HorizShortStroke
grestore
gsave
(A)0 5 TextChar
(C)3 2 TextChar
(B)3 3 TextChar
(D)4 0 TextChar
(F)5 0 TextChar
(E)5 3 TextChar
grestore
(0) Difficulty
VerticalOffset 0 0 moveto
%%% Transformed puzzle 011111002221033222034455034445334555
%%% Transformed letters 332317072826
0 0 moveto
gsave 6 6 LatinSqGrid
1 1 VertShortStroke
1 2 VertShortStroke
1 3 VertShortStroke
1 4 VertShortStroke
2 0 VertShortStroke
2 3 VertShortStroke
2 4 VertShortStroke
3 0 VertShortStroke
3 1 VertShortStroke
3 2 VertShortStroke
3 3 VertShortStroke
4 1 VertShortStroke
5 1 VertShortStroke
5 2 VertShortStroke
5 5 VertShortStroke
0 5 HorizShortStroke
1 1 HorizShortStroke
1 4 HorizShortStroke
2 3 HorizShortStroke
2 5 HorizShortStroke
3 2 HorizShortStroke
3 4 HorizShortStroke
3 5 HorizShortStroke
4 1 HorizShortStroke
4 4 HorizShortStroke
4 5 HorizShortStroke
5 3 HorizShortStroke
5 4 HorizShortStroke
grestore
gsave
(A)1 4 TextChar
(B)2 0 TextChar
(C)3 0 TextChar
(E)4 1 TextChar
(D)4 3 TextChar
(F)5 2 TextChar
grestore
(0) Difficulty
3 NewColumn 0 0 moveto
showpage