1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20\startluacode
21 local sin, cos, tan, log = math.sin, math.cos, math.tan, math.log
22
23 local N = 20
24 local M = 0
25
26 M = math.random(100)/100
27
28 local mybitmaps = {
29 [1] = function(x,y)
30 x = x + M
31 y = y + M
32 local z = sin(x*x) - cos(y*y)
33 if z > 0 then
34 return '1'
35 else
36 return '0'
37 end
38 end,
39 [2] = function(x,y)
40 x = x + M
41 y = y + M
42 local z = sin(x*x) + cos(y*y) + tan(x*y)
43 if z > 0 then
44 return '1'
45 else
46 return '0'
47 end
48 end,
49 [3] = function(x,y)
50 x = x + M
51 y = y + M
52 local z = tan(x*x) + tan(y*y) + tan(y*x)
53 if z > 0 then
54 return '1'
55 else
56 return '0'
57 end
58 end,
59 [4] = function(x,y)
60 x = x + M
61 y = y + M
62 local z = sin(sin(x*x)) - sin(sin(y*y))
63 if z > 0 then
64 return '1'
65 else
66 return '0'
67 end
68 end,
69 [5] = function(x,y)
70 x = x + M
71 y = y + M
72 local z = (100*(log(x*x) - log(y*y))) // 2
73 if (z % 2) == 1 then
74 return '1'
75 else
76 return '0'
77 end
78 end
79 }
80
81 local mybitmap = mybitmaps[1]
82
83
84
85
86 function MP.setmybitmap(n)
87 N = n
88 potrace.setbitmap("MyBitMap",potrace.contourplot(N,N,mybitmap))
89 M = M + math.pi/24
90 end
91\stopluacode
92
93\definecolor[colortwo][h=0057b7]
94\definecolor[colorone][h=ffd700]
95
96\setMPvariables[whatever][n=100,a=1]
97
98\startuseMPgraphic{whatever}{n,a}
99 MP.setmybitmap(\MPvar{n});
100
101 picture r ; r := image (
102 draw lmt_potraced [
103 stringname = "MyBitMap",
104 value = "1",
105 size = 0,
106 ] ;
107
108 ) xysized (5cm,5cm) ;
109 setbounds r to
110 boundingbox r
111
112 enlarged 2.5mm
113 ;
114
115 if \MPvar{a} = 2 :
116 draw boundingbox r
117 withcolor .5white
118
119 withpen pencircle scaled 2.5 ;
120 draw r
121 withcolor .3white ;
122 else :
123 fill boundingbox r
124 withcolor "colorone" ;
125 draw r
126 withcolor "colortwo" ;
127 fi ;
128\stopuseMPgraphic
129
130\setupTEXpage[offset=1cm]
131
132\protected\def\MakeOneSet#1#2#3#4{
133 \vbox \bgroup
134 \offinterlineskip
135 \dorecurse{#1} {
136 \hbox \bgroup
137 \dorecurse{#2} {
138 \useMPgraphic{whatever}{n=#3,a=#4}
139 \hskip5mm
140 }
141 \unskip
142 \egroup
143 \vskip5mm
144 }
145 \removelastskip
146 \egroup
147}
148
149\protected\def\MakeSet#1#2#3#4#5{
150 \dorecurse{#1} {
151 \startTEXpage
152 \MakeOneSet{#2}{#3}{#4}{#5}
153 \stopTEXpage
154 }
155}
156
157
158\setuplayout[tight]
159
160\startbuffer[game2023]
161
162\page \setupwhitespace[big]
163
164\subject{The addendum to the 2023 Xmas card}
165
166This is a \quote {find matching shapes} game for all ages, inspired by the
167\PRAGMA\ 2023 Xmas card. You can invent the rules yourself but this is how we
168played it during the holidays:
169
170\startitemize
171 \startitem
172 We took the (3 by 5, 12 page, complexity 20) version and printed two
173 copies on 160200 gram paper. Any decent printer will scale to fit and it
174 looks quite okay on a proper inkjet printer.
175 \stopitem
176 \startitem
177 The print is cut into rectangles. You dont need to be too precise but try
178 to get through the middle of the white lines. Shuffle the cards and make a
179 stack.
180 \stopitem
181 \startitem
182 Best let one person lay out the cards slowly till there are some six by
183 four on the table and at some point matching pairs will show up.
184 \stopitem
185 \startitem
186 Add more card if needed. After a while players will start calling the
187 cards names, because human pattern recognition kicks in.
188 \stopitem
189 \startitem
190 When a player extracts a match the emptyt spaces will be filled with new
191 samples.
192 \stopitem
193 \startitem
194 Of course once you run out of new cards to lay out, the collection of
195 pairs speeds up. Some players can catch up at the end.
196 \stopitem
197\stopitemize
198
199Nothing prohibits to play with three copies and we can make it as complex as
200needed. Afterwards you can try to figure out the logic behind the shapes. If
201there is demand more variants can be provided and we can introduce more
202randomness. Just ask for it on the mailing list.
203
204\blank
205
206\startlines
207Hans Hagen Ton Otten
208PRAGMA ADE, Hasselt NL
209December 2023
210\stoplines
211
212\page
213
214\stopbuffer
215
216\continueifinputfile{sgames2023.mkxl}
217
218\setupbodyfont[dejavu] \setupwhitespace[big]
219
220\starttext
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250\stoptext
251 |