-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrogue.p8
1015 lines (935 loc) · 33.6 KB
/
rogue.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 16
__lua__
--init
function _init()
--poke(0x5f2d,1)
draw=title_draw
update=title_update
dirs={
{-1,0},
{1,0},
{0,0},
{0,-1},
{-1,-1},
{1,-1},
{0,0},
{0,1},
{-1,1},
{1,1},
{0,0},
{0,0},
{0,0},
{0,0},
{0,0},
[0x20]={0,0},
}
setmetatable(dirs,dirs)
w,h=8,6
f=0
end
function init_game()
t=0
level=0
name=nil
gold=0
radio=0
log={}
seed=rnd(-1)
srand(seed)
player=mob:new{
name="you",
c="웃",
col=7,
hp=5,
str=1,
arm=1,
move=function(self,move)
local nx,ny=self.x+dirs[move][1],self.y+dirs[move][2]
if iswalkable(nx,ny,self,"corridor") then
local mve=true
for m in all(mobs) do
if m!=player and m.x==nx and m.y==ny then
mve=false
attack(self,m)
break
end
end
if (mve) self.x,self.y=nx,ny
if (coords_to_room(nx,ny)==dungeon.goal and dungeon.map[nx][ny]==3) init_level()
for b in all(balls) do
if b.x==nx and b.y==ny then
heal()
del(balls,b)
break
end
end
else
return false
end
return true
end
}
amnesia=false
limp=false
blind=false
init_level()
end
function init_level()
level+=1
if level==7 then
update=ending_update
draw=ending_draw
end
add(log,"you enter level "..level.." of the tomb")
add(log,"the walls emanate radioactivity")
mobs={}
add(mobs,player)
generate_dungeon=gendun_rogue
local s=25*ceil((level/2))+5*level+1
dungeon=generate_dungeon(s,s,level*2+1,level*2+1)
fogmap=generate_fogmap(dungeon.map)
--generate dummy mobs
for _=1,ceil(#dungeon.grid*3+flr(rnd(5))) do
local x,y
repeat
x,y=ceil(rnd(dungeon._width)),ceil(rnd(dungeon._height))
until dungeon.map[x][y]==0 and coords_to_room(x,y)!=dungeon.start
r=flr(rnd(14-level))+1
local m
if (r==1) m=tomb_bot
if (r==2) m=level>=5 and eye or tomb_bot
if (r==3) m=level>=5 and vampire or tomb_bot
if (r==4 or r==5 or r==6 or r==7) m=bat
if (r==8 or r==9 or r==10 or r==11 or r==12 or r==13) m=base_mob
add(mobs,m:new{x=x,y=y})
end
--generate dummy balls
balls={}
for _=1,ceil(#dungeon.grid*1.5+flr(rnd(5))) do
local x,y
repeat
x,y=ceil(rnd(dungeon._width)),ceil(rnd(dungeon._height))
until dungeon.map[x][y]==0
add(balls,{x=x,y=y})
end
cam={x=-player.x*w+64,y=-player.y*h+60}
end
-->8
--generate dungeon
function gendun_rogue(w, h, gw, gh)
-- https://web.archive.org/web/20130510010345/http://kuoi.com/~kamikaze/gamedesign/art07_rogue_dungeon.php
local map={}
local grid={}
local rooms={}
local unconnected={}
function connect_rooms(r1,r2)
add(r1.connected_neighbors,r2)
add(r2.connected_neighbors,r1)
r1.connected=true
r2.connected=true
del(unconnected,r1)
del(unconnected,r2)
end
for x=1,w do
local col=add(map,{})
for y=1,h do
add(col,1)
end
end
--1 2
for y=1,gh do
local col=add(grid,{})
for x=1,gw do
local room=add(col,{connected=false,neighbors={},connected_neighbors={},gx=x,gy=y})
add(rooms,room)
add(unconnected,room)
end
end
for y=1,gh do
for x=1,gw do
local room=grid[y][x]
for i in all(four) do
local ny=y+i[2]
local nx=x+i[1]
if ny>0 and ny<=gh and nx>0 and nx<=gw then
add(room.neighbors,grid[ny][nx])
end
end
room.neighbors=shuffle(room.neighbors)
end
end
--3
local room=rooms[ceil(rnd(#rooms))]
room.connected=true
del(unconnected,room)
local start=room
--4
::continue::
for n in all(room.neighbors) do
if not n.connected then
connect_rooms(room,n)
room=n
goto continue
end
end
--5
local goal
-- this is not very efficient
while #unconnected>0 do
for room in all(unconnected) do
for n in all(room.neighbors) do
if n.connected then
connect_rooms(room,n)
break
end
end
end
end
goal=room
--6
assert(#unconnected==0)
for room in all(rooms) do
assert(room.connected)
end
--7
for _=0,flr(rnd(gw)) do
local room=rooms[ceil(rnd(#rooms))]
for n in all(room.neighbors) do
for n2 in all(room.connected_neighbors) do
if n==n2 then
goto next_room
end
end
connect_rooms(room,n)
break
::next_room::
end
end
--8 carve
for y=1,gh do
for x=1,gw do
local room=grid[y][x]
local r=flr(rnd(3))
room.start_y=(y-1)*flr(h/gh)+2+r
room.end_y=y*flr(h/gh)-r
room.start_x=(x-1)*flr(w/gw)+2+r
room.end_x=x*flr(w/gw)-r
for yy=room.start_y,room.end_y do
for xx=room.start_x,room.end_x do
map[xx][yy]=0
end
end
end
end
-- carve corridors
for y=1,gh do
for x=1,gw do
local room=grid[y][x]
for n in all(room.connected_neighbors) do
local start={x=room.start_x+flr((room.end_x-room.start_x)/2),y=room.start_y+flr((room.end_y-room.start_y)/2)}
local goal={x=n.start_x+flr((n.end_x-n.start_x)/2),y=n.start_y+flr((n.end_y-n.start_y)/2)}
local dir_x=sgn(goal.x-start.x)
local dir_y=sgn(goal.y-start.y)
-- change to pathfinding
for xx=start.x,goal.x,dir_x do
for yy=start.y,goal.y,dir_y do
if (map[xx][yy]==1) map[xx][yy]=2
end
end
end
end
end
--9 doors
--10 stairs
assert(start!=goal)
do
local x=flr(rnd(start.end_x-start.start_x)+start.start_x)+1
local y=flr(rnd(start.end_y-start.start_y)+start.start_y)+1
map[x][y]=3
player.x=x
player.y=y
end
do
local x,y
::place_stairs::
x=flr(rnd(goal.end_x-goal.start_x)+goal.start_x)+1
y=flr(rnd(goal.end_y-goal.start_y)+goal.start_y)+1
for dir in all(eight) do --four?
local nx=x+dir[1]
local ny=y+dir[2]
if (map[nx][ny]==2) goto place_stairs
end
map[x][y]=3
end
local dungeon={}
dungeon._width=w
dungeon._height=h
dungeon.map=map
dungeon.grid=grid
dungeon.rooms=rooms
--dungeon._doors={}
dungeon.start=start
dungeon.goal=goal
return dungeon
end
function generate_fogmap(map)
local fogmap={}
for x=1,#map do
add(fogmap,{})
for y=1,#map[1] do
add(fogmap[i],0)
end
end
return fogmap
end
function coords_to_room(x,y)
for room in all(dungeon.rooms) do
if x>=room.start_x and x<=room.end_x and y>=room.start_y and y<=room.end_y then
return room
end
end
end
function unfogroom(room)
if dungeon.map[player.x][player.y]==2 then
for dir in all(dirs) do --eight or four?
local x,y=player.x+dir[1],player.y+dir[2]
if dungeon.map[x][y]==2 or dungeon.map[x][y]==0 then
fogmap[x][y]=1
end
end
return
end
if blind then
for dir in all(dirs) do --eight or four?
local x,y=player.x+dir[1],player.y+dir[2]
fogmap[x][y]=1
end
return
end
for x=room.start_x-1,room.end_x+1 do
for y=room.start_y-1,room.end_y+1 do
fogmap[x][y]=1
end
end
end
function fogdungeon()
for x=1,#dungeon.map do
for y=1,#dungeon.map[1] do
if amnesia then
fogmap[x][y]=0
elseif fogmap[x][y]==1 then
fogmap[x][y]=2
end
end
end
end
-->8
--update
function _update()
f+=1
update()
end
function title_update()
if f>=30 then
if btnp(❎) and not name then
init_game()
update=game_update
draw=game_draw
end
end
end
function game_update()
local move=btnp()
if move==0x10 then
update=log_update
draw=log_draw
return
elseif move>0 and move<15 or move==0x20 then
if not player:move(move) and move!=0x20 then
return
end
t+=1
radio+=max(0.1,rnd(1)-rnd(level/10))
for _=1,limp and 2 or 1 do
for m in all(mobs) do
if (m!=player) m:move()
end
end
local ailments={
function()
if not limp then
limp=true
add(log,"you start to limp")
end
end,
function()
if not blind then
blind=true
add(log,"your eyesight worsens")
end
end,
function()
if not amnesia then
amnesia=true
add(log,"you feel forgetful")
end
end,
function()
player.str=max(0,player.str-1)
add(log,"your muscles are fatigued")
end,
function()
player.arm=max(0,player.arm-1)
add(log,"your skin sloughs off")
end,
function()
player.hp-=1
add(log,"you bleed from an orifice")
if player.hp==0 then
cause="radioactivity"
update=game_over_update
draw=game_over_draw
end
end
}
if radio==128 or (radio>=128 and flr(rnd(30))==0) then
ailments[ceil(rnd(#ailments))]()
end
end
--scroll
if (player.x+cam.x/w>13) cam.x-=w
if (player.x+cam.x/w<2) cam.x+=w
if (player.y+cam.y/h>16) cam.y-=h
if (player.y+cam.y/h<3) cam.y+=h
end
function log_update()
local b=btnp()
if b>0 then
update=game_update
draw=game_draw
end
end
function game_over_update()
if btnp(5) then
update=title_update
draw=title_draw
end
end
function ending_update()
ending_f=ending_f and ending_f+0.5 or 0
if btnp(5) then
update=title_update
draw=title_draw
end
end
function heal()
radio=0
blind=false
limp=false
amnesia=false
local r=flr(rnd(20))
if r==0 then
player.max_hp+=1
add(log,"you feel healthier")
elseif r==1 then
player.max_str+=1
add(log,"you feel stronger")
elseif r==2 then
player.max_arm+=1
add(log,"you feel hardier")
end
player.hp=player.max_hp
player.str=player.max_str
player.arm=player.max_arm
add(log,"you're no longer in any pain")
end
-->8
--draw
function _draw()
draw()
--print(sub(tostr(seed,true),3),0,0,3)
end
function title_draw()
cls()
for i=0,min(f/10,3) do
print("pico-@",64-(6*4)/2-4+i,i,8)
end
if f>=30 then
print("pico-@",64-(6*4)/2,3,10)
print("☉☉",30,20,11)
print("☉☉",20,40,11)
print("☉☉",40,35,11)
print("∧ ∧",70,20,10)
print([[ _
| |
/___\]],67,26,12)
print("◆",77,25,8)
print("웃",77,32,7)
print("⬅️➡️⬆️⬇️: move",20,80,7)
print("❎/x: wait",20,86,7)
print("🅾️/z: log",20,92,7)
print("♥: hp",15,104,8)
print("★: strength",15,110,10)
print("▒: armor",15,116,6)
print("●: energy ball",68,104,12)
print("▤: stairs",68,110,6)
end
if f>=30 and sin(f/30)>0 then
print("press ❎",64-(8*4)/2,64,5)
elseif name then
center("name:",64,5)
print(name.."_",25,72,7)
end
end
function game_draw()
cls()
fogdungeon()
unfogroom(coords_to_room(player.x,player.y))
for x=1,dungeon._width do
for y=1,dungeon._height do
local c=6
if fogmap[x][y]==2 then
c=5
end
if fogmap[x][y]==1 or fogmap[x][y]==2 then
local parts={"█","▒","▤"}
local part=parts[dungeon.map[x][y]]
if part then
print(part,x*w+cam.x,y*h+cam.y,c)
else
if (fogmap[x][y]==1) print(".",x*w+cam.x+2,y*h+cam.y-2,5)
end
end
end
end
for b in all(balls) do
if fogmap[b.x][b.y]==1 then
print("●",b.x*w+cam.x,b.y*h+cam.y,12)
end
end
local bats={}
for m in all(mobs) do
if fogmap[m.x][m.y]==1 then
if m.name!="bat" then
rectfill(m.x*w-1+cam.x,m.y*h-1+cam.y,m.x*w-1+w+cam.x,m.y*h-1+h+cam.y,m.bg)
print(m.c,m.x*w+cam.x,m.y*h+cam.y,m.col)
else
add(bats,m)
end
end
end
for m in all(bats) do
print(m.c,m.x*w+cam.x,m.y*h+cam.y,m.col)
end
drawlog()
drawhud()
--print(stat(1),0,0)
end
function log_draw()
cls()
for l in all(log) do
print(l)
end
end
function drawlog()
rectfill(0,0,128,h*2-1,0)
print(#log>1 and log[#log-1] or "",0,0,7)
print(#log>0 and log[#log] or "",0,h,7)
end
function drawhud()
local x,y=0,128-h
rectfill(x,y-2,radio,y-2,11)
rectfill(radio+1,y-2,128,y-2,0)
rectfill(x,y-1,128,128,0)
local hud={
{"l"..level,7},
{"♥"..player.hp.."/"..player.max_hp,8},
{"★"..player.str.."/"..player.max_str,10},
--{"★"..gold,10},
{"▒"..player.arm.."/"..player.max_arm,6}
}
for h in all(hud) do
print(h[1],x,y,h[2])
x+=#h[1]*4+8
end
local t_hud="⧗"..t
print(t_hud,128-#t_hud*4-4,128-h,7)
end
function game_over_draw()
cls()
local s="you were killed by "..cause
print(s,64-(#s*4)/2,60,8)
print("press ❎",64-(8*4)/2,68,5)
end
function ending_draw()
cls()
color(11)
print("greetings, pierrot.")
print("i am ernie york.")
print("welcome to the depths")
print("of vinnie's tomb.")
print("웃",ending_f and min(50,ending_f) or 0,80,7)
print("웃",78,80,11)
print("the end",64-(7*4)/2,100,10)
print("to be continued 7drl 2020",64-(25*4)/2,107,10)
end
-->8
--tools
function iswalkable(x,y,mob,check)
if y<1 or y>#dungeon.map or x<1 or x>#dungeon.map[1] then
return false
end
if mob!=player and (not mob or mob.name!="bat") then
for m in all(mobs) do
if m!=player and x==m.x and y==m.y then
return false
end
end
end
if dungeon.map[x][y]==0 or dungeon.map[x][y]==3 then
return true
elseif check=="corridor" and dungeon.map[x][y]==2 then
return true
else
return false
end
end
function dijkstra(fx,fy,tx,ty,mob)
local dmap={}
local unvisited={}
local t
local room=coords_to_room(fx,fy)
if (not room) return nil
if (room!=coords_to_room(tx,ty)) return nil
for x=room.start_x,room.end_x do
for y=room.start_y,room.end_y do
dmap[x..","..y]=add(unvisited,{x=x,y=y,value=99,visited=false})
end
end
t=dmap[fx..","..fy]
t.value=0
while not dmap[tx..","..ty].visited do
if (#unvisited==0) return nil
for dir in all(four) do --eight?
local nx=t.x+dir[1]
local ny=t.y+dir[2]
if iswalkable(nx,ny,mob,"corridor") and nx>=room.start_x and nx<=room.end_x and ny>=room.start_y and ny<=room.end_y then
local n=dmap[nx..","..ny]
n.value=min(t.value+1,n.value)
end
end
t.visited=true
del(unvisited,t)
local minimum=99
for n in all(unvisited) do
if n.value<minimum then
t=n
minimum=n.value
end
end
if (minimum==99) break
end
return dmap
end
function getrandomint(min, max)
min=min and min or 0
max=max and max or 1
return flr(rnd(max))+min
end
function shuffle(t)
for n=1,#t*2 do -- #t*2 times seems enough
local a,b=flr(1+rnd(#t)),flr(1+rnd(#t))
t[a],t[b]=t[b],t[a]
end
return t
end
four={
{ 0,-1},
{ 1, 0},
{ 0, 1},
{-1, 0}
}
eight={
{ 0,-1},
{ 1,-1},
{ 1, 0},
{ 1, 1},
{ 0, 1},
{-1, 1},
{-1, 0},
{-1,-1}
}
function center(str,y,c)
if (c) color(c)
print(str,64-#str/2,y)
if (c) color()
end
function contains(t,e)
for i in all(t) do
if i==e then
return true
end
end
return false
end
function round(x)
if x%2 ~= 0.5 then
return flr(x+0.5)
end
return x-0.5
end
-->8
-- mob
mob={
c="",
col=8,
bg=0,
hp=0,
move=function(self)
local dmap=dijkstra(player.x,player.y,self.x,self.y,self)
if (not dmap) return
local minimum=99
local cells={}
for dir in all(four) do
local nx,ny=self.x+dir[1],self.y+dir[2]
local n=dmap[nx..","..ny]
if n and n.value<minimum then
cells={n}
minimum=n.value
elseif n and n.value==minimum then
add(cells,n)
end
end
local n=shuffle(cells)[#cells]
if n then
if n.value==0 then
attack(self,player)
else
self.x,self.y=n.x,n.y
end
end
end,
new=function(self,o)
self.__index=self
o.max_hp=o.hp
o.max_str=o.str
o.max_arm=o.arm
return setmetatable(o or {},self)
end
}
base_mob=mob:new({
name="monster",
c="😐",
hp=1,
str=1,
arm=1
})
tomb_bot=base_mob:new({
name="tomb bot",
col=7,
bg=8,
hp=3,
str=1,
arm=1,
})
electricity=base_mob:new({
name="explosion",
c="∧",
col=10,
hp=999,
str=2,
arm=999,
explode=false,
move=function(self)
if (not self.explode) self.explode=true return
for dir in all(eight) do
local nx,ny=self.x+dir[1],self.y+dir[2]
for m in all(mobs) do
if m.x==nx and m.y==ny then
attack(self,m)
end
end
end
del(mobs,self)
end
})
eye=mob:new({
name="eye",
c="☉",
col=8,
hp=3,
str=3,
arm=2,
})
vampire=mob:new({
c="🐱",
name="vampire",
col=8,
hp=5,
str=2,
arm=2,
})
bat=mob:new({
c="ˇ",
name="bat",
col=8,
hp=1,
str=1,
arm=3,
})
function attack(attacker,defender)
if (attacker==defender) return
if (defender.name=="explosion") return
local dmg=max(0,flr(rnd(attacker.str+1))-flr(rnd(defender.arm+1)))
defender.hp-=dmg
add(log,attacker.name.." hit "..defender.name.." for "..dmg.." damage")
if defender.hp<=0 then
if defender==player then
cause=attacker.name
update=game_over_update
draw=game_over_draw
elseif defender.name=="tomb bot" then
add(mobs,electricity:new{x=defender.x,y=defender.y})
end
add(log,defender.name .. (defender.name=="tomb bot" and " exploded" or " died"))
del(mobs,defender)
end
end
__label__
00000000000000000000000000000000000000000000000088808880088008800000080000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000088880888808880880000808000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000088888888880888888880888800000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000008888aaa8aaa08aa88aa888888a000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000008888a8a88a88a888a8a88888a8a00000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000888aaa88a88a888a8a8aaa8a8a00000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000088a0888a08a088a8a00008a0000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000008a008aaa08aa8aa0000008aa00000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000bbb00000bbb0000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000bb0bb000bb0bb00000000000000000000000000a000a0000000a000a00000000000000000000000000000000000000000
000000000000000000000000000000bbb0bbb0bbb0bbb00000000000000000000000000a0a0a0000000a0a0a0000000000000000000000000000000000000000
0000000000000000000000000000000bb0bb000bb0bb0000000000000000000000000000a000a0000000a000a000000000000000000000000000000000000000
00000000000000000000000000000000bbb00000bbb0000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000008880000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000088888000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000008880000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000ccc0000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000c0077700c0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000c0077700c0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000c0777770c0000000000000000000000000000000000000000000
000000000000000000000000000000000000000000bbb00000bbb00000000000000000000000c0077700c0000000000000000000000000000000000000000000
00000000000000000000000000000000000000000bb0bb000bb0bb0000000000000000000000c0070700c0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000bbb0bbb0bbb0bbb0000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000bb0bb000bb0bb0000000000000000000c0000000000000c0000000000000000000000000000000000000000
000000000000000000000000000000000000000000bbb00000bbb0000000000000000000c000000000000000c000000000000000000000000000000000000000
0000000000000000000000bbb00000bbb000000000000000000000000000000000000000c000000000000000c000000000000000000000000000000000000000
000000000000000000000bb0bb000bb0bb00000000000000000000000000000000000000c000000000000000c000000000000000000000000000000000000000
00000000000000000000bbb0bbb0bbb0bbb000000000000000000000000000000000000c000ccc0ccc0ccc000c00000000000000000000000000000000000000
000000000000000000000bb0bb000bb0bb0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000bbb00000bbb00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
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
00000000000000000000077777000777770007777700077777000000000077700770707077700000000000000000000000000000000000000000000000000000
00000000000000000000777007707700777077707770770007700700000077707070707070000000000000000000000000000000000000000000000000000000
00000000000000000000770007707700077077000770770007700000000070707070707077000000000000000000000000000000000000000000000000000000
00000000000000000000777007707700777077000770777077700700000070707070777070000000000000000000000000000000000000000000000000000000
00000000000000000000077777000777770007777700077777000000000070707700070077700000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000077777000070707000000000707077707770777000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000770707700700707007000000707070700700070000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000777077700700070000000000707077700700070000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000770707700700707007000000777070700700070000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000077777007000707000000000777070707770070000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000077777000070777000000000700007700770000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000770007700700007007000000700070707000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000770707700700070000000000700070707000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000770007700700700007000000700070707070000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000077777007000777000000000777077007770000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000880880000000000808088800000000000000000000000000000000ccc00000000000ccc0cc00ccc0ccc00cc0c0c00000ccc0ccc0c000c000
000000000000000088888000800000080808080000000000000000000000000000000ccc0c000c000000c000c0c0c000c0c0c000c0c00000c0c0c0c0c000c000
000000000000000088888000000000088808880000000000000000000000000000000ccccc0000000000cc00c0c0cc00cc00c000ccc00000cc00ccc0c000c000
000000000000000008880000800000080808000000000000000000000000000000000ccccc000c000000c000c0c0c000c0c0c0c000c00000c0c0c0c0c000c000
0000000000000000008000000000000808080000000000000000000000000000000000ccc00000000000ccc0c0c0ccc0c0c0ccc0ccc00000ccc0c0c0ccc0ccc0
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000a0000000000000aa0aaa0aaa0aaa0aa000aa0aaa0a0a000000666666600000000006606660666066606660066000000000000000000000
00000000000000000aaa0000a000000a0000a00a0a0a000a0a0a0000a00a0a000000000000000600000060000600606006006060600000000000000000000000
000000000000000aaaaaaa000000000aaa00a00aa00aa00a0a0a0000a00aaa000000666666600000000066600600666006006600666000000000000000000000
0000000000000000aaaaa000a00000000a00a00a0a0a000a0a0a0a00a00a0a000000000000000600000000600600606006006060006000000000000000000000
0000000000000000a000a0000000000aa000a00a0a0aaa0a0a0aaa00a00a0a000000666666600000000066000600606066606060660000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000060606060000000006660666066600660666000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000006060600060000006060606066606060606000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000060606060000000006660660060606060660000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000006060600060000006060606060606060606000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000060606060000000006060606060606600606000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000