質問編集履歴
1
code追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -15,3 +15,241 @@
|
|
15
15
|
2020年9月13日現在最新版
|
16
16
|
|
17
17
|
javascript
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
### code
|
22
|
+
|
23
|
+
```javascript
|
24
|
+
|
25
|
+
input.onButtonPressed(Button.A, function () {
|
26
|
+
|
27
|
+
led.unplot(ge22[0], ge22[1])
|
28
|
+
|
29
|
+
ge22[1] += 1
|
30
|
+
|
31
|
+
let count=0
|
32
|
+
|
33
|
+
if (ge22[0] == 4 && ge22[1] == 4) {
|
34
|
+
|
35
|
+
basic.showString("CLEAR!")
|
36
|
+
|
37
|
+
start()
|
38
|
+
|
39
|
+
} else count += 1
|
40
|
+
|
41
|
+
if (led.point(ge22[0], ge22[1])) {
|
42
|
+
|
43
|
+
basic.showString("MISS!")
|
44
|
+
|
45
|
+
start()
|
46
|
+
|
47
|
+
} else count += 1
|
48
|
+
|
49
|
+
if (ge22[0] >= 5 || ge22[1] >= 5) {
|
50
|
+
|
51
|
+
basic.showString("OVER!")
|
52
|
+
|
53
|
+
start()
|
54
|
+
|
55
|
+
} else count += 1
|
56
|
+
|
57
|
+
if (count == 3) {
|
58
|
+
|
59
|
+
led.plotBrightness(ge22[0], ge22[1], 60)
|
60
|
+
|
61
|
+
}
|
62
|
+
|
63
|
+
return;
|
64
|
+
|
65
|
+
})
|
66
|
+
|
67
|
+
input.onButtonPressed(Button.B, function () {
|
68
|
+
|
69
|
+
led.unplot(ge22[0], ge22[1])
|
70
|
+
|
71
|
+
ge22[0] += 1
|
72
|
+
|
73
|
+
let count=0
|
74
|
+
|
75
|
+
if (ge22[0] == 4 && ge22[1] == 4) {
|
76
|
+
|
77
|
+
basic.showString("CLEAR!")
|
78
|
+
|
79
|
+
start()
|
80
|
+
|
81
|
+
} else count += 1
|
82
|
+
|
83
|
+
if (led.point(ge22[0], ge22[1])) {
|
84
|
+
|
85
|
+
basic.showString("MISS!")
|
86
|
+
|
87
|
+
start()
|
88
|
+
|
89
|
+
} else count += 1
|
90
|
+
|
91
|
+
if (ge22[0] >= 5 || ge22[1] >= 5) {
|
92
|
+
|
93
|
+
basic.showString("OVER!")
|
94
|
+
|
95
|
+
start()
|
96
|
+
|
97
|
+
} else count += 1
|
98
|
+
|
99
|
+
if (count == 3) {
|
100
|
+
|
101
|
+
led.plotBrightness(ge22[0], ge22[1], 60)
|
102
|
+
|
103
|
+
}
|
104
|
+
|
105
|
+
return;
|
106
|
+
|
107
|
+
})
|
108
|
+
|
109
|
+
function start () {
|
110
|
+
|
111
|
+
ge12 = [0, 0]
|
112
|
+
|
113
|
+
ge22 = [0, 0]
|
114
|
+
|
115
|
+
basic.showLeds(`
|
116
|
+
|
117
|
+
. # # # #
|
118
|
+
|
119
|
+
# # # # #
|
120
|
+
|
121
|
+
# # # # #
|
122
|
+
|
123
|
+
# # # # #
|
124
|
+
|
125
|
+
# # # # #
|
126
|
+
|
127
|
+
`)
|
128
|
+
|
129
|
+
ge1 = [0, 0]
|
130
|
+
|
131
|
+
ge2 = [0, 0]
|
132
|
+
|
133
|
+
let y2 = 0
|
134
|
+
|
135
|
+
let x2 = 0
|
136
|
+
|
137
|
+
let randm = 0
|
138
|
+
|
139
|
+
led.plotBrightness(ge22[0], ge22[1], 60)
|
140
|
+
|
141
|
+
while (led.point(4, 4) == true) {
|
142
|
+
|
143
|
+
randm = randint(1, 2)
|
144
|
+
|
145
|
+
if (randm == 1) {
|
146
|
+
|
147
|
+
x2 += 1
|
148
|
+
|
149
|
+
led.unplot(x2, y2)
|
150
|
+
|
151
|
+
} else {
|
152
|
+
|
153
|
+
y2 += 1
|
154
|
+
|
155
|
+
led.unplot(x2, y2)
|
156
|
+
|
157
|
+
}
|
158
|
+
|
159
|
+
if (x2 >= 5) {
|
160
|
+
|
161
|
+
x2 = 4
|
162
|
+
|
163
|
+
}
|
164
|
+
|
165
|
+
if (y2 >= 5) {
|
166
|
+
|
167
|
+
y2 = 4
|
168
|
+
|
169
|
+
}
|
170
|
+
|
171
|
+
}
|
172
|
+
|
173
|
+
return;
|
174
|
+
|
175
|
+
}
|
176
|
+
|
177
|
+
let y2 = 0
|
178
|
+
|
179
|
+
let x2 = 0
|
180
|
+
|
181
|
+
let randm = 0
|
182
|
+
|
183
|
+
let ge12: number[] = []
|
184
|
+
|
185
|
+
let count = 0
|
186
|
+
|
187
|
+
let ge22: number[] = []
|
188
|
+
|
189
|
+
let randm22 = 0
|
190
|
+
|
191
|
+
let tasuke3 = 0
|
192
|
+
|
193
|
+
let list3 = 0
|
194
|
+
|
195
|
+
let random3 = 0
|
196
|
+
|
197
|
+
let tasuke22 = 0
|
198
|
+
|
199
|
+
let list22 = 0
|
200
|
+
|
201
|
+
let random22 = 0
|
202
|
+
|
203
|
+
let x22 = 0
|
204
|
+
|
205
|
+
let y22 = 0
|
206
|
+
|
207
|
+
let randm3 = 0
|
208
|
+
|
209
|
+
let p = 0
|
210
|
+
|
211
|
+
let o = 0
|
212
|
+
|
213
|
+
let y = 0
|
214
|
+
|
215
|
+
let x = 0
|
216
|
+
|
217
|
+
let randm2 = 0
|
218
|
+
|
219
|
+
let tasuke = 0
|
220
|
+
|
221
|
+
let list = 0
|
222
|
+
|
223
|
+
let random = 0
|
224
|
+
|
225
|
+
let tasuke2 = 0
|
226
|
+
|
227
|
+
let list2 = 0
|
228
|
+
|
229
|
+
let random2 = 0
|
230
|
+
|
231
|
+
let ge1 , ge2;
|
232
|
+
|
233
|
+
let ge122 = [0, 0]
|
234
|
+
|
235
|
+
ge22 = [0, 0]
|
236
|
+
|
237
|
+
basic.showLeds(`
|
238
|
+
|
239
|
+
. # # # #
|
240
|
+
|
241
|
+
# # # # #
|
242
|
+
|
243
|
+
# # # # #
|
244
|
+
|
245
|
+
# # # # #
|
246
|
+
|
247
|
+
# # # # #
|
248
|
+
|
249
|
+
`)
|
250
|
+
|
251
|
+
led.plotBrightness(0, 0, 60)
|
252
|
+
|
253
|
+
start()
|
254
|
+
|
255
|
+
```
|