Здравствуйте!
Вот в этом коде надо исправить REM 9, чтобы наклонная прямая двигалась из левого в правый угол (экран 320 (по горизонтали) на 200 (по вертикали))
См рисунок
SCREEN 7 COLOR 2, 14 REM 1 FOR X = 160 TO 320 STEP 3 PSET (X, 100), 2 FOR T = 1 TO 100000 NEXT T PSET (X, 100), 0 NEXT X REM 2 FOR X = 320 TO 160 STEP -3 PSET (X, 100), 2 FOR T = 1 TO 100000 NEXT T PSET (X, 100), 0 NEXT X REM 3 FOR Y = 100 TO 200 STEP 3 PSET (160, Y), 2 FOR T = 1 TO 100000 NEXT T PSET (160, Y), 0 NEXT Y REM 4 FOR Y = 200 TO 100 STEP -3 PSET (160, Y), 2 FOR T = 1 TO 100000 NEXT T PSET (160, Y), 0 NEXT Y REM 5 FOR X = 160 TO 320 STEP 1 LINE (X, 100)-(X + 40, 60), 2 FOR T = 1 TO 10000 NEXT T LINE (X, 100)-(X + 40, 60), 0 NEXT X REM 6 FOR X = 320 TO 180 STEP -1 LINE (X - 40, 60)-(X, 100), 2, BF FOR T = 1 TO 10000 NEXT T LINE (X - 40, 60)-(X, 100), 0, BF NEXT X REM 7 FOR Y = 100 TO 200 STEP 1 CIRCLE (160, Y), 30, 2 FOR T = 1 TO 10000 NEXT T CIRCLE (160, Y), 30, 0 NEXT Y REM 8 FOR Y = 200 TO 100 STEP -1 CIRCLE (160, Y), 30, 2, 170 * 3.14 / 180, 10 * 3.14 / 180 FOR T = 1 TO 10000 REM 9 FOR Y = 50 TO 200 STEP 1 LINE (0, Y)-(50, Y - 50), 2 FOR T = 1 TO 10000 NEXT T LINE (0, Y)-(50, Y - 50), 2 NEXT Y
Неактивен
Ханойские башни, qbasic ... помогите исправить...
я знаю что у меня в днк ошибка....
и что я бейсик последний раз видел сто лет назад...
племянник попросил помочь...
главное....
мне сама прога надо а не как быстрее ее пройти...
с Уважением...
demettriss
10 SCREEN 7
16 o = 170
17 r(1) = 80
18 r(2) = 160
19 r(3) = 240
20 LOCATE 24, 1: INPUT " number of disks ", m
25 DIM a(m, 3)
26 FOR w = 2 TO 3
27 FOR e = 1 TO m
28 a(e, w) = 0
29 NEXT e
30 NEXT w
40 FOR z = 1 TO m
60 a(z, 1) = z
70 NEXT z
73 f = 0
75 CLS
80 LINE (78, o)-(82, 10), 15, B
90 LINE (158, o)-(162, 10), 15, B
100 LINE (238, o)-(242, 10), 15, B
110 LINE (2, o)-(318, 175), 15, B
120 FOR q = 1 TO 3
130 FOR i = 1 TO m
132 c = i
133 IF c >= 15 THEN c = c - 1
134 IF c <= 1 THEN c = 15
135 IF c >= 2 AND c <= 14 THEN GOTO 137 ELSE GOTO 133
137 t = m - i + 1
145 IF m = i THEN k = m AND t = m
150 k = a(t, q)
155 k = k + 5
160 x1 = r(q) - k
170 x2 = r(q) + k
180 o1 = o - 5 * (i - 1)
190 y1 = o1
200 y2 = o1 - 5
215 IF a(t, q) = 0 THEN GOTO 220
210 LINE (x1, y1)-(x2, y2), c, BF
220 NEXT i
230 NEXT q
290 IF f = 1 THEN GOTO 335
300 LOCATE 24, 1: INPUT " from what ", a%
310 CLS
320 IF a% > 3 OR a% < 1 THEN GOTO 345
325 f = f + 1
330 GOTO 75
335 LOCATE 24, 1: INPUT " on what ", b%
337 IF b% > 3 OR b% < 1 OR a% = b% THEN GOTO 345 ELSE GOTO 360
345 CLS
346 LOCATE 15, 5: INPUT "not the correct value", d
347 IF f = 1 THEN GOTO 75
355 GOTO 75
360 z1 = a%
370 z2 = b%
380 xyz = a(1, z1)
390 IF a% = j THEN a% = a(1, j)
400 IF b% = j THEN b% = a(1, j)
450 IF b% = 0 THEN GOTO 510
500 IF a% > b% THEN LOCATE 15, 1: INPUT "not the correct value. A%>B%", j ELSE GOTO 510
505 GOTO 73
510 m1 = m - 1
520 k1 = a(1, z1)
525 a(1, z1) = 0
530 FOR i = 1 TO m1
540 i1 = i + 1
560 SWAP a(i, z1), a(i1, z1)
570 NEXT i
600 s1 = m
610 m1 = m - 1
620 FOR i = 1 TO m1
630 s2 = s1 - 1
640 SWAP a(s1, z2), a(s2, z2)
650 s1 = s2
660 NEXT i
666 a(1, z2) = xyz
700 h = a(m, 2)
710 u = a(m, 3)
720 IF h > 0 OR u > 0 THEN GOTO 750 ELSE GOTO 73
750 LOCATE 15, 15: PRINT " W I N ! "
Неактивен