DIM A10 - PowerPoint PPT Presentation

1 / 362
About This Presentation
Title:

DIM A10

Description:

wend. let sx=stx() let sy=sty() if sx 85. if sy 64. let p=1 ... wend. return. sub board: line 0 85,0,85,192,1. line 0 170,0,170,192,1. line 0 0,64,256,64,1 ... – PowerPoint PPT presentation

Number of Views:66
Avg rating:3.0/5.0
Slides: 363
Provided by: Serv863
Category:
Tags: dim | a10 | wend

less

Transcript and Presenter's Notes

Title: DIM A10


1
DIM A(10)
2
CLS 1
3
let N 0
4
PRINT 1 "Press any key when"
5
PRINT 1 "you're ready to play"
6
lab TARGET1
7
let N N 1
8
let ky0
9
let kykey()
10
IF ky0
11
GOTO TARGET1
12
ENDIF
13
CLS 1
14
keyhide
15
gosub board
16
lab TARGET14
17
CLS 1
18
FOR N 1 TO 9
19
let A(N)0
20
NEXT
21
PRINT 1 "I'll have the first move"
22
GOTO TARGET2
23
lab end
24
end
25
lab TARGET6
26
GOSUB TARGET3
27
IF FLAG 0
28
GOTO TARGET16
29
endif
30
GOSUB TARGET4
31
IF A(X)A(Y) and A(Y)A(Z)andA(X)ltgt0
32
GOTO TARGET13
33
ENDIF
34
GOSUB TARGET5
35
lab TARGET2
36
GOSUB TARGET3
37
IF FLAG 0
38
GOTO TARGET16
39
endif
40
GOSUB TARGET4
41
IF A(X)A(Y) and A(Y)A(Z)andA(X)ltgt0
42
GOTO TARGET13
43
ENDIF
44
IF A(5) 0 let A(5)1
45
GOTO TARGET6
46
ENDIF
47
let D1 let B1
48
lab TARGET9
49
IF B 1
50
let X 1
51
let Y2
52
let Z 3
53
ENDIF
54
lab TARGET8
55
IF B2
56
let X1
57
let Y4
58
let Z7
59
ENDIF
60
IF B3
61
let X1
62
let Y5
63
let Z9
64
ENDIF
65
IF B4
66
let X3
67
let Z7
68
ENDIF
69
let C1
70
lab TARGET7
71
IF A(X)D AND A(Y)D AND A(Z)0
72
let A(Z)1
73
GOTO TARGET6
74
endif
75
IF A(X)D AND A(Y)0 AND A(Z)D
76
let A(Y)1
77
GOTO TARGET6
78
endif
79
IF A(X)0 AND A(Y)D AND A(Z)D
80
let A(X)1
81
GOTO TARGET6
82
endif
83
IF B1
84
let XX3
85
let YY3
86
let ZZ3
87
ENDIF
88
IF B2
89
let XX1
90
let YY1
91
let ZZ1
92
ENDIF
93
IF Clt3
94
let C C 1
95
GOTO TARGET7
96
ENDIF
97
IF Blt4
98
let BB1
99
GOTO TARGET8
100
ENDIF
101
IF Dlt2
102
let DD 1
103
GOTO TARGET9
104
ENDIF
105
let B 1
106
lab TARGET10
107
let D rnd(9)
108
IF A(C)0
109
let A(C)1
110
GOTO TARGET6
111
ENDIF
112
let BB1
113
IF Blt9
114
GOTO TARGET10
115
ENDIF
116
let B 0
117
lab TARGET11
118
let BB1
119
IF A(B)0
120
let A(B)1
121
GOTO TARGET6
122
ENDIF
123
IF Blt9
124
GOTO TARGET11
125
ENDIF
126
GOSUB TARGET3
127
lab TARGET16
128
PRINT 1 ""
129
PRINT 1 "It's a draw!"
130
print 1 "Press any key"
131
print 1 "B to end"
132
gosub key
133
if kk203
134
goto end
135
endif
136
GOTO TARGET12
137
sub TARGET4
138
let win0
139
FOR B 1 TO 4
140
IF B 1 and win0
141
let X1
142
let Y2
143
let Z3
144
ENDIF
145
IF B2 and win0
146
let X1
147
let Y4
148
let Z7
149
ENDIF
150
IF B3 and win0
151
let X1
152
let Y5
153
let Z9
154
ENDIF
155
IF B4 and win0
156
let X 3
157
let Z 7
158
ENDIF
159
FOR C1 TO 3
160
IF A(X)A(Y) and A(Y)A(Z)andA(X)ltgt0
161
let win1
162
endif
163
IF B 1 and win0
164
let XX3
165
let YY3
166
let ZZ3
167
ENDIF
168
IF B2 and win0
169
let XX1
170
let YY1
171
let ZZ1
172
ENDIF
173
NEXT
174
NEXT
175
RETURN
176
lab TARGET13
177
PRINT 1 ""
178
IF A(X)1
179
PRINT 1 "I'm the winner!"
180
ENDIF
181
IF A(X)2
182
PRINT 1 "You're the winner!"
183
ENDIF
184
print 1 "Press any key"
185
print 1 "B to end"
186
gosub key
187
if kk203
188
goto end
189
endif
190
lab TARGET12
191
GOTO TARGET14
192
sub TARGET5
193
PRINT 1 ""
194
PRINT 1 "Enter your move..."
195
print 1 "Using the stylus"
196
lab TARGET15
197
let p0
198
while plt1 or pgt9 or A(p)ltgt0
199
gosub touch
200
wend
201
let Bp
202
let A(B)2
203
RETURN
204
sub TARGET3
205
let FLAG 0
206
FOR B1 TO 9
207
IF A(B)0
208
let FLAG1
209
ENDIF
210
let pB
211
IF A(B)0
212
gosub drawd
213
ENDIF
214
if A(B)1
215
gosub drawo
216
ENDIF
217
IF A(B) 2
218
gosub drawx
219
ENDIF
220
next
221
return
222
sub touch
223
let st0
224
let p0
225
while st0
226
let ststt()
227
wend
228
let sxstx()
229
let systy()
230
if sxlt85
231
if sylt64
232
let p1
233
endif
234
if sygt64 and sylt128
235
let p4
236
endif
237
if sygt128
238
let p7
239
endif
240
endif
241
if sxgt85 and sxlt170
242
if sylt64
243
let p2
244
endif
245
if sygt64 and sylt128
246
let p5
247
endif
248
if sygt128
249
let p8
250
endif
251
endif
252
if sxgt170
253
if sylt64
254
let p3
255
endif
256
if sygt64 and sylt128
257
let p6
258
endif
259
if sygt128
260
let p9
261
endif
262
endif
263
return
264
sub drawd
265
if p1
266
print 0 at 5,3 " "
267
endif
268
if p4
269
print 0 at 5,10 " "
270
endif
271
if p7
272
print 0 at 5,21 " "
273
endif
274
if p2
275
print 0 at 15,3 " "
276
endif
277
if p5
278
print 0 at 15,10 " "
279
endif
280
if p8
281
print 0 at 15,21 " "
282
endif
283
if p3
284
print 0 at 25,3 " "
285
endif
286
if p6
287
print 0 at 25,10 " "
288
endif
289
if p9
290
print 0 at 25,21 " "
291
endif
292
return
293
sub drawx
294
if p1
295
print 0 at 5,3 "X"
296
endif
297
if p4
298
print 0 at 5,10 "X"
299
endif
300
if p7
301
print 0 at 5,21 "X"
302
endif
303
if p2
304
print 0 at 15,3 "X"
305
endif
306
if p5
307
print 0 at 15,10 "X"
308
endif
309
if p8
310
print 0 at 15,21 "X"
311
endif
312
if p3
313
print 0 at 25,3 "X"
314
endif
315
if p6
316
print 0 at 25,10 "X"
317
endif
318
if p9
319
print 0 at 25,21 "X"
320
endif
321
return
322
sub drawo
323
if p1
324
print 0 at 5,3 "o"
325
endif
326
if p4
327
print 0 at 5,10 "o"
328
endif
329
if p7
330
print 0 at 5,21 "o"
331
endif
332
if p2
333
print 0 at 15,3 "o"
334
endif
335
if p5
336
print 0 at 15,10 "o"
337
endif
338
if p8
339
print 0 at 15,21 "o"
340
endif
341
if p3
342
print 0 at 25,3 "o"
343
endif
344
if p6
345
print 0 at 25,10 "o"
346
endif
347
if p9
348
print 0 at 25,21 "o"
349
endif
350
return
351
sub key
352
let kk0
353
while kk0
354
let kkkey()
355
wend
356
return
357
sub board
358
line 0 85,0,85,192,1
359
line 0 170,0,170,192,1
360
line 0 0,64,256,64,1
361
line 0 0,128,256,128,1
362
return
Write a Comment
User Comments (0)
About PowerShow.com