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 ) xysized (10cm,10cm) ;
108 setbounds r to
109 boundingbox r
110 enlarged 5mm
111 ;
112
113 if \MPvar{a} = 2 :
114 draw boundingbox r
115 withcolor .5white
116 withpen pencircle scaled 5 ;
117 draw r
118 withcolor .3white ;
119 else :
120 fill boundingbox r
121 withcolor "colorone" ;
122 draw r
123 withcolor "colortwo" ;
124 fi ;
125\stopuseMPgraphic
126
127\protected\def\MakeSet#1#2#3#4#5{
128 \dorecurse{#1} {
129 \startTEXpage[offset=1cm]
130 \vbox \bgroup
131 \offinterlineskip
132 \dorecurse{#2} {
133 \hbox \bgroup
134 \dorecurse{#3} {
135 \useMPgraphic{whatever}{n=#4,a=#5}
136 \hskip5mm
137 }
138 \unskip
139 \egroup
140 \vskip5mm
141 }
142 \removelastskip
143 \egroup
144 \stopTEXpage
145 }
146}
147
148\setuplayout[tight]
149
150\startbuffer[game2023]
151
152\page \setupwhitespace[big]
153
154\subject{The addendum to the 2023 Xmas card}
155
156This is a \quote {find matching shapes} game for all ages, inspired by the
157\PRAGMA\ 2023 Xmas card. You can invent the rules yourself but this is how we
158played it during the holidays:
159
160\startitemize
161 \startitem
162 We took the (3 by 5, 12 page, complexity 20) version and printed two
163 copies on 160200 gram paper. Any decent printer will scale to fit and it
164 looks quite okay on a proper inkjet printer.
165 \stopitem
166 \startitem
167 The print is cut into rectangles. You dont need to be too precise but try
168 to get through the middle of the white lines. Shuffle the cards and make a
169 stack.
170 \stopitem
171 \startitem
172 Best let one person lay out the cards slowly till there are some six by
173 four on the table and at some point matching pairs will show up.
174 \stopitem
175 \startitem
176 Add more card if needed. After a while players will start calling the
177 cards names, because human pattern recognition kicks in.
178 \stopitem
179 \startitem
180 When a player extracts a match the emptyt spaces will be filled with new
181 samples.
182 \stopitem
183 \startitem
184 Of course once you run out of new cards to lay out, the collection of
185 pairs speeds up. Some players can catch up at the end.
186 \stopitem
187\stopitemize
188
189Nothing prohibits to play with three copies and we can make it as complex as
190needed. Afterwards you can try to figure out the logic behind the shapes. If
191there is demand more variants can be provided and we can introduce more
192randomness. Just ask for it on the mailing list.
193
194\blank
195
196\startlines
197Hans Hagen Ton Otten
198PRAGMA ADE, Hasselt NL
199December 2023
200\stoplines
201
202\page
203
204\stopbuffer
205
206\continueifinputfile{sgames2023.mkxl}
207
208\setupbodyfont[dejavu] \setupwhitespace[big]
209
210\starttext
211
212
213
214
215
216\MakeSet{1}{40}{30} {15} {1}
217\MakeSet{1}{40}{30} {20} {1}
218
219
220
221\stoptext
222 |