forked from stevelavietes/pico8carts
-
Notifications
You must be signed in to change notification settings - Fork 3
/
flock_test.p8
1188 lines (1100 loc) · 48.5 KB
/
flock_test.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
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
pico-8 cartridge // http://www.pico-8.com
version 8
__lua__
st_menu=0
st_play=1
st_score=2
g_state=st_menu
function _init()
stdinit()
g_state=st_menu
add(
g_objs,
make_menu(
{
'go'
},
function (t, i, s)
add (
s,
make_trans(
function()
game_start()
end
)
)
end
)
)
end
function add_wobbler(x,y)
local blp = {
x=x,
y=y,
spd_x=0,
spd_y=0,
r=4,
solid=true,
state=en_charge,
charge=rnd(15),
updown=1,
update=function(t)
if t.state == en_charge then
t.charge += 1
if t.charge >= 15 then
t.state = en_attack
t.updown=-1*t.updown
t.charge=0
local dx=t.x-g_tgt.x
local dy=t.y-g_tgt.y
local nd=norm(dx,dy)
if mag(dx,dy) > 20 then
t.spd_x=-nd[1]-t.updown*nd[2]
t.spd_y=-nd[2]+t.updown*nd[1]
t.spd_x*=1
t.spd_y*=1
else
t.spd_x=-2*nd[1]
t.spd_y=-2*nd[2]
end
end
elseif t.state == en_attack then
t.charge += 1
--t.spd_x=
if t.charge >= 8 then
t.state = en_charge
t.charge = 0
t.spd_x=0
t.spd_y=0
end
end
t.x += t.spd_x
t.y += t.spd_y
end,
draw=function(t)
circfill(0,0,t.r,12)
local dx=t.x-g_tgt.x
local dy=t.y-g_tgt.y
local nd=norm(dx,dy)
local sox=nd[2]
local soy=-nd[1]
circfill(-sox,soy,t.r-1,1)
circfill(-2*sox,2*soy,t.r-2,0)
--[[
line(0,0,-30*nd[1],-30*nd[2],8)
line(0,0,-10*nd[1]-10*nd[2],-10*nd[2]+10*nd[1],9)
]]--
end
}
add(
g_objs,
blp
)
return blp
end
function add_blip(x,y)
local blp = make_blip(x,y)
add(
g_objs,
blp
)
return blp
end
function make_border()
return {
x=0,
y=0,
draw=function(t)
rect(0,0,127,127,7)
end
}
end
function make_enemy_spawner()
return {
x=0,
y=0,
frame=0,
blips=1,
update=function(t)
t.frame += 1
t.frame = t.frame%90
if t.frame == 0 then
t.blips+=1
-- spawn enemies in opposite
-- quadrant
local qx=abs(flr(g_tgt.x/64)-1)
local qy=abs(flr(g_tgt.y/64)-1)
for i=1,t.blips do
local dist=0
local cx=0
local cy=0
while dist < 30 do
cx=(qx*64+rnd(64))
cy=(qy*64+rnd(64))
dist=mag(cx-g_tgt.x,cy-g_tgt.y)
end
if rnd(1) < 0.5 then
add_blip(cx,cy)
else
add_wobbler(cx,cy)
end
end
end
end
}
end
num_blips=10
blips=false
g_score=0
function game_start()
g_state = st_play
g_score = 0
srand(5)
g_objs = {}
if blips then
for _=1,num_blips do
--add_blip(rnd(128), rnd(128))
add_wobbler(rnd(128), rnd(128))
end
end
g_b = add_wobbler(12, 64)
local tgt = make_target(100, 64)
add(
g_objs,
tgt
)
add(g_objs, make_enemy_spawner())
g_tgt = tgt
add(g_objs, make_border())
end
function mag(x,y)
return sqrt(x*x+y*y)
end
function norm(x,y)
imag = mag(x,y)
return {x/imag, y/imag}
end
pl_normal=0
pl_dash=1
function make_target(x,y)
return {
x=x,
y=y,
r=4,
c=11,
state=pl_normal,
charge=0,
avoid=false,
spd={0,0},
lastd={1,1},
solid=true,
update=function(t)
local m_x=0
local m_y=0
--todo add control
if btn(0, 0) then
m_x =-1
end
if btn(1, 0 ) then
m_x = 1
end
if btn(2, 0) then
m_y = -1
end
if btn(3, 0) then
m_y = 1
end
if m_x != 0 or m_y != 0 then
t.lastd = {m_x, m_y}
else
m_x = t.lastd[1]
m_y = t.lastd[2]
end
if (
btn(5, 0) and
t.state == pl_normal
) then
t.spd={7*m_x, 7*m_y}
t.charge=25
t.state = pl_dash
end
if t.state == pl_dash then
t.charge -= 1
t.c = 14
if t.charge <= 0 then
t.state = pl_normal
end
else
t.c = 11
end
local pos={
t.x+t.spd[1],
t.y+t.spd[2]
}
local pos,spd=collides(
pos,
t.spd,
t.r
)
t.x = pos[1]
t.y = pos[2]
t.spd = {0.9*spd[1],0.9*spd[2]}
end,
draw=function(t)
if t.state == pl_dash then
circfill(0,0,t.r, t.c)
else
circ(0,0,t.r, t.c)
end
end
}
end
blip_accel = 1
b_max_spd = 1
function mag(x,y)
return sqrt(x*x+y*y)
end
function normd(x,y)
local vmag = mag(x,y)
return x/vmag, y/vmag
end
function isc_ln_crc(fst,ax,ay,snd)
local axh=ax/2
local ayh=ay/2
if mag(
fst.x+ax-snd.x,
fst.y+ay-snd.y
) < snd.r or mag(
fst.x+axh-snd.x,
fst.y+ayh-snd.y
) < snd.r then
return true
end
return false
end
function dot(ax,ay,bx,by)
return (ax*bx+ay*by)
end
en_chase=0
en_chargeup=1
en_attack=2
function swap(vec)
return {vec[2], vec[1]}
end
function collides(pos, spd, r)
for dim=1,2 do
if (
pos[dim] > 127-r
or pos[dim] < r+1
) then
spd[dim] = -spd[dim]
end
pos[dim]=max(0,min(pos[dim],127))
end
return pos, spd
end
function overlap(o1, o2)
if not o1.solid or not o2.solid then
return false
end
return mag(o2.x-o1.x,o2.y-o1.y) < o1.r + o2.r
end
function make_explode(x,y,f)
return {
x=x,
y=y,
frame=0,
r=1,
solid=false,
f=f,
update=function(t)
t.frame+=1
t.r+=1
if t.frame > 30 then
del(g_objs,t)
if t.f then
t.f(t)
end
end
end,
draw=function(t)
circ(0,0,t.r,9)
circ(0,0,t.r-1,9)
coord=function()
return rnd(16) - 8
end
circ(
coord(),
coord(),
coord(),
9+flr(rnd(2))
)
end
}
end
function make_blip(x,y)
return {
x=x,
y=y,
r=4,
c=8,
spd_x=0,
spd_y=0,
a_x=0,
a_y=0,
ah_x=0,
ah_y=0,
av_x=0,
av_y=0,
d_x=0,
d_y=0,
avoid=true,
state=0,
charge=0,
solid=true,
update=function(t)
-- move towards target
local d_x = g_tgt.x - t.x
local d_y = g_tgt.y - t.y
local nd_x, nd_y = normd(d_x, d_y)
-- state machine
if t.state == en_chargeup then
t.c = 9
if t.charge > 90 then
t.state = en_attack
t.spd_x = 7*nd_x
t.spd_y = 7*nd_y
end
t.charge += 3
end
if t.state == en_chase then
local d=mag(d_x, d_y)
if d<18 then
t.state = en_chargeup
t.charge=0
end
t.c = 8
end
if t.state == en_attack then
t.c = 10
t.charge -= 1
if t.charge == 0 then
t.state = en_chase
t.spd_x = 0
t.spd_y = 0
end
end
t.d_x = d_x
t.d_y = d_y
t.d_x = 10*nd_x
t.d_y = 10*nd_y
local ns_x, ns_y = 0
if t.spd_x != 0 and t.spd_y != 0 then
ns_x, ns_y = normd(t.spd_x, t.spd_y)
end
local a_x = 20*nd_x
local a_y = 20*nd_y
local av_x=0
local av_y=0
t.a_x = a_x
t.a_y = a_y
for _,o in pairs(g_objs) do
if false and o.avoid then
if isc_ln_crc(t,a_x,a_y,o) then
--pause = true
-- -t.x,y
av_x = a_x - o.x
av_y = a_y - o.y
av_x, av_y = normd(av_x,av_y)
av_x*=blip_accel
av_y*=blip_accel
end
end
end
t.spd_x += av_x
t.spd_y += av_y
t.av_x = av_x
t.av_y = av_y
if t.state == en_chase then
t.spd_x += nd_x * blip_accel
t.spd_y += nd_y * blip_accel
t.spd_x = max(
- b_max_spd,
min(
b_max_spd,
t.spd_x
)
)
t.spd_y = max(
- b_max_spd,
min(
b_max_spd,
t.spd_y
)
)
end
t.spd_x *= 0.9
t.spd_y *= 0.9
local n_x = t.x + t.spd_x
local n_y = t.y + t.spd_y
local npos, nspd = collides(
{n_x, n_y},
{t.spd_x, t.spd_y} ,
t.r
)
t.x = npos[1]
t.y = npos[2]
t.spd_x = nspd[1]
t.spd_y = nspd[2]
end,
draw=function(t)
circ(0,0,t.r,t.c)
--[[
line(0,0,t.d_x, t.d_y,t.c)
line(0,0,t.a_x, t.a_y,10)
line(0,0,t.av_x, t.av_y,12)
line(0,0,t.spd_x, t.spd_y,7)
]]--
end
}
end
function make_message(txt,x,y,c)
return {
x=x,
y=y,
txt=txt,
c=c,
draw=function(t)
print(
t.txt,
4*(-#t.txt)/2,
t.y,
t.c
)
end
}
end
function game_over()
g_state = st_score
g_objs = {}
add(
g_objs,
make_message(
"you died",
64,
10,
8
)
)
add(
g_objs,
make_message(
"score: "..g_score,
64,
20,
8
)
)
add(
g_objs,
make_menu(
{
"play again",
},
function (t, i, s)
add (
s,
make_trans(
function()
game_start()
end
)
)
end
)
)
end
function explode(t, func)
add(
g_objs,
make_explode(t.x, t.y, func)
)
del(g_objs, t)
end
pause_down = false
pause = false
function _update60()
if false and btn(4) then
pause_down = true
elseif pause_down then
pause_down = false
pause = not pause
end
if not pause then
stdupdate()
end
for _,e in pairs(g_objs) do
if g_tgt and e != g_tgt then
if e.r and overlap(g_tgt, e) then
if g_tgt.state == pl_dash then
explode(e)
g_score += 1
else
explode(
g_tgt,
function()
add(
g_objs,
make_trans(game_over)
)
end
)
end
end
end
end
end
function _draw()
stddraw()
if g_b and g_state==st_play then
color(11)
local dx = g_b.x - g_tgt.x
local dy = g_b.y - g_tgt.y
local d = mag(dx, dy)
print("d: "..d)
local state="chase"
if g_tgt.state == en_chargeup then
state="charge"
elseif g_b.state == en_attack then
state="attack"
end
print("e: "..state)
print(
"e.s: "..
g_b.spd_x..
" "..
g_b.spd_y
)
state = "normal"
if g_tgt.state == pl_dash then
state = "dash"
end
print("p: "..state)
print(
"p.s: "..
g_tgt.spd[1]..
" "..
g_tgt.spd[2]
)
print("p.c: "..g_tgt.charge)
end
color(7)
print("perf: "..stat(1))
end
------------------------------
function stdinit()
g_tick=0 --time
g_ct=0 --controllers
g_ctl=0 --last controllers
g_cs = {} --camera stack
g_objs = {} --objects
end
function stdupdate()
g_tick = max(0,g_tick+1)
-- current/last controller
g_ctl = g_ct
g_ct = btn()
updateobjs(g_objs)
end
function updateobjs(objs)
foreach(objs, function(t)
if t.update then
t:update(objs)
end
end)
end
function stddraw()
cls()
drawobjs(g_objs)
end
function drawobjs(objs)
foreach(objs, function(t)
if t.draw then
pushc(-t.x,-t.y)
t:draw(objs)
popc()
end
end)
end
--returns state,changed
function btns(i,p)
i=shl(1,i)
if p==1 then
i=shl(i,8)
end
local c,cng =
band(i,g_ct),
band(i,g_ctl)
return c>0,c~=cng
end
--returns new press only
function btnn(i,p)
if p==-1 then --either
return btnn(i,0) or btnn(i,1)
end
local pr,chg=btns(i,p)
return pr and chg
end
function getspraddr(n)
return flr(n/16)*512+(n%16)*4
end
function sprcpy(dst,src,w,h)
w = w or 1
h = h or 1
for i=0,h*8-1 do
memcpy(getspraddr(dst)+64*i,
getspraddr(src)+64*i,4*w)
end
end
function pushc(x, y)
local l=g_cs[#g_cs] or {0,0}
local n={l[1]+x,l[2]+y}
add(g_cs, n)
camera(n[1], n[2])
end
function popc()
local len = #g_cs
g_cs[len] = nil
len -= 1
if len > 0 then
local xy=g_cs[len]
camera(xy[1],xy[2])
else
camera()
end
end
function make_menu(
lbs, --menu lables
fnc, --chosen callback
x,y, --pos
omb, --omit backdrop
p, --player
cfnc --cancel callback
)
local m={
--lbs=lbs,
--f=fnc,
--fc=cfnc,
i=0, --item
s=g_tick,
e=5,
x=x or 64,
y=y or 80,
h=10*#lbs+4,
--omb=omb,
tw=0,--text width
p=p or -1,
draw=function(t)
local e=elapsed(t.s)
local w=t.tw*4+10
local x=min(1,e/t.e)*(w+9)/2
if not omb then
rectfill(-x,0,x,t.h,0)
rect(-x,0,x,t.h,1)
end
if e<t.e then
return
end
x=w/2+1
for i,l in pairs(lbs) do
if not t.off or i==t.i+1 then
local y=4+(i-1)*10
print(l,-x+9,y+1,0)
print(l,-x+9,y,7)
end
end
spr(0,-x,2+10*t.i)
end,
update=function(t,s)
if (t.off) return
if elapsed(t.s)<(t.e*2) then
return
end
if btnn(5,t.p) then
if fnc then
fnc(t,t.i,s)
--sfx(2)
end
end
--cancel
if btnn(4,t.p) then
if cfnc then
cfnc(t,s)
--sfx(2)
end
end
if btnn(2,t.p) and
t.i>0 then
t.i-=1
sfx(1)
end
if btnn(3,t.p) and
t.i<(#lbs-1) then
t.i+=1
sfx(1)
end
end
}
for l in all(lbs) do
m.tw=max(m.tw,#l)
end
return m
end
function elapsed(t)
if g_tick>=t then
return g_tick - t
end
return 32767-t+g_tick
end
function trans(s)
if (s<1) return
s=2^s
local b,m,o =
0x6000,
15,
s/2-1+(32*s)
for y=0,128-s,s do
for x=0,128-s,s do
local a=b+x/2
local c=band(peek(a+o),m)
c=bor(c,shl(c,4))
for i=1,s do
memset(a,c,s/2)
a+=64
end
end
b+=s*64
end
end
function make_trans(f,d,i)
return {
d=d,
e=g_tick,
f=f,
i=i,
x=0,
y=0,
update=function(t,s)
if elapsed(t.e)>10 then
if (t.f) t:f(s)
del(s,t)
if not t.i then
add(s,
make_trans(nil,nil,1))
end
end
end,
draw=function(t)
local x=flr(elapsed(t.e)/2)
if t.i then
x=5-x
end
trans(x)
end
}
end
__gfx__
00600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00660000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00666000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00666600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00666500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00665000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00650000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000