-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmin.p8
710 lines (634 loc) · 26.8 KB
/
min.p8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
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
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
pico-8 cartridge // http://www.pico-8.com
version 33
__lua__
-- bubble cat
-- BY PANCELOR
--[[
# printh.lua
print-debugging tools
]]
-- quotes and returns its arguments
-- usage:
-- ?qq("p.x=",x,"p.y=",y)
function qq(...)
local args=pack(...)
local s=""
for i=1,args.n do
s..=qt(args[i]).." "
end
return s
end
function pq(...)
printh(qq(...))
end
-- sorta like sprintf (from c)
-- usage:
-- ?qf("p={x=%,y=%}",p.x,p.y)
function qf(...)
local args=pack(...)
local fstr=args[1]
local argi=2
local s=""
for i=1,#fstr do
local c=sub(fstr,i,i)
if c=="%" then
s..=qt(args[argi])
argi+=1
else
s..=c
end
end
return s
end
function pqf(...)
printh(qf(...))
end
-- quotes an array
-- (its annoying sometimes that qq returns {1=foo,2=bar}
-- when you want {foo,bar} instead)
function qa(t)
local s="{"
for v in all(t) do
s..=qt(v)..","
end
return s.."}"
end
function pqx(v)
pq(v,tohex(v))
end
function pqa(arr)
printh(qa(arr))
end
-- usage:
-- tap("rect_collide")
-- will show all args to/results from rect_collide
function tap(fname, obj,drop_self)
local obj=obj or _env
local original=obj[fname]
assert(type(fname)=="string","use tap(\"foo\") not tap(foo)")
assert(type(original)=="function",type(original))
obj[fname]=function(self,...)
pq("->",fname,drop_self and "<self>" or self,...)
local ret=original(self,...)
pq("<-",fname,ret)
return ret
end
end
--[[
# implementation details
]]
-- quote a single argument
-- like tostr, but works on tables
function qt(t,sep)
if type(t)~="table" then return tostr(t) end
local s="{"
for k,v in pairs(t) do
s..=(type(k)=="table" and k.base and "<"..k.base.name..">") or tostr(k)
if k=="base" then
s..="=<"..tostr(v and v.name)..">"
else
s..="="..qt(v)
end
s..=sep or ","
end
return s.."}"
end
-->8
--[[
# helper.lua
various useful functions
]]
--[[
# misc
]]
-- needs to be defined first
function arr0(zero,arr)
arr[0]=zero
return arr
end
dirx=arr0(-1,split"1,0,0,1,1,-1,-1")
diry=arr0(0,split"0,-1,1,-1,1,1,-1")
-- usage:
-- bkg=memoize(function(x,y) return hrnd(seed,x,y)&0x0.ffff end,
-- function(x,y) return x+(y>>16) end))
-- todo: can i do what keyer does, but more convenient somehow?
-- ◆⧗ this adds a decent bit of perf overhead; consider inlining
function memoize(f, keyer)
keyer=keyer or f_id
local _cache={}
return function(...)
local args={...}
local key=keyer(unpack(args))
local val=_cache[key]
if not val then
val=f(unpack(args))
_cache[key]=val
end
return val
end
end
function rect_collide(x0,y0,w0,h0,x2,y2, w2,h2)
return x2<x0+w0
and y2<y0+h0
and x0<x2+(w2 or 1)
and y0<y2+(h2 or 1)
end
function offscreen(x,y)
return not rect_collide(%0x5f28,%0x5f2a,128,128,x,y)
end
-- -- given a screenpos, return a worldpos
-- function ppi(x,y)
-- return (x+%0x5f28)\8,(y+%0x5f2a)\8
-- end
function inbounds(x,y)
return 0<=x and x<worldw
and 0<=y and y<worldh
end
function sum(arr)
local res=0
for v in all(arr) do
res+=v
end
return res
end
-- returns a number that goes from 0 to 1 in period seconds
-- (never quite hits 1, actually)
function cycle(period)
return time()%period/period
end
-- -- requires special arranging of the spritesheet
-- function autotile(mx,my, t)
-- t=t or mget(mx,my)
-- for i=0,3 do
-- local solid_neighbor=fget(mget(mx+dirx[i],my+diry[i]),0)
-- t+=boolint(solid_neighbor)<<i
-- end
-- return t
-- end
--[[
# strings
]]
hex=arr0("0",split("123456789abcdef","",false))
-- assert(hex[3]=="3")
-- assert(hex[13]=="d")
-- recommended range:
-- space (start=32)
-- this gets ~95 bytes of space until past tilde (ord=126)
-- (these chars are all 1 byte
-- on twitter, and are just generally the
-- good ascii printable block)
-- for full ascii 0-255 range, see
-- extra special cases here:
-- https://www.lexaloffle.com/bbs/?tid=38692
function pack_bytes(arr, start,last)
start=start or 0
last=last or 255
local out=""
for i=1,#arr do
local c=arr[i]+start
assert(c<=last)
out..=c=="\"" and "\\\""
or c=="\\" and "\\\\"
or chr(c)
end
return out
end
-- usage:
-- print(center("hello❎❎❎❎❎❎",64,64,8))
function center(str,x,...)
local w=print(str,0,0x4000)
return str,x-w\2,...
end
-- i is an in-between-chars pointer
-- this is not the same sort of
-- number sub() uses
function splice(str,i,n, new)
return sub(str,1,i)..(new or "")..sub(str,i+n+1)
end
--assert(splice("hello",0,1,"b")=="bello")
--assert(splice("hello",1,1)=="hllo")
--assert(splice("hello",4,1,"b")=="hellb")
--assert(splice("hello",2,3,"at")=="heat")
-- substring starting at i of length n
function ssub(str,i, n)
return sub(str,i,i+(n or 1)-1)
end
function oprint(msg,x,y, cfront,cback)
print(msg,x+1,y+1,cback or 0)
print(msg,x,y,cfront or 7)
end
function oprint8(msg,x,y,cfront,cback)
for i=0,7 do
print(msg,x+dirx[i],y+diry[i],cback)
end
print(msg,x,y,cfront)
end
function ospr8(s,x,y, c)
local paldata=pack(peek(0x5f00,16))
for i=0,15 do
pal(i,c or 0)
end
for i=0,7 do
spr5(s,x+dirx[i],y+diry[i])
end
poke(0x5f00,unpack(paldata))
spr5(s,x,y)
end
function sprxy(s,...)
return s%16*8,s\16*8,...
end
function tohex(x)
return tostr(x,1)
end
function tobin(x, friendly)
local s="0b"
for i=15,-16,-1 do
s..=(x>>i)&1
if i==0 then
s..=friendly and "\n ." or "."
elseif i%4==0 then
s..=friendly and " " or ""
end
end
return s
end
function leftpad(s,n, ch)
ch=ch or "0"
s=tostr(s)
while #s<n do
s=ch..s
end
return s
end
--[[
# overrides / pico-8 things
]]
function _rectbounds(x,y,w,h,...)
return x,y,x+max(0,w-1),y+max(0,h-1),...
end
function rectfillwh(...)
rectfill(_rectbounds(...))
end
function rectwh(...)
rect(_rectbounds(...))
end
function rectfillborder(x,y,w,h,b,cborder,cmain)
if b<0 then
b*=-1
x-=b y-=b
w+=b*2 h+=b*2
end
rectfillwh(x,y,w,h,cborder)
rectfillwh(x+b,y+b,w-b*2,h-b*2,cmain)
end
-- e.g. enum"foo,bar,baz" sets
-- foo=1,bar=2,baz=3 (globally!)
-- returns a index/lookup table
function enum(str)
local index={}
for i,name in ipairs(split(str,"\n")) do
_env[name]=i
index[i]=name
end
return index
end
function nocam(f)
return function(...)
local cx,cy=camera()
f(...)
camera(cx,cy)
end
end
function lowpass(enable)
-- set lowpass filter on music
-- useful for pause menus
poke(0x5f43,enable and 0b1111 or 0)
end
_last_ust_time=-1
function upd_screenshot_title()
local function f(s,n)
return leftpad(stat(s),n)
end
if time()-_last_ust_time>=1 then
_last_ust_time=time()
extcmd("set_filename",qf("%_%_%_%t%_%_%",
"tunaquest",
f(90,4),f(91,2),f(92,2),
f(93,2),f(94,2),f(95,2)
))
end
end
-- see tech/gpio.p8; requires custom html plate
function open_external(url)
for i=1,#url do
poke(0x5f80+i,ord(url,i))
end
poke(0x5f80,1) --done
end
--[[
# functionalish stuff
]]
f_id=function(x) return x end
noop=function() end
function curry(f,...)
local args0={...}
return function(...)
return f(unpack(concat(args0,{...})))
end
end
function fmap(table,f)
local res={}
for i,v in pairs(table) do
res[i]=f(v)
end
return res
end
-- arr could be a general table here
function filter(arr,f)
local res={}
for i,v in pairs(arr) do
if (f(v)) add(res,v)
end
return res
end
function _func_or_elem_finder(f)
return type(f)=="function"
and f
or function(x) return x==f end
end
function fall(table,f)
f=_func_or_elem_finder(f)
for v in all(table) do
if (not f(v)) return
end
return true
end
function fany(table,f)
f=_func_or_elem_finder(f)
for v in all(table) do
if (f(v)) return true
end
-- return nil
end
function find(arr,f)
f=_func_or_elem_finder(f)
for i,v in ipairs(arr) do
if (f(v)) return v,i
end
-- return nil,nil
end
--[[
# table/array utils
]]
includes=fany
function back(arr,n)
return arr[#arr-(n or 1)+1]
end
-- concat two arrays together
function concat(...)
local t={}
local args={...}
for table in all(args) do
for val in all(table) do
add(t,val)
end
end
return t
end
function merge_into(obj,...)
-- careful that both inputs
-- are either shallow or
-- single-use!
-- e.g. def={x={0}} is
-- a bad idea because
-- merge(def,{}).x[1]=1 will
-- modify def.x too!
for t in all{...} do
for k,v in pairs(t) do
obj[k]=v
end
end
return obj
end
function merge(...)
return merge_into({},...)
end
clone=merge
function parse_into(obj,str, mapper)
for str2 in all(split(str)) do
local parts=split(str2,"=")
assert(#parts==2)
local k,v=unpack(parts)
obj[k]=mapper and mapper(k,v) or v
end
return obj
end
function parse(...)
return parse_into({},...)
end
function sort(arr,f)
f=f or f_id
for i=1,#arr do
for j=i+1,#arr do
if f(arr[j])<f(arr[i]) then
arr[i],arr[j]=arr[j],arr[i]
end
end
end
end
-->8
--[[
# math.lua
various pure math stuff
]]
function approach(x,target,delta)
delta=delta or 1
return x<target and min(x+delta,target) or max(x-delta,target)
end
function lerp(a,b,t) return a+(b-a)*t end
-- returns t such that x=lerp(a,b,t)
function ilerp(a,b,x) return (x-a)/(b-a) end
function clerp(a,b,t) return mid(a,b,a+(b-a)*t) end
function iclerp(a,b,x) return mid(1,(x-a)/(b-a)) end
function ease_exp(t)
return 2^(-10*t)
end
function ease_back(t)
-- return (1+c1)*t^3-c1*t^2
return (t+1.70158*(t-1))*t^2
end
-- pythag but mostly safe from 16-bit overflow
function dist(dx,dy)
local b=max(abs(dx),abs(dy))
local a=min(abs(dx),abs(dy))/b
return b*sqrt(a^2+1)
end
function sgn0(x)
return x==0 and 0 or sgn(x)
end
function align(n,a)
-- assert a is a power of 2
-- assert n is an integer
return n&~(a-1)
end
--assert(align(0,4)==0)
--assert(align(1,4)==0)
--assert(align(2,4)==0)
--assert(align(3,4)==0)
--assert(align(4,4)==4)
--assert(align(13,1)==13)
--assert(align(13,2)==12)
--assert(align(13,4)==12)
--assert(align(13,8)==8)
--assert(align(13,16)==0)
function xor(a,b)
return (a or b) and not (a and b)
end
function round(x)
return (x+0.5)\1
end
function divmod(x,y)
return x\y,x%y
end
-->8
--dev_seed=0x.7fb5
seed=dev_seed or rnd()
printh("seed: "..tohex(seed))
srand(seed)
#include min.lua
__gfx__
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00700700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00077000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00077000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00700700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
__label__
00000000011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000000
00000001111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111110000000
000000111111111111111111111111111111111111cccccc11111111111111111111111111111111111111111111111111111111111111111111111111000000
000001111111111111111111111111111111111111cccccc11111111111111111111111111111111111111111111111111111111111111111111111111100000
0000111111111111111111111111111111111111cccccccccc111111111111111111111111111111111111111111111111111111111111111111111111110000
0001111111111111111111111111111111111111cccccccccc111111111111111111111111111111111111111111111111111111111111111111111111111000
00111111111111111111111111111111111111cccccccccccccc1111111111111111111111111111111111111111111111111111111111111111111111111100
01111111111111111111111111111111111111cccccccccccccc1111111111111111111111111111111111111111111111111111111111111111111111111110
11111111111111111111111111111111111111cccccccccccccc1111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111cccccccccccccc1111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111cccccccccccccc1111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111cccccccccccccc1111111111111111111111111111111111111111111111111111111111111111111111111111
1111111111111111111111111111111111111111cccccccccc111111111111111111111111111111111111111111111111111111111111111111111111111111
1111111111111111111111111111111111111111cccccccccc111111111111111111111111111111111111111111111111111111111111111111111111111111
111111111111111111111111111111111111111111cccccc11111111111111111111111111111111111111111111111111111111111111111111111111111111
111111111111111111111111111111111111111111cccccc11111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
111111111111111111111111cccccc111111111111111111111111111111bbbbbb111111111111111111111111111111111111111111111111eeeeee11111111
111111111111111111111111cccccc111111111111111111111111111111bbbbbb111111111111111111111111111111111111111111111111eeeeee11111111
1111111111111111111111cccccccccc11111111111111111111111111bbbbbbbbbb11111111111111111111111111111111111111111111eeeeeeeeee111111
1111111111111111111111cccccccccc11111111111111111111111111bbbbbbbbbb11111111111111111111111111111111111111111111eeeeeeeeee111111
11111111111111111111cccccccccccccc1111111111111111111111bbbbbbbbbbbbbb1111111111111111111111111111111111111111eeeeeeeeeeeeee1111
11111111111111111111cccccccccccccc1111111111111111111111bbbbbbbbbbbbbb1111111111111111111111111111111111111111eeeeeeeeeeeeee1111
11111111111111111111cccccccccccccc1111111111111111111111bbbbbbbbbbbbbb1111111111111111111111111111111111111111eeeeeeeeeeeeee1111
11111111111111111111cccccccccccccc1111111111111111111111bbbbbbbbbbbbbb1111111111111111111111111111111111111111eeeeeeeeeeeeee1111
11111111111111111111cccccccccccccc1111111111111111111111bbbbbbbbbbbbbb1111111111111111111111111111111111111111eeeeeeeeeeeeee1111
11111111111111111111cccccccccccccc1111111111111111111111bbbbbbbbbbbbbb1111111111111111111111111111111111111111eeeeeeeeeeeeee1111
1111111111111111111111cccccccccc11111111111111111111111111bbbbbbbbbb11111111111111111111111111111111111111111111eeeeeeeeee111111
1111111111111111111111cccccccccc11111111111111111111111111bbbbbbbbbb11111111111111111111111111111111111111111111eeeeeeeeee111111
111111111111111111111111cccccc111111111111111111111111111111bbbbbb111111111111111111111111111111111111111111111111eeeeee11111111
111111111111111111111111cccccc111111111111111111111111111111bbbbbb111111111111111111111111111111111111111111111111eeeeee11111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111bbbb11111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111bbbb11111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111bb111111bb11111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111bb111111bb11111111
111111aaaaaa111111111111111111111111111111111111111111111111888888111111111111111111111111111111111111111111bbbbbb1111bb11111111
111111aaaaaa111111111111111111111111111111111111111111111111888888111111111111111111111111111111111111111111bbbbbb1111bb11111111
1111aaaaaaaaaa111111111111111111111111111111111111111111118888888888111111111111111111111111111111111111111111bb111111bb11111111
1111aaaaaaaaaa111111111111111111111111111111111111111111118888888888111111111111111111111111111111111111111111bb111111bb11111111
11aaaaaaaaaaaaaa1111111111111111111111111111111111111111888888888888881111111111111111111111111111111111111111111111bbbbbb111111
11aaaaaaaaaaaaaa1111111111111111111111111111111111111111888888888888881111111111111111111111111111111111111111111111bbbbbb111111
11aaaaaaaaaaaaaa1111111111111111111111111111111111111111888888888888881111111111111111111111111111111111111111111111111111111111
11aaaaaaaaaaaaaa1111111111111111111111111111111111111111888888888888881111111111111111111111111111111111111111111111111111111111
11aaaaaaaaaaaaaa1111111111111111111111111111111111111111888888888888881111111111111111111111111111111111111111111111111111111111
11aaaaaaaaaaaaaa1111111111111111111111111111111111111111888888888888881111111111111111111111111111111111111111111111111111111111
1111aaaaaaaaaa111111111111111111111111111111111111111111118888888888111111111111111111111111111111111111111111111111111111111111
1111aaaaaaaaaa111111111111111111111111111111111111111111118888888888111111111111111111111111111111111111111111111111111111111111
111111aaaaaa11111111111111111111111111111111111111111111111188888811111111111111111111111111111111111111111111111111111111111111
111111aaaaaa11111111111111111111111111111111111111111111111188888811111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111155555555775511115555771155551111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111155555555775511115555771155551111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111155555555777777777777771155551111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111155555555777777777777771155551111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111775577777755771155551111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111775577777755771155551111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111775577777755771155551111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111775577777755771155551111111111111111111111111111111111111111111111111111
11111111111111111111111111eeee1111eeeeee1111111155555555557777777777555555551111111111111111111111111111111111111111111111111111
11111111111111111111111111eeee1111eeeeee1111111155555555557777777777555555551111111111111111111111111111111111111111111111111111
11111111111111111111ee111111ee1111ee11ee1111111155555555777777777777775555551111111111111111111111111111111111111111111111111111
11111111111111111111ee111111ee1111ee11ee1111111155555555777777777777775555551111111111111111111111111111111111111111111111111111
111111111111111111eeeeee1111ee1111ee11ee1111111155551111117777777777111155551111111111111111111111111111111111111111111111111111
111111111111111111eeeeee1111ee1111ee11ee1111111155551111117777777777111155551111111111111111111111111111111111111111111111111111
11111111111111111111ee111111ee1111ee11ee1111111155551111117711111177111155551111111111111111111111111111111111111111111111111111
11111111111111111111ee111111ee1111ee11ee1111111155551111117711111177111155551111111111111111111111111111111111111111111111111111
11111111111111111111111111eeeeee11eeeeee1111111155555555555511111111111155551111111111111111111111111111111111111111111111111111
11111111111111111111111111eeeeee11eeeeee1111111155555555555511111111111155551111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111155555555555511111111111155551111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111155555555555511111111111155551111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111199999911111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111199999911111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111119999999999111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111119999999999111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111999999999999991111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111999999999999991111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111999999999999991111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111999999999999991111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111999999999999991111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111999999999999991111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111119999999999111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111119999999999111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111199999911111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111199999911111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
111111111111111111111111111111111111111111bbbbbb111111111111dddddd111111111111111111111111111111111111111111111111aaaaaa11111111
111111111111111111111111111111111111111111bbbbbb111111111111dddddd111111111111111111111111111111111111111111111111aaaaaa11111111
1111111111111111111111111111111111111111bbbbbbbbbb11111111dddddddddd11111111111111111111111111111111111111111111aaaaaaaaaa111111
1111111111111111111111111111111111111111bbbbbbbbbb11111111dddddddddd11111111111111111111111111111111111111111111aaaaaaaaaa111111
11111111111111111111111111111111111111bbbbbbbbbbbbbb1111dddddddddddddd1111111111111111111111111111111111111111aaaaaaaaaaaaaa1111
11111111111111111111111111111111111111bbbbbbbbbbbbbb1111dddddddddddddd1111111111111111111111111111111111111111aaaaaaaaaaaaaa1111
11111111111111111111111111111111111111bbbbbbbbbbbbbb1111dddddddddddddd1111111111111111111111111111111111111111aaaaaaaaaaaaaa1111
11111111111111111111111111111111111111bbbbbbbbbbbbbb1111dddddddddddddd1111111111111111111111111111111111111111aaaaaaaaaaaaaa1111
11111111111111111111111111111111111111bbbbbbbbbbbbbb1111dddddddddddddd1111111111111111111111111111111111111111aaaaaaaaaaaaaa1111
11111111111111111111111111111111111111bbbbbbbbbbbbbb1111dddddddddddddd1111111111111111111111111111111111111111aaaaaaaaaaaaaa1111
1111111111111111111111111111111111111111bbbbbbbbbb11111111dddddddddd11111111111111111111111111111111111111111111aaaaaaaaaa111111
1111111111111111111111111111111111111111bbbbbbbbbb11111111dddddddddd11111111111111111111111111111111111111111111aaaaaaaaaa111111
111111111111111111111111111111111111111111bbbbbb111111111111dddddd111111111111111111111111111111111111111111111111aaaaaa11111111
111111111111111111111111111111111111111111bbbbbb111111111111dddddd111111111111111111111111111111111111111111111111aaaaaa11111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
111111111111111111111111111111111111111111111111111111111111ffffff11111111111111111111111111111111111111111111111111111111111111
111111111111111111111111111111111111111111111111111111111111ffffff11111111111111111111111111111111111111111111111111111111111111
1111111111111111111111111111111111111111111111111111111111ffffffffff111111111111111111111111111111111111111111111111111111111111
1111111111111111111111111111111111111111111111111111111111ffffffffff111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111ffffffffffffff1111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111ffffffffffffff1111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111ffffffffffffff1111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111ffffffffffffff1111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111ffffffffffffff1111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111ffffffffffffff1111111111111111111111111111111111111111111111111111111111
0111111111111111111111111111111111111111111111111111111111ffffffffff111111111111111111111111111111111111111111111111111111111110
0011111111111111111111111111111111111111111111111111111111ffffffffff111111111111111111111111111111111111111111111111111111111100
000111111111111111111111111111111111111111111111111111111111ffffff11111111111111111111111111111111111111111111111111111111111000
000011111111111111111111111111111111111111111111111111111111ffffff11111111111111111111111111111111111111111111111111111111110000
00000111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000
00000011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000
00000001111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111110000000
00000000011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000000