1[
2 {"type":"Text","value":"\n"},
3 {"type":"KeywordDeclaration","value":"import"},
4 {"type":"Text","value":" "},
5 {"type":"Name","value":"uint"},
6 {"type":"Text","value":" "},
7 {"type":"KeywordDeclaration","value":"from"},
8 {"type":"Text","value":" "},
9 {"type":"Name","value":"std"},
10 {"type":"Operator","value":"::"},
11 {"type":"Name","value":"integer"},
12 {"type":"Text","value":"\n"},
13 {"type":"KeywordDeclaration","value":"import"},
14 {"type":"Text","value":" "},
15 {"type":"Name","value":"uinteger"},
16 {"type":"Text","value":" "},
17 {"type":"KeywordDeclaration","value":"from"},
18 {"type":"Text","value":" "},
19 {"type":"Name","value":"js"},
20 {"type":"Operator","value":"::"},
21 {"type":"Name","value":"core"},
22 {"type":"Text","value":"\n"},
23 {"type":"KeywordDeclaration","value":"import"},
24 {"type":"Text","value":" "},
25 {"type":"Name","value":"random"},
26 {"type":"Text","value":" "},
27 {"type":"KeywordDeclaration","value":"from"},
28 {"type":"Text","value":" "},
29 {"type":"Name","value":"js"},
30 {"type":"Operator","value":"::"},
31 {"type":"Name","value":"math"},
32 {"type":"Text","value":"\n"},
33 {"type":"KeywordDeclaration","value":"import"},
34 {"type":"Text","value":" "},
35 {"type":"Name","value":"Document"},
36 {"type":"Punctuation","value":","},
37 {"type":"Text","value":" "},
38 {"type":"Name","value":"Window"},
39 {"type":"Punctuation","value":","},
40 {"type":"Text","value":" "},
41 {"type":"Name","value":"CanvasRenderingContext2D"},
42 {"type":"Text","value":" "},
43 {"type":"KeywordDeclaration","value":"from"},
44 {"type":"Text","value":" "},
45 {"type":"Name","value":"w3c"},
46 {"type":"Operator","value":"::"},
47 {"type":"Name","value":"dom"},
48 {"type":"Text","value":"\n"},
49 {"type":"KeywordDeclaration","value":"import"},
50 {"type":"Text","value":" "},
51 {"type":"Name","value":"Element"},
52 {"type":"Punctuation","value":","},
53 {"type":"Name","value":"HTMLCanvasElement"},
54 {"type":"Punctuation","value":","},
55 {"type":"Text","value":" "},
56 {"type":"Name","value":"HTMLImageElement"},
57 {"type":"Punctuation","value":","},
58 {"type":"Text","value":" "},
59 {"type":"Name","value":"MouseEvent"},
60 {"type":"Text","value":" "},
61 {"type":"KeywordDeclaration","value":"from"},
62 {"type":"Text","value":" "},
63 {"type":"Name","value":"w3c"},
64 {"type":"Operator","value":"::"},
65 {"type":"Name","value":"dom"},
66 {"type":"Text","value":"\n\n"},
67 {"type":"KeywordDeclaration","value":"import"},
68 {"type":"Text","value":" "},
69 {"type":"Name","value":"model"},
70 {"type":"Text","value":"\n"},
71 {"type":"KeywordDeclaration","value":"import"},
72 {"type":"Text","value":" "},
73 {"type":"Name","value":"view"},
74 {"type":"Text","value":"\n\n"},
75 {"type":"CommentMultiline","value":"/**\n * Add a given number of bombs to the board.\n */"},
76 {"type":"Text","value":"\n"},
77 {"type":"KeywordDeclaration","value":"method"},
78 {"type":"Text","value":" "},
79 {"type":"Name","value":"add_random_bombs"},
80 {"type":"Punctuation","value":"("},
81 {"type":"Name","value":"model"},
82 {"type":"Operator","value":"::"},
83 {"type":"Name","value":"Board"},
84 {"type":"Text","value":" "},
85 {"type":"Name","value":"board"},
86 {"type":"Punctuation","value":","},
87 {"type":"Text","value":" "},
88 {"type":"Name","value":"uint"},
89 {"type":"Text","value":" "},
90 {"type":"Name","value":"n"},
91 {"type":"Punctuation","value":")"},
92 {"type":"Text","value":" "},
93 {"type":"Operator","value":"-\u003e"},
94 {"type":"Text","value":" "},
95 {"type":"Name","value":"model"},
96 {"type":"Operator","value":"::"},
97 {"type":"Name","value":"Board"},
98 {"type":"Operator","value":":"},
99 {"type":"Text","value":"\n "},
100 {"type":"Name","value":"uinteger"},
101 {"type":"Text","value":" "},
102 {"type":"Name","value":"remaining"},
103 {"type":"Text","value":" "},
104 {"type":"Operator","value":"="},
105 {"type":"Text","value":" "},
106 {"type":"Operator","value":"|"},
107 {"type":"Name","value":"board"},
108 {"type":"Punctuation","value":"."},
109 {"type":"Name","value":"squares"},
110 {"type":"Operator","value":"|"},
111 {"type":"Text","value":" \n "},
112 {"type":"CommentSingle","value":"// Use Knuth's algorithm S\n"},
113 {"type":"Text","value":" "},
114 {"type":"Keyword","value":"for"},
115 {"type":"Text","value":" "},
116 {"type":"Name","value":"x"},
117 {"type":"Text","value":" "},
118 {"type":"Keyword","value":"in"},
119 {"type":"Text","value":" "},
120 {"type":"LiteralNumberInteger","value":"0"},
121 {"type":"Punctuation","value":".."},
122 {"type":"Name","value":"board"},
123 {"type":"Punctuation","value":"."},
124 {"type":"Name","value":"width"},
125 {"type":"Operator","value":":"},
126 {"type":"Text","value":"\n "},
127 {"type":"Keyword","value":"for"},
128 {"type":"Text","value":" "},
129 {"type":"Name","value":"y"},
130 {"type":"Text","value":" "},
131 {"type":"Keyword","value":"in"},
132 {"type":"Text","value":" "},
133 {"type":"LiteralNumberInteger","value":"0"},
134 {"type":"Punctuation","value":".."},
135 {"type":"Name","value":"board"},
136 {"type":"Punctuation","value":"."},
137 {"type":"Name","value":"height"},
138 {"type":"Operator","value":":"},
139 {"type":"Text","value":"\n "},
140 {"type":"CommentSingle","value":"// Flip a coin (so-to-speak)\n"},
141 {"type":"Text","value":" "},
142 {"type":"Keyword","value":"if"},
143 {"type":"Text","value":" "},
144 {"type":"Name","value":"random"},
145 {"type":"Punctuation","value":"("},
146 {"type":"Name","value":"remaining"},
147 {"type":"Punctuation","value":")"},
148 {"type":"Text","value":" "},
149 {"type":"Operator","value":"\u003c"},
150 {"type":"Text","value":" "},
151 {"type":"Name","value":"n"},
152 {"type":"Operator","value":":"},
153 {"type":"Text","value":"\n "},
154 {"type":"CommentSingle","value":"// create bomb square\n"},
155 {"type":"Text","value":" "},
156 {"type":"Name","value":"model"},
157 {"type":"Operator","value":"::"},
158 {"type":"Name","value":"Square"},
159 {"type":"Text","value":" "},
160 {"type":"Name","value":"s"},
161 {"type":"Text","value":" "},
162 {"type":"Operator","value":"="},
163 {"type":"Text","value":" "},
164 {"type":"Name","value":"model"},
165 {"type":"Operator","value":"::"},
166 {"type":"Name","value":"HiddenSquare"},
167 {"type":"Punctuation","value":"("},
168 {"type":"KeywordConstant","value":"true"},
169 {"type":"Punctuation","value":","},
170 {"type":"KeywordConstant","value":"false"},
171 {"type":"Punctuation","value":")"},
172 {"type":"Text","value":"\n "},
173 {"type":"CommentSingle","value":"// Update board\n"},
174 {"type":"Text","value":" "},
175 {"type":"Name","value":"board"},
176 {"type":"Text","value":" "},
177 {"type":"Operator","value":"="},
178 {"type":"Text","value":" "},
179 {"type":"Name","value":"model"},
180 {"type":"Operator","value":"::"},
181 {"type":"Name","value":"set_square"},
182 {"type":"Punctuation","value":"("},
183 {"type":"Name","value":"board"},
184 {"type":"Punctuation","value":",("},
185 {"type":"Name","value":"uint"},
186 {"type":"Punctuation","value":")"},
187 {"type":"Text","value":" "},
188 {"type":"Name","value":"x"},
189 {"type":"Punctuation","value":","},
190 {"type":"Text","value":" "},
191 {"type":"Punctuation","value":"("},
192 {"type":"Name","value":"uint"},
193 {"type":"Punctuation","value":")"},
194 {"type":"Text","value":" "},
195 {"type":"Name","value":"y"},
196 {"type":"Punctuation","value":","},
197 {"type":"Name","value":"s"},
198 {"type":"Punctuation","value":")"},
199 {"type":"Text","value":"\n "},
200 {"type":"CommentSingle","value":"// Reduce number of bombs to place\n"},
201 {"type":"Text","value":" "},
202 {"type":"Name","value":"n"},
203 {"type":"Text","value":" "},
204 {"type":"Operator","value":"="},
205 {"type":"Text","value":" "},
206 {"type":"Name","value":"n"},
207 {"type":"Text","value":" "},
208 {"type":"Operator","value":"-"},
209 {"type":"Text","value":" "},
210 {"type":"LiteralNumberInteger","value":"1"},
211 {"type":"Text","value":"\n "},
212 {"type":"CommentSingle","value":"// Reduce remaining options\n"},
213 {"type":"Text","value":" "},
214 {"type":"Name","value":"remaining"},
215 {"type":"Text","value":" "},
216 {"type":"Operator","value":"="},
217 {"type":"Text","value":" "},
218 {"type":"Name","value":"remaining"},
219 {"type":"Text","value":" "},
220 {"type":"Operator","value":"-"},
221 {"type":"Text","value":" "},
222 {"type":"LiteralNumberInteger","value":"1"},
223 {"type":"Text","value":"\n "},
224 {"type":"CommentSingle","value":"// return updated board\n"},
225 {"type":"Text","value":" "},
226 {"type":"Keyword","value":"return"},
227 {"type":"Text","value":" "},
228 {"type":"Name","value":"board"},
229 {"type":"Text","value":"\n\n"},
230 {"type":"CommentMultiline","value":"/**\n * Handle a mouse event on the canvas\n */"},
231 {"type":"Text","value":"\n"},
232 {"type":"KeywordDeclaration","value":"method"},
233 {"type":"Text","value":" "},
234 {"type":"Name","value":"onclick_handler"},
235 {"type":"Punctuation","value":"("},
236 {"type":"Name","value":"MouseEvent"},
237 {"type":"Text","value":" "},
238 {"type":"Name","value":"e"},
239 {"type":"Punctuation","value":","},
240 {"type":"Text","value":" "},
241 {"type":"Operator","value":"\u0026"},
242 {"type":"Name","value":"view"},
243 {"type":"Operator","value":"::"},
244 {"type":"Name","value":"State"},
245 {"type":"Text","value":" "},
246 {"type":"Name","value":"state"},
247 {"type":"Punctuation","value":","},
248 {"type":"Text","value":" "},
249 {"type":"Name","value":"Window"},
250 {"type":"Text","value":" "},
251 {"type":"Name","value":"window"},
252 {"type":"Punctuation","value":")"},
253 {"type":"Operator","value":":"},
254 {"type":"Text","value":"\n "},
255 {"type":"CommentSingle","value":"// Convert from view to world coordinates\n"},
256 {"type":"Text","value":" "},
257 {"type":"Name","value":"uint"},
258 {"type":"Text","value":" "},
259 {"type":"Name","value":"x"},
260 {"type":"Text","value":" "},
261 {"type":"Operator","value":"="},
262 {"type":"Text","value":" "},
263 {"type":"Name","value":"e"},
264 {"type":"Operator","value":"-\u003e"},
265 {"type":"Name","value":"offsetX"},
266 {"type":"Text","value":" "},
267 {"type":"Operator","value":"/"},
268 {"type":"Text","value":" "},
269 {"type":"Name","value":"state"},
270 {"type":"Operator","value":"-\u003e"},
271 {"type":"Name","value":"gridsize"},
272 {"type":"Text","value":"\n "},
273 {"type":"Name","value":"uint"},
274 {"type":"Text","value":" "},
275 {"type":"Name","value":"y"},
276 {"type":"Text","value":" "},
277 {"type":"Operator","value":"="},
278 {"type":"Text","value":" "},
279 {"type":"Name","value":"e"},
280 {"type":"Operator","value":"-\u003e"},
281 {"type":"Name","value":"offsetY"},
282 {"type":"Text","value":" "},
283 {"type":"Operator","value":"/"},
284 {"type":"Text","value":" "},
285 {"type":"Name","value":"state"},
286 {"type":"Operator","value":"-\u003e"},
287 {"type":"Name","value":"gridsize"},
288 {"type":"Text","value":"\n "},
289 {"type":"CommentSingle","value":"// Update board\n"},
290 {"type":"Text","value":" "},
291 {"type":"Keyword","value":"if"},
292 {"type":"Text","value":" "},
293 {"type":"Name","value":"e"},
294 {"type":"Operator","value":"-\u003e"},
295 {"type":"Name","value":"shiftKey"},
296 {"type":"Operator","value":":"},
297 {"type":"Text","value":"\n "},
298 {"type":"Name","value":"state"},
299 {"type":"Operator","value":"-\u003e"},
300 {"type":"Name","value":"board"},
301 {"type":"Text","value":" "},
302 {"type":"Operator","value":"="},
303 {"type":"Text","value":" "},
304 {"type":"Name","value":"model"},
305 {"type":"Operator","value":"::"},
306 {"type":"Name","value":"flag_square"},
307 {"type":"Punctuation","value":"("},
308 {"type":"Name","value":"state"},
309 {"type":"Operator","value":"-\u003e"},
310 {"type":"Name","value":"board"},
311 {"type":"Punctuation","value":","},
312 {"type":"Name","value":"x"},
313 {"type":"Punctuation","value":","},
314 {"type":"Name","value":"y"},
315 {"type":"Punctuation","value":")"},
316 {"type":"Text","value":"\n "},
317 {"type":"Keyword","value":"else"},
318 {"type":"Operator","value":":"},
319 {"type":"Text","value":"\n "},
320 {"type":"Name","value":"state"},
321 {"type":"Operator","value":"-\u003e"},
322 {"type":"Name","value":"board"},
323 {"type":"Text","value":" "},
324 {"type":"Operator","value":"="},
325 {"type":"Text","value":" "},
326 {"type":"Name","value":"model"},
327 {"type":"Operator","value":"::"},
328 {"type":"Name","value":"expose_square"},
329 {"type":"Punctuation","value":"("},
330 {"type":"Name","value":"state"},
331 {"type":"Operator","value":"-\u003e"},
332 {"type":"Name","value":"board"},
333 {"type":"Punctuation","value":","},
334 {"type":"Name","value":"x"},
335 {"type":"Punctuation","value":","},
336 {"type":"Name","value":"y"},
337 {"type":"Punctuation","value":")"},
338 {"type":"Text","value":"\n "},
339 {"type":"CommentSingle","value":"// Render initial board\n"},
340 {"type":"Text","value":" "},
341 {"type":"Name","value":"view"},
342 {"type":"Operator","value":"::"},
343 {"type":"Name","value":"draw_board"},
344 {"type":"Punctuation","value":"("},
345 {"type":"Operator","value":"*"},
346 {"type":"Name","value":"state"},
347 {"type":"Punctuation","value":")"},
348 {"type":"Text","value":"\n "},
349 {"type":"CommentSingle","value":"// Finally determine game status\n"},
350 {"type":"Text","value":" "},
351 {"type":"Punctuation","value":"("},
352 {"type":"KeywordType","value":"bool"},
353 {"type":"Text","value":" "},
354 {"type":"Name","value":"gameOver"},
355 {"type":"Punctuation","value":","},
356 {"type":"Text","value":" "},
357 {"type":"KeywordType","value":"bool"},
358 {"type":"Text","value":" "},
359 {"type":"Name","value":"winner"},
360 {"type":"Punctuation","value":")"},
361 {"type":"Text","value":" "},
362 {"type":"Operator","value":"="},
363 {"type":"Text","value":" "},
364 {"type":"Name","value":"model"},
365 {"type":"Operator","value":"::"},
366 {"type":"Name","value":"is_gameover"},
367 {"type":"Punctuation","value":"("},
368 {"type":"Name","value":"state"},
369 {"type":"Operator","value":"-\u003e"},
370 {"type":"Name","value":"board"},
371 {"type":"Punctuation","value":")"},
372 {"type":"Text","value":"\n "},
373 {"type":"CommentSingle","value":"// Check whether game over\n"},
374 {"type":"Text","value":" "},
375 {"type":"Keyword","value":"if"},
376 {"type":"Text","value":" "},
377 {"type":"Name","value":"gameOver"},
378 {"type":"Operator","value":":"},
379 {"type":"Text","value":"\n "},
380 {"type":"CommentSingle","value":"// Yes, but win or lose?\n"},
381 {"type":"Text","value":" "},
382 {"type":"Keyword","value":"if"},
383 {"type":"Text","value":" "},
384 {"type":"Name","value":"winner"},
385 {"type":"Operator","value":":"},
386 {"type":"Text","value":"\n "},
387 {"type":"Name","value":"window"},
388 {"type":"Operator","value":"-\u003e"},
389 {"type":"Name","value":"alert"},
390 {"type":"Punctuation","value":"("},
391 {"type":"Error","value":"\""},
392 {"type":"Name","value":"Well"},
393 {"type":"Text","value":" "},
394 {"type":"Name","value":"done"},
395 {"type":"Text","value":" "},
396 {"type":"Operator","value":"---"},
397 {"type":"Text","value":" "},
398 {"type":"Name","value":"You"},
399 {"type":"Text","value":" "},
400 {"type":"Name","value":"Found"},
401 {"type":"Text","value":" "},
402 {"type":"Keyword","value":"all"},
403 {"type":"Text","value":" "},
404 {"type":"Name","value":"the"},
405 {"type":"Text","value":" "},
406 {"type":"Name","value":"Mines"},
407 {"type":"Operator","value":"!"},
408 {"type":"Error","value":"\""},
409 {"type":"Punctuation","value":")"},
410 {"type":"Text","value":"\n "},
411 {"type":"Keyword","value":"else"},
412 {"type":"Operator","value":":"},
413 {"type":"Text","value":"\n "},
414 {"type":"Name","value":"window"},
415 {"type":"Operator","value":"-\u003e"},
416 {"type":"Name","value":"alert"},
417 {"type":"Punctuation","value":"("},
418 {"type":"Error","value":"\""},
419 {"type":"Name","value":"Game"},
420 {"type":"Text","value":" "},
421 {"type":"Name","value":"Over"},
422 {"type":"Text","value":" "},
423 {"type":"Operator","value":"---"},
424 {"type":"Text","value":" "},
425 {"type":"Name","value":"You"},
426 {"type":"Text","value":" "},
427 {"type":"Name","value":"Lost"},
428 {"type":"Operator","value":"!"},
429 {"type":"Error","value":"\""},
430 {"type":"Punctuation","value":")"},
431 {"type":"Text","value":"\n "},
432 {"type":"CommentSingle","value":"// Done\n"},
433 {"type":"Text","value":"\n"},
434 {"type":"CommentMultiline","value":"/**\n * Create a new game of Minesweeper\n */"},
435 {"type":"Text","value":"\n"},
436 {"type":"Keyword","value":"public"},
437 {"type":"Text","value":" "},
438 {"type":"Keyword","value":"export"},
439 {"type":"Text","value":" "},
440 {"type":"KeywordDeclaration","value":"method"},
441 {"type":"Text","value":" "},
442 {"type":"Name","value":"main"},
443 {"type":"Punctuation","value":"("},
444 {"type":"Name","value":"uint"},
445 {"type":"Text","value":" "},
446 {"type":"Name","value":"width"},
447 {"type":"Punctuation","value":","},
448 {"type":"Text","value":" "},
449 {"type":"Name","value":"uint"},
450 {"type":"Text","value":" "},
451 {"type":"Name","value":"height"},
452 {"type":"Punctuation","value":","},
453 {"type":"Text","value":" "},
454 {"type":"Name","value":"uint"},
455 {"type":"Text","value":" "},
456 {"type":"Name","value":"bombs"},
457 {"type":"Punctuation","value":","},
458 {"type":"Text","value":" "},
459 {"type":"Name","value":"Window"},
460 {"type":"Text","value":" "},
461 {"type":"Name","value":"window"},
462 {"type":"Punctuation","value":","},
463 {"type":"Text","value":" "},
464 {"type":"Name","value":"HTMLCanvasElement"},
465 {"type":"Text","value":" "},
466 {"type":"Name","value":"canvas"},
467 {"type":"Punctuation","value":","},
468 {"type":"Text","value":" "},
469 {"type":"Name","value":"HTMLImageElement"},
470 {"type":"Punctuation","value":"[]"},
471 {"type":"Text","value":" "},
472 {"type":"Name","value":"images"},
473 {"type":"Punctuation","value":")"},
474 {"type":"Text","value":"\n"},
475 {"type":"CommentSingle","value":"// Requires at least 9 images\n"},
476 {"type":"Keyword","value":"requires"},
477 {"type":"Text","value":" "},
478 {"type":"Operator","value":"|"},
479 {"type":"Name","value":"images"},
480 {"type":"Operator","value":"|"},
481 {"type":"Text","value":" "},
482 {"type":"Operator","value":"=="},
483 {"type":"Text","value":" "},
484 {"type":"LiteralNumberInteger","value":"13"},
485 {"type":"Operator","value":":"},
486 {"type":"Text","value":"\n "},
487 {"type":"Name","value":"Document"},
488 {"type":"Text","value":" "},
489 {"type":"Name","value":"document"},
490 {"type":"Text","value":" "},
491 {"type":"Operator","value":"="},
492 {"type":"Text","value":" "},
493 {"type":"Name","value":"window"},
494 {"type":"Operator","value":"-\u003e"},
495 {"type":"Name","value":"document"},
496 {"type":"Text","value":"\n "},
497 {"type":"CommentSingle","value":"// NOTE: following should not be required!\n"},
498 {"type":"Text","value":" "},
499 {"type":"Name","value":"Element"},
500 {"type":"Text","value":" "},
501 {"type":"Name","value":"c"},
502 {"type":"Text","value":" "},
503 {"type":"Operator","value":"="},
504 {"type":"Text","value":" "},
505 {"type":"Name","value":"document"},
506 {"type":"Operator","value":"-\u003e"},
507 {"type":"Name","value":"getElementById"},
508 {"type":"Punctuation","value":"("},
509 {"type":"Error","value":"\""},
510 {"type":"Name","value":"myCanvas"},
511 {"type":"Error","value":"\""},
512 {"type":"Punctuation","value":")"},
513 {"type":"Text","value":"\n "},
514 {"type":"CommentSingle","value":"// Create a standard sized board\n"},
515 {"type":"Text","value":" "},
516 {"type":"Name","value":"model"},
517 {"type":"Operator","value":"::"},
518 {"type":"Name","value":"Board"},
519 {"type":"Text","value":" "},
520 {"type":"Name","value":"board"},
521 {"type":"Text","value":" "},
522 {"type":"Operator","value":"="},
523 {"type":"Text","value":" "},
524 {"type":"Name","value":"model"},
525 {"type":"Operator","value":"::"},
526 {"type":"Name","value":"Board"},
527 {"type":"Punctuation","value":"("},
528 {"type":"Name","value":"width"},
529 {"type":"Punctuation","value":","},
530 {"type":"Name","value":"height"},
531 {"type":"Punctuation","value":")"},
532 {"type":"Text","value":"\n "},
533 {"type":"CommentSingle","value":"// Add bombs\n"},
534 {"type":"Text","value":" "},
535 {"type":"Name","value":"board"},
536 {"type":"Text","value":" "},
537 {"type":"Operator","value":"="},
538 {"type":"Text","value":" "},
539 {"type":"Name","value":"add_random_bombs"},
540 {"type":"Punctuation","value":"("},
541 {"type":"Name","value":"board"},
542 {"type":"Punctuation","value":","},
543 {"type":"Name","value":"bombs"},
544 {"type":"Punctuation","value":")"},
545 {"type":"Text","value":"\n "},
546 {"type":"CommentSingle","value":"// Initialise the view state\n"},
547 {"type":"Text","value":" "},
548 {"type":"Operator","value":"\u0026"},
549 {"type":"Name","value":"view"},
550 {"type":"Operator","value":"::"},
551 {"type":"Name","value":"State"},
552 {"type":"Text","value":" "},
553 {"type":"Name","value":"state"},
554 {"type":"Text","value":" "},
555 {"type":"Operator","value":"="},
556 {"type":"Text","value":" "},
557 {"type":"Keyword","value":"new"},
558 {"type":"Text","value":" "},
559 {"type":"Name","value":"view"},
560 {"type":"Operator","value":"::"},
561 {"type":"Name","value":"init"},
562 {"type":"Punctuation","value":"("},
563 {"type":"Name","value":"document"},
564 {"type":"Punctuation","value":","},
565 {"type":"Name","value":"canvas"},
566 {"type":"Punctuation","value":","},
567 {"type":"Name","value":"board"},
568 {"type":"Punctuation","value":","},
569 {"type":"Name","value":"images"},
570 {"type":"Punctuation","value":")"},
571 {"type":"Text","value":"\n "},
572 {"type":"CommentSingle","value":"// Render initial board\n"},
573 {"type":"Text","value":" "},
574 {"type":"Name","value":"view"},
575 {"type":"Operator","value":"::"},
576 {"type":"Name","value":"draw_board"},
577 {"type":"Punctuation","value":"("},
578 {"type":"Operator","value":"*"},
579 {"type":"Name","value":"state"},
580 {"type":"Punctuation","value":")"},
581 {"type":"Text","value":"\n "},
582 {"type":"CommentSingle","value":"// Configure mouse click listener\n"},
583 {"type":"Text","value":" "},
584 {"type":"Name","value":"c"},
585 {"type":"Operator","value":"-\u003e"},
586 {"type":"Name","value":"addEventListener"},
587 {"type":"Punctuation","value":"("},
588 {"type":"Error","value":"\""},
589 {"type":"Name","value":"click"},
590 {"type":"Error","value":"\""},
591 {"type":"Punctuation","value":","},
592 {"type":"Operator","value":"\u0026"},
593 {"type":"Punctuation","value":"("},
594 {"type":"Name","value":"MouseEvent"},
595 {"type":"Text","value":" "},
596 {"type":"Name","value":"e"},
597 {"type":"Text","value":" "},
598 {"type":"Operator","value":"-\u003e"},
599 {"type":"Text","value":" "},
600 {"type":"Name","value":"onclick_handler"},
601 {"type":"Punctuation","value":"("},
602 {"type":"Name","value":"e"},
603 {"type":"Punctuation","value":","},
604 {"type":"Name","value":"state"},
605 {"type":"Punctuation","value":","},
606 {"type":"Name","value":"window"},
607 {"type":"Punctuation","value":")))"},
608 {"type":"Text","value":"\n \n"}
609]
View as plain text