主题:QBASIC编写的五子棋程序
[专家分:] 发布于 2005-07-31 09:11:00
发一个QB编写的五子棋程序
回复列表 (共25个回复)
11 楼
1333348 [专家分:0] 发布于 2005-08-02 18:17:00
end2: END SUB
SUB computer1
SELECT CASE dh
CASE 50 TO 56, 65 TO 71, 80 TO 86
dh = dh + 15
CASE 95 TO 101, 110 TO 116, 125 TO 131
dh = dh - 15
CASE 35 TO 41
dh = dh + 30
CASE 20 TO 26
dh = dh + 45
CASE 5 TO 11
dh = dh + 60
CASE 140 TO 146
dh = dh - 30
CASE 155 TO 161
dh = dh - 45
CASE 170 TO 176
dh = dh - 60
CASE 61 TO 64
dh = 65
CASE 76 TO 79
12 楼
1333348 [专家分:0] 发布于 2005-08-02 18:17:00
dh = 80
CASE 91 TO 94
dh = 95
CASE 106 TO 109
dh = 110
CASE 72 TO 75
dh = 71
CASE 87 TO 90
dh = 86
CASE 102 TO 105
dh = 101
CASE 117 TO 120
dh = 116
CASE 1, 17, 33, 49, 121
dh = 65
CASE 2, 18, 34
dh = 66
CASE 3, 19
dh = 67
CASE 4, 12
dh = 68
CASE 13, 27
dh = 69
CASE 14, 28, 42
dh = 70
CASE 15, 29, 43, 57, 135
dh = 71
CASE 30, 44, 58, 134, 150
dh = 86
CASE 45, 59, 133, 149, 165
dh = 101
CASE 60, 132, 148, 164, 180
dh = 116
CASE 147, 163, 179
dh = 115
13 楼
1333348 [专家分:0] 发布于 2005-08-02 18:18:00
CASE 178, 162
dh = 114
CASE 177, 169
dh = 113
CASE 168, 154
dh = 112
CASE 167, 153, 139
dh = 111
CASE 166, 152, 138, 124, 46
dh = 110
CASE 151, 137, 123, 31, 47
dh = 95
CASE 136, 122, 16, 32, 48
dh = 80
END SELECT
14 楼
1333348 [专家分:0] 发布于 2005-08-02 18:19:00
SUB computer2
DIM sj(25)
s = c(f) - 32
FOR i = 0 TO 4
FOR j = 0 TO 4
n = n + 1
sj(n) = s + i + j * 15
NEXT j
NEXT i
j = INT(RND * 25) + 1
WHILE a(sj(j)) <> 1
j = INT(RND * 25) + 1
WEND
dh = sj(j)
END SUB
15 楼
1333348 [专家分:0] 发布于 2005-08-02 18:20:00
SUB human
FOR i = 1 TO 3
FOR j = 1 TO 10: NEXT j
SOUND 680, 3
NEXT i
ooo: LOCATE 23, 3: INPUT "please,input the number::"; d$
dh = VAL(d$)
IF dh > 180 THEN GOTO ooo
WHILE a(dh) <> 1
LINE (10, 350)-(635, 380), 0, BF
LOCATE 23, 3: INPUT "please ,input the right number::"; d$
dh = VAL(d$)
WEND
LINE (10, 350)-(635, 380), 0, BF
END SUB
16 楼
1333348 [专家分:0] 发布于 2005-08-02 18:20:00
SUB jiemian
SCREEN 12
LINE (0, 50)-(639, 340), 4, BF
FOR i = 0 TO 639 STEP 5
LINE (i, 53)-(i + 3, 53), 7
LINE (i, 343)-(i + 3, 343), 7
NEXT i
FOR i = 80 TO 300 STEP 20
FOR j = 20 TO 440 STEP 30
n = n + 1
IF n < 100 THEN
LINE (j + 4, i + 6)-(j + 7, i + 13), 0, B
LINE (j + 5, i + 5)-(j + 8, i + 14), 0, B
END IF
IF n < 10 THEN
LINE (j + 12, i + 6)-(j + 15, i + 13), 0, B
LINE (j + 13, i + 5)-(j + 16, i + 14), 0, B
END IF
LINE (j + 18, i + 5)-(j + 24, i + 15), 0, B
LINE (j + 19, i + 6)-(j + 23, i + 14), 0, B
LINE (j + 19, i + 10)-(j + 23, i + 11), 0, BF
IF n >= 10 THEN
LINE (j + 10, i + 5)-(j + 16, i + 15), 0, B
LINE (j + 11, i + 6)-(j + 15, i + 14), 0, B
LINE (j + 11, i + 10)-(j + 15, i + 11), 0, BF
END IF
17 楼
1333348 [专家分:0] 发布于 2005-08-02 18:21:00
SUB jiemian
SCREEN 12
LINE (0, 50)-(639, 340), 4, BF
FOR i = 0 TO 639 STEP 5
LINE (i, 53)-(i + 3, 53), 7
LINE (i, 343)-(i + 3, 343), 7
NEXT i
FOR i = 80 TO 300 STEP 20
FOR j = 20 TO 440 STEP 30
n = n + 1
IF n < 100 THEN
LINE (j + 4, i + 6)-(j + 7, i + 13), 0, B
LINE (j + 5, i + 5)-(j + 8, i + 14), 0, B
END IF
IF n < 10 THEN
LINE (j + 12, i + 6)-(j + 15, i + 13), 0, B
LINE (j + 13, i + 5)-(j + 16, i + 14), 0, B
END IF
LINE (j + 18, i + 5)-(j + 24, i + 15), 0, B
LINE (j + 19, i + 6)-(j + 23, i + 14), 0, B
LINE (j + 19, i + 10)-(j + 23, i + 11), 0, BF
IF n >= 10 THEN
LINE (j + 10, i + 5)-(j + 16, i + 15), 0, B
LINE (j + 11, i + 6)-(j + 15, i + 14), 0, B
LINE (j + 11, i + 10)-(j + 15, i + 11), 0, BF
END IF
18 楼
1333348 [专家分:0] 发布于 2005-08-02 18:22:00
IF n >= 100 THEN LINE (j + 7, i + 5)-(j + 8, i + 15), 0, BF
IF n < 10 THEN k = 2
IF n >= 10 THEN k = 1
IF n >= 100 THEN k = 0
n1$ = STR$(n): a1 = LEN(n1$)
FOR r = 2 TO a1
IF r = 2 AND k = 0 THEN GOTO 5
c$ = MID$(n1$, r, 1)
p = k * 8
IF c$ = "1" THEN LINE (j + p + 2, i + 5)-(j + p + 7, i + 15), 4, BF
IF c$ = "2" THEN
LINE (j + p + 2, i + 6)-(j + p + 3, i + 10), 4, BF
LINE (j + p + 7, i + 11)-(j + p + 8, i + 14), 4, BF
END IF
IF c$ = "3" THEN LINE (j + p + 2, i + 5)-(j + p + 3, i + 15), 4, BF
IF c$ = "4" THEN
LINE (j + p + 3, i + 5)-(j + p + 8, i + 6), 4, BF
LINE (j + p + 2, i + 12)-(j + p + 6, i + 15), 4, BF
END IF
IF c$ = "5" THEN
LINE (j + p + 7, i + 5)-(j + p + 8, i + 10), 4, BF
LINE (j + p + 2, i + 11)-(j + p + 3, i + 14), 4, BF
END IF
IF c$ = "6" THEN LINE (j + p + 7, i + 5)-(j + p + 8, i + 10), 4, BF
IF c$ = "7" THEN LINE (j + p + 2, i + 7)-(j + p + 6, i + 15), 4, BF
IF c$ = "9" THEN LINE (j + p + 2, i + 12)-(j + p + 3, i + 14), 4, BF
IF c$ = "0" THEN LINE (j + p + 3, i + 10)-(j + p + 7, i + 11), 4, BF
19 楼
1333348 [专家分:0] 发布于 2005-08-02 18:22:00
IF k = 2 THEN GOTO 10
5 k = k + 1
NEXT r
10 NEXT j
NEXT i
FOR i = 80 TO 320 STEP 5
LINE (480, i)-(480, i + 3), 7
NEXT i
LINE (482, 80)-(482, 320), 0
FOR i = 80 TO 300 STEP 20
FOR j = 20 TO 440 STEP 30
FOR i1 = i TO i + 20 STEP 5
LINE (j + 28, i1)-(j + 28, i1 + 5), 0
IF i1 + 3 > i + 20 THEN GOTO 15
LINE (j, i1)-(j, i1 + 3), 7
15 NEXT i1
FOR j1 = j TO j + 30 STEP 5
LINE (j1, i + 18)-(j1 + 5, i + 18), 0
IF j1 + 3 > j + 30 THEN GOTO 20
LINE (j1, i)-(j1 + 3, i), 7
20 NEXT j1
NEXT j, i
20 楼
popoa [专家分:100] 发布于 2005-08-13 16:30:00
wrong!
我来回复