-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpackboard.bas
151 lines (134 loc) · 4.07 KB
/
packboard.bas
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
!- compacted board
!- xxxx yyyy Pack 2 valzues per byte by using 4 bits
!- Example: 8 9
!- Value 8 ; we will move left 4 bits by multiplying it by 16
!- Value 9 ; we OR the bits into the new value
!- Packed value = 8*16 or 9
!- Unpacking the 2 values
!- Packed value = 137 10001001
!- Y = 137 and 00001111 (15) - this will mask out the upper to get the lower
!- x = 137 / 16
!- this will read the data in and print the packed number
!- There are 81 values (9x9). but we will use a 0 as the empty 82nd value
!- we will end up with 41 values
!- pn% = packed nibbles
10 a%=0:hi%=0:lo%=0:dim pn%(40):pn%=0
15 print "data"
20 for n=1 to 41
30 read hi%:if n=41 then lo%=0
40 if n<41 then read lo%
50 a%=hi%*16 or lo%
60 pn%(pn%)=a%:pn%=pn%+1
65 print a%"{left} {left}";
68 if n=21 then print"{down}"
70 next
!- Puzzle 1
!- 9010 data 0,9,0,0,0,0,4,0,1
!- 9020 data 0,3,0,0,9,2,0,8,0
!- 9030 data 7,5,0,0,0,4,0,0,0
!- 9040 data 8,0,9,1,0,5,6,0,0
!- 9050 data 0,2,5,0,7,0,8,9,0
!- 9060 data 0,0,6,9,0,8,1,0,7
!- 9070 data 0,0,0,5,0,0,0,6,4
!- 9080 data 0,8,0,3,6,0,0,1,0
!- 9090 data 9,0,3,0,0,0,0,7,0
!- Puzzle 2
!- 9200 data 7,0,0,3,2,0,0,5,0
!- 9210 data 0,0,4,0,0,0,6,0,0
!- 9220 data 0,0,0,5,6,8,0,0,4
!- 9230 data 1,0,9,6,0,0,0,0,0
!- 9240 data 2,3,0,4,5,9,0,1,6
!- 9250 data 0,0,0,0,0,2,3,0,9
!- 9260 data 6,0,0,8,3,7,0,0,0
!- 9270 data 0,0,1,0,0,0,8,0,0
!- 9280 data 0,5,0,0,9,6,0,0,2
!- Puzzle 3
!-9000 data 5,0,7,0,0,9,0,0,6
!-9010 data 9,3,4,0,6,0,0,0,0
!-9020 data 0,0,2,8,7,3,0,5,0
!-9030 data 6,2,0,0,0,0,9,0,0
!-9040 data 0,0,9,0,5,0,2,0,0
!-9050 data 0,0,3,0,0,0,0,6,4
!-9060 data 0,1,0,2,4,5,6,0,0
!-9070 data 0,0,0,0,3,0,1,4,7
!-9080 data 3,0,0,1,0,0,5,0,8
!- Puzzle 4
!-9000 data 0,7,6,0,3,0,0,0,0
!-9010 data 0,1,0,0,5,0,4,0,0
!-9020 data 0,3,0,4,9,1,0,8,0
!-9030 data 0,2,0,3,0,9,5,0,4
!-9040 data 0,5,3,0,0,0,1,6,0
!-9050 data 7,0,4,1,0,5,0,3,0
!-9060 data 0,8,0,5,1,6,0,4,0
!-9070 data 0,0,2,0,4,0,0,9,0
!-9080 data 0,0,0,0,2,0,6,5,0
!- puzzle 31 (Medium) 5
!-9000 data 5,0,0,2,9,0,1,3,0
!-9010 data 0,0,3,0,0,4,0,0,9
!-9020 data 0,0,2,0,5,0,0,0,0
!-9030 data 9,0,0,0,8,2,0,0,5
!-9040 data 0,2,6,0,0,0,3,9,0
!-9050 data 4,0,0,9,7,0,0,0,8
!-9060 data 0,0,0,0,2,0,8,0,0
!-9070 data 2,0,0,8,0,0,4,0,0
!-9080 data 0,4,8,0,1,7,0,0,2
!- puzzle 32 (medium) 6
!-9000 data 4,0,0,0,0,9,0,0,0
!-9010 data 0,0,0,1,0,0,4,0,6
!-9020 data 6,0,1,0,7,0,0,0,0
!-9030 data 0,0,7,5,6,0,0,0,1
!-9040 data 0,6,4,0,1,0,3,5,0
!-9050 data 5,0,0,0,2,4,8,0,0
!-9060 data 0,0,0,0,4,0,5,0,8
!-9070 data 1,0,6,0,0,5,0,0,0
!-9080 data 0,0,0,2,0,0,0,0,9
!-puzzle 34 (medium) 7
!-9000 data 0,0,2,0,0,1,0,0,0
!-9010 data 0,0,8,0,2,0,0,5,3
!-9020 data 7,4,0,0,0,6,2,0,0
!-9030 data 1,0,0,0,0,0,9,6,0
!-9040 data 0,6,9,0,0,0,1,7,0
!-9050 data 0,7,5,0,0,0,0,0,8
!-9060 data 0,0,1,7,0,0,0,9,4
!-9070 data 4,2,0,0,5,0,7,0,0
!-9080 data 0,0,0,1,0,0,3,0,0
!-puzzle 36 (medium) 8
!-9000 data 0,0,6,0,0,0,0,0,0
!-9010 data 8,1,0,0,3,0,0,2,0
!-9020 data 2,0,7,4,0,1,0,0,0
!-9030 data 0,0,0,0,0,8,9,0,0
!-9040 data 1,0,8,9,0,6,5,0,4
!-9050 data 0,0,4,2,0,0,0,0,0
!-9060 data 0,0,0,8,0,7,2,0,9
!-9070 data 0,5,0,0,9,0,0,7,8
!-9080 data 0,0,0,0,0,0,3,0,0
!-puzzle 66 (Hard) 9
!-9000 data 0,0,0,0,0,8,0,0,0
!-9010 data 6,0,0,3,5,0,0,8,0
!-9020 data 1,0,0,0,4,0,7,9,0
!-9030 data 0,0,4,0,0,0,3,1,0
!-9040 data 0,0,0,1,0,9,0,0,0
!-9050 data 0,9,1,0,0,0,8,0,0
!-9060 data 0,4,2,0,8,0,0,0,5
!-9070 data 0,8,0,0,9,6,0,0,2
!-9080 data 0,0,0,2,0,0,0,0,0
!-puzzle 68 (Hard) 10
!-9000 data 0,0,1,0,0,0,7,2,0
!-9010 data 0,8,7,0,0,0,0,0,3
!-9020 data 0,3,0,2,0,0,0,0,0
!-9030 data 4,0,0,0,9,0,0,5,8
!-9040 data 0,0,0,8,0,5,0,0,0
!-9050 data 8,5,0,0,4,0,0,0,6
!-9060 data 0,0,0,0,0,2,0,9,0
!-9070 data 6,0,0,0,0,0,3,4,0
!-9080 data 0,1,9,0,0,0,6,0,0
!-puzzle 199 (Diabolical) 11
9000 data 8,0,0,0,0,0,0,9,5
9010 data 0,2,4,0,0,0,0,0,7
9015 data 0,0,7,0,0,9,0,0,0
9018 data 0,0,5,0,6,4,2,0,0
9020 data 0,0,0,3,0,2,0,0,0
9040 data 0,0,2,7,1,0,8,0,0
9050 data 0,0,0,6,0,0,1,0,0
9060 data 6,0,0,0,0,0,9,4,0
9070 data 2,1,0,0,0,0,0,0,3