From: Svjatoslav Agejenko Date: Tue, 15 Oct 2024 18:39:51 +0000 (+0300) Subject: Refactoring code for better readability X-Git-Url: http://www2.svjatoslav.eu/gitweb/?a=commitdiff_plain;h=a6280b8d6de53e279a92aae1aaaf92b1e7c562bb;p=qbasicapps.git Refactoring code for better readability --- diff --git a/Games/checkers.bas b/Games/checkers.bas index 498aee2..6ded57d 100755 --- a/Games/checkers.bas +++ b/Games/checkers.bas @@ -1,252 +1,333 @@ -' Game of checkers. Created by Svjatoslav Agejenko in 1998. -' -' Usage: -' keys: w a z s - move around -' ENTER key - pick piece on the desk and place it to new location - -DECLARE SUB look () -DECLARE SUB motleb () -DECLARE SUB mang () -DECLARE SUB sisend () -DECLARE SUB asend () -DEFINT A-Z -DIM SHARED nu(-100 TO 300) AS INTEGER -DIM SHARED kaik AS INTEGER -DIM SHARED looma AS INTEGER -DIM SHARED hiir(1000) -DIM SHARED ax1, ax2 -SCREEN 2 -CLS -LINE (1, 1)-(10, 1) -LINE (1, 1)-(1, 5) -LINE (10, 1)-(6, 2) -LINE (6, 2)-(10, 4) -LINE (10, 4)-(8, 5) -LINE (8, 5)-(4, 3) -LINE (4, 3)-(1, 5) -PAINT (2, 2), 1 -GET (1, 1)-(10, 5), hiir -CLS -FOR a = 0 TO 10 -LINE ((a * 40) + 20, 10)-((a * 40) + 20, 189), 1 -NEXT a - -FOR a = 0 TO 20 -LINE (20, (a * 18) + 9)-(420, (a * 18) + 9), 1 -NEXT a - -FOR a = 1 TO 200 -nu(a) = 4 -NEXT a - -FOR a = 2 TO 10 STEP 2 -FOR b = 1 TO 10 STEP 2 -PAINT ((b * 40) + 5, (a * 18) + 5) -NEXT b -NEXT a - -FOR a = 1 TO 10 STEP 2 -FOR b = 2 TO 10 STEP 2 -PAINT ((b * 40) + 5, (a * 18) + 5) -NEXT b -NEXT a - -FOR a = 2 TO 4 STEP 2 -FOR b = 1 TO 10 STEP 2 -nu(((a - 1) * 20) + b) = 1 -NEXT b -NEXT a - -FOR a = 1 TO 4 STEP 2 -FOR b = 2 TO 10 STEP 2 -nu(((a - 1) * 20) + b) = 1 -NEXT b -NEXT a - -FOR a = 8 TO 10 STEP 2 -FOR b = 1 TO 10 STEP 2 -nu(((a - 1) * 20) + b) = 0 -NEXT b -NEXT a - -FOR a = 7 TO 10 STEP 2 -FOR b = 2 TO 10 STEP 2 -nu(((a - 1) * 20) + b) = 0 -NEXT b -NEXT a - -FOR b = 2 TO 10 STEP 2 -nu(80 + b) = 3 -NEXT b - -FOR b = 1 TO 10 STEP 2 -nu(100 + b) = 3 -NEXT b - -asend -kaik = 1 -mang - -SUB asend -FOR b = 1 TO 10 -FOR a = 1 TO 10 -v = nu(((b - 1) * 20) + a) -SELECT CASE v -CASE 1 -CIRCLE (a * 40, b * 18), 17, 1 -PAINT (a * 40, b * 18), 1 -CIRCLE (a * 40, b * 18), 17, 0 -CIRCLE (a * 40, b * 18), 16, 0 -LINE ((a * 40) - 16, b * 18)-((a * 40) + 16, b * 18), 0 -CASE 0 -CIRCLE (a * 40, b * 18), 17, 0 -PAINT (a * 40, b * 18), 0 -CIRCLE (a * 40, b * 18), 17, 1 -CIRCLE (a * 40, b * 18), 15, 1 -CIRCLE (a * 40, b * 18), 3, 1 -CIRCLE (a * 40, b * 18), 7, 1 -LINE ((a * 40) - 16, b * 18)-((a * 40) + 16, b * 18), 0 -CASE 3 -PAINT (a * 40, b * 18), 1 -END SELECT -NEXT a -NEXT b -END SUB - -SUB look -looma = 0 -FOR a = 1 TO 200 -IF nu(a) = 0 AND nu(a - 21) = 1 AND nu(a - 42) = 3 THEN looma = 1 -IF nu(a) = 0 AND nu(a - 19) = 1 AND nu(a - 38) = 3 THEN looma = 1 -IF nu(a) = 0 AND nu(a + 21) = 1 AND nu(a + 42) = 3 THEN looma = 1 -IF nu(a) = 0 AND nu(a + 19) = 1 AND nu(a + 38) = 3 THEN looma = 1 -NEXT a -END SUB - -SUB mang -4 -sisend -motleb -look -IF looma = 1 THEN SOUND 1234, 2 -GOTO 4 -END SUB - -SUB motleb -3 -REM T O P E L T L O O K -FOR a = 1 TO 200 -IF nu(a) = 1 AND nu(a + 21) = 0 AND nu(a + 42) = 3 AND nu(a + 61) = 0 AND nu(a + 80) = 3 THEN nu(a) = 3: nu(a + 21) = 3: nu(a + 42) = 1: kaik = 1: asend: GOTO 3 -IF nu(a) = 1 AND nu(a + 21) = 0 AND nu(a + 42) = 3 AND nu(a + 23) = 0 AND nu(a + 4) = 3 THEN nu(a) = 3: nu(a + 21) = 3: nu(a + 42) = 1: kaik = 1: asend: GOTO 3 -IF nu(a) = 1 AND nu(a + 19) = 0 AND nu(a + 38) = 3 AND nu(a + 59) = 0 AND nu(a + 80) = 3 THEN nu(a) = 3: nu(a + 19) = 3: nu(a + 38) = 1: kaik = 1: asend: GOTO 3 -IF nu(a) = 1 AND nu(a + 19) = 0 AND nu(a + 38) = 3 AND nu(a + 17) = 0 AND nu(a - 4) = 3 THEN nu(a) = 3: nu(a + 19) = 3: nu(a + 38) = 1: kaik = 1: asend: GOTO 3 -IF nu(a) = 1 AND nu(a + 21) = 0 AND nu(a + 42) = 3 AND nu(a + 63) = 0 AND nu(a + 84) = 3 THEN nu(a) = 3: nu(a + 21) = 3: nu(a + 42) = 1: kaik = 1: asend: GOTO 3 -IF nu(a) = 1 AND nu(a + 19) = 0 AND nu(a + 38) = 3 AND nu(a + 57) = 0 AND nu(a + 76) = 3 THEN nu(a) = 3: nu(a + 19) = 3: nu(a + 38) = 1: aiki = 1: asend: GOTO 3 - -IF nu(a) = 1 AND nu(a - 21) = 0 AND nu(a - 42) = 3 AND nu(a - 61) = 0 AND nu(a - 80) = 3 THEN nu(a) = 3: nu(a - 21) = 3: nu(a - 42) = 1: kaik = 1: asend: GOTO 3 -IF nu(a) = 1 AND nu(a - 21) = 0 AND nu(a - 42) = 3 AND nu(a - 23) = 0 AND nu(a - 4) = 3 THEN nu(a) = 3: nu(a - 21) = 3: nu(a - 42) = 1: kaik = 1: asend: GOTO 3 -IF nu(a) = 1 AND nu(a - 19) = 0 AND nu(a - 38) = 3 AND nu(a - 59) = 0 AND nu(a - 80) = 3 THEN nu(a) = 3: nu(a - 19) = 3: nu(a - 38) = 1: kaik = 1: asend: GOTO 3 -IF nu(a) = 1 AND nu(a - 19) = 0 AND nu(a - 38) = 3 AND nu(a - 17) = 0 AND nu(a + 4) = 3 THEN nu(a) = 3: nu(a - 19) = 3: nu(a - 38) = 1: kaik = 1: asend: GOTO 3 -IF nu(a) = 1 AND nu(a - 21) = 0 AND nu(a - 42) = 3 AND nu(a - 63) = 0 AND nu(a - 84) = 3 THEN nu(a) = 3: nu(a - 21) = 3: nu(a - 42) = 1: kaik = 1: asend: GOTO 3 -IF nu(a) = 1 AND nu(a - 19) = 0 AND nu(a - 38) = 3 AND nu(a - 57) = 0 AND nu(a - 76) = 3 THEN nu(a) = 3: nu(a - 19) = 3: nu(a - 38) = 1: aiki = 1: asend: GOTO 3 -NEXT a - -REM L I H T S A L T L O O K -FOR a = 1 TO 200 -IF nu(a) = 1 AND nu(a + 21) = 0 AND nu(a + 42) = 3 THEN nu(a) = 3: nu(a + 21) = 3: nu(a + 42) = 1: GOTO 2 -IF nu(a) = 1 AND nu(a + 19) = 0 AND nu(a + 38) = 3 THEN nu(a) = 3: nu(a + 19) = 3: nu(a + 38) = 1: GOTO 2 -IF nu(a) = 1 AND nu(a - 21) = 0 AND nu(a - 42) = 3 THEN nu(a) = 3: nu(a - 21) = 3: nu(a - 42) = 1: GOTO 2 -IF nu(a) = 1 AND nu(a - 19) = 0 AND nu(a - 38) = 3 THEN nu(a) = 3: nu(a - 19) = 3: nu(a - 38) = 1: GOTO 2 -NEXT a -REM K A I T S E B -FOR a = 1 TO 200 -IF nu(a) = 1 AND nu(a + 19) = 3 AND nu(a + 21) = 3 AND nu(a + 40) = 1 AND nu(a + 38) = 3 AND nu(a + 61) = 0 THEN nu(a) = 3: nu(a + 19) = 1: GOTO 2 -IF nu(a) = 1 AND nu(a + 19) = 3 AND nu(a + 21) = 0 AND nu(a + 40) = 1 AND nu(a + 38) = 3 AND nu(a + 61) = 0 THEN nu(a) = 3: nu(a + 19) = 1: GOTO 2 -IF nu(a) = 1 AND nu(a + 19) = 3 AND nu(a + 21) = 3 AND nu(a + 40) = 1 AND nu(a + 38) = 1 AND nu(a + 61) = 0 THEN nu(a) = 3: nu(a + 19) = 1: GOTO 2 -IF nu(a) = 1 AND nu(a + 19) = 3 AND nu(a + 21) = 0 AND nu(a + 40) = 1 AND nu(a + 38) = 1 AND nu(a + 61) = 0 THEN nu(a) = 3: nu(a + 19) = 1: GOTO 2 - -IF nu(a - 2) = 1 AND nu(a + 19) = 3 AND nu(a) = 3 AND nu(a + 40) = 1 AND nu(a + 38) = 3 AND nu(a + 61) = 0 THEN nu(a - 2) = 3: nu(a + 19) = 1: GOTO 2 -IF nu(a - 2) = 1 AND nu(a + 19) = 3 AND nu(a) = 1 AND nu(a + 40) = 1 AND nu(a + 38) = 3 AND nu(a + 61) = 0 THEN nu(a - 2) = 3: nu(a + 19) = 1: GOTO 2 -IF nu(a - 2) = 1 AND nu(a + 19) = 3 AND nu(a) = 3 AND nu(a + 40) = 1 AND nu(a + 38) = 1 AND nu(a + 61) = 0 THEN nu(a - 2) = 3: nu(a + 19) = 1: GOTO 2 -IF nu(a - 2) = 1 AND nu(a + 19) = 3 AND nu(a) = 1 AND nu(a + 40) = 1 AND nu(a + 38) = 1 AND nu(a + 61) = 0 THEN nu(a - 2) = 3: nu(a + 19) = 1: GOTO 2 -NEXT a -REM L A H E B N U R K A -FOR a = 1 TO 200 -IF nu(a) = 1 AND nu(a + 2) = 4 AND nu(a + 21) = 3 THEN nu(a) = 3: nu(a + 21) = 1: GOTO 2 -IF nu(a) = 1 AND nu(a - 2) = 4 AND nu(a + 19) = 3 THEN nu(a) = 3: nu(a + 19) = 1: GOTO 2 -NEXT a -REM O H U T U K A I K -FOR a = 1 TO 200 -IF nu(a) = 1 AND nu(a + 19) = 3 AND nu(a + 38) = 3 AND nu(a + 40) = 3 THEN nu(a) = 3: nu(a + 19) = 1: GOTO 2 -IF nu(a) = 1 AND nu(a + 21) = 3 AND nu(a + 42) = 3 AND nu(a + 40) = 3 THEN nu(a) = 3: nu(a + 21) = 1: GOTO 2 - -IF nu(a) = 1 AND nu(a + 19) = 3 AND nu(a + 38) = 1 AND nu(a + 40) = 3 THEN nu(a) = 3: nu(a + 19) = 1: GOTO 2 -IF nu(a) = 1 AND nu(a + 21) = 3 AND nu(a + 42) = 1 AND nu(a + 40) = 3 THEN nu(a) = 3: nu(a + 21) = 1: GOTO 2 - -IF nu(a) = 1 AND nu(a + 19) = 3 AND nu(a + 38) = 3 AND nu(a + 40) = 1 THEN nu(a) = 3: nu(a + 19) = 1: GOTO 2 -IF nu(a) = 1 AND nu(a + 21) = 3 AND nu(a + 42) = 3 AND nu(a + 40) = 1 THEN nu(a) = 3: nu(a + 21) = 1: GOTO 2 - -IF nu(a) = 1 AND nu(a + 19) = 3 AND nu(a + 38) = 1 AND nu(a + 40) = 1 THEN nu(a) = 3: nu(a + 19) = 1: GOTO 2 -IF nu(a) = 1 AND nu(a + 21) = 3 AND nu(a + 42) = 1 AND nu(a + 40) = 1 THEN nu(a) = 3: nu(a + 21) = 1: GOTO 2 -NEXT a -REM M O T T E T U K A I K -FOR a = 1 TO 200 -IF nu(a) = 1 AND nu(a + 21) = 3 THEN nu(a) = 3: nu(a + 21) = 1: GOTO 2 -IF nu(a) = 1 AND nu(a + 19) = 3 THEN nu(a) = 3: nu(a + 19) = 1: GOTO 2 -NEXT a -LOCATE 4, 5 -PRINT " S I N U V O I T" -END -GOTO 3 -2 -asend -9 -END SUB - -SUB sisend -DIM asdf(1000) - -p = 1 -5 -a = ax1 -b = ax2 -7 -IF p = 1 THEN LOCATE 1, 70: PRINT "Kust !" -IF p = 2 THEN LOCATE 1, 70: PRINT "kuhu !" - -LOCATE 2, 60 -qw = (((b \ 18) - 1) * 20) + (a \ 40) -PRINT qw -GET (a, b)-(a + 10, b + 10), asdf -PUT (a, b), hiir, PSET -a$ = INPUT$(1) -PUT (a, b), asdf, PSET -IF p = 2 AND a$ = CHR$(13) THEN a2 = qw: ax1 = a: ax2 = b: GOTO 8 -IF p = 1 AND a$ = CHR$(13) THEN a1 = qw: p = 2 -IF a$ = "q" THEN END -IF a$ = "s" THEN a = a + 40 -IF a$ = "a" THEN a = a - 40 -IF a$ = "w" THEN b = b - 18 -IF a$ = "z" THEN b = b + 18 -IF a < 1 THEN a = 1 -IF b < 1 THEN b = 1 - -GOTO 7 -8 -kaik = 1 -LOCATE 3, 60 -PRINT a1; "-"; a2 -10 -REM K O N T R O L L -IF a1 = a2 + 19 AND nu(a1) = 0 AND nu(a2) = 3 THEN BEEP: SWAP nu(a1), nu(a2) -IF a1 = a2 + 21 AND nu(a1) = 0 AND nu(a2) = 3 THEN BEEP: SWAP nu(a1), nu(a2) -zxcv = 0 -IF a1 = a2 + 42 AND nu(a1) = 0 AND nu(a2) = 3 AND nu(a2 + 21) = 1 THEN BEEP: SWAP nu(a1), nu(a2): nu(a2 + 21) = 3: zxcv = 1 -IF a1 = a2 + 38 AND nu(a1) = 0 AND nu(a2) = 3 AND nu(a2 + 19) = 1 THEN BEEP: SWAP nu(a1), nu(a2): nu(a2 + 19) = 3: zxcv = 1 -IF a1 = a2 - 42 AND nu(a1) = 0 AND nu(a2) = 3 AND nu(a2 - 21) = 1 THEN BEEP: SWAP nu(a1), nu(a2): nu(a2 - 21) = 3: zxcv = 1 -IF a1 = a2 - 38 AND nu(a1) = 0 AND nu(a2) = 3 AND nu(a2 - 19) = 1 THEN BEEP: SWAP nu(a1), nu(a2): nu(a2 - 19) = 3: zxcv = 1 -asend -IF zxcv = 1 THEN look: IF looma = 1 THEN SOUND 1234, 1: p = 2: a1 = a2: GOTO 5 -6 -END SUB - +' Game of checkers. Created by Svjatoslav Agejenko in 1998. +' +' Usage: +' keys: w a z s - move around +' ENTER key - pick piece on the desk and place it to new location + +DECLARE SUB look () +DECLARE SUB motleb () +DECLARE SUB mang () +DECLARE SUB sisend () +DECLARE SUB asend () +DEFINT A-Z +DIM SHARED nu(-100 TO 300) AS INTEGER +DIM SHARED kaik AS INTEGER +DIM SHARED looma AS INTEGER +DIM SHARED hiir(1000) +DIM SHARED ax1, ax2 +SCREEN 2 +CLS +LINE (1, 1)-(10, 1) +LINE (1, 1)-(1, 5) +LINE (10, 1)-(6, 2) +LINE (6, 2)-(10, 4) +LINE (10, 4)-(8, 5) +LINE (8, 5)-(4, 3) +LINE (4, 3)-(1, 5) +PAINT (2, 2), 1 +GET (1, 1)-(10, 5), hiir +CLS +FOR a = 0 TO 10 + LINE ((a * 40) + 20, 10)-((a * 40) + 20, 189), 1 +NEXT a + +FOR a = 0 TO 20 + LINE (20, (a * 18) + 9)-(420, (a * 18) + 9), 1 +NEXT a + +FOR a = 1 TO 200 + nu(a) = 4 +NEXT a + +' Draw the initial checkerboard pattern +FOR a = 2 TO 10 STEP 2 + FOR b = 1 TO 10 STEP 2 + PAINT ((b * 40) + 5, (a * 18) + 5) + NEXT b +NEXT a + +FOR a = 1 TO 10 STEP 2 + FOR b = 2 TO 10 STEP 2 + PAINT ((b * 40) + 5, (a * 18) + 5) + NEXT b +NEXT a + +' Place the initial pieces on the board +FOR a = 2 TO 4 STEP 2 + FOR b = 1 TO 10 STEP 2 + nu(((a - 1) * 20) + b) = 1 + NEXT b +NEXT a + +FOR a = 1 TO 4 STEP 2 + FOR b = 2 TO 10 STEP 2 + nu(((a - 1) * 20) + b) = 1 + NEXT b +NEXT a + +FOR a = 8 TO 10 STEP 2 + FOR b = 1 TO 10 STEP 2 + nu(((a - 1) * 20) + b) = 0 + NEXT b +NEXT a + +FOR a = 7 TO 10 STEP 2 + FOR b = 2 TO 10 STEP 2 + nu(((a - 1) * 20) + b) = 0 + NEXT b +NEXT a + +FOR b = 2 TO 10 STEP 2 + nu(80 + b) = 3 +NEXT b + +FOR b = 1 TO 10 STEP 2 + nu(100 + b) = 3 +NEXT b + +asend +kaik = 1 +mang + +SUB asend + FOR b = 1 TO 10 + FOR a = 1 TO 10 + v = nu(((b - 1) * 20) + a) + SELECT CASE v + CASE 1 + CIRCLE (a * 40, b * 18), 17, 1 + PAINT (a * 40, b * 18), 1 + CIRCLE (a * 40, b * 18), 17, 0 + CIRCLE (a * 40, b * 18), 16, 0 + LINE ((a * 40) - 16, b * 18)-((a * 40) + 16, b * 18), 0 + CASE 0 + CIRCLE (a * 40, b * 18), 17, 0 + PAINT (a * 40, b * 18), 0 + CIRCLE (a * 40, b * 18), 17, 1 + CIRCLE (a * 40, b * 18), 15, 1 + CIRCLE (a * 40, b * 18), 3, 1 + CIRCLE (a * 40, b * 18), 7, 1 + LINE ((a * 40) - 16, b * 18)-((a * 40) + 16, b * 18), 0 + CASE 3 + PAINT (a * 40, b * 18), 1 + END SELECT + NEXT a + NEXT b +END SUB + +SUB look + looma = 0 + FOR a = 1 TO 200 + IF nu(a) = 0 AND nu(a - 21) = 1 AND nu(a - 42) = 3 THEN looma = 1 + IF nu(a) = 0 AND nu(a - 19) = 1 AND nu(a - 38) = 3 THEN looma = 1 + IF nu(a) = 0 AND nu(a + 21) = 1 AND nu(a + 42) = 3 THEN looma = 1 + IF nu(a) = 0 AND nu(a + 19) = 1 AND nu(a + 38) = 3 THEN looma = 1 + NEXT a +END SUB + +SUB mang + 4 + sisend + motleb + look + IF looma = 1 THEN SOUND 1234, 2 + GOTO 4 +END SUB + +SUB motleb +3 +REM T O P E L T L O O K +FOR a = 1 TO 200 + IF nu(a) = 1 AND nu(a + 21) = 0 AND nu(a + 42) = 3 AND nu(a + 61) = 0 AND nu(a + 80) = 3 THEN nu(a) = 3: nu(a + 21) = 3: nu(a + 42) = 1: kaik = 1: asend: GOTO 3 + IF nu(a) = 1 AND nu(a + 21) = 0 AND nu(a + 42) = 3 AND nu(a + 23) = 0 AND nu(a + 4) = 3 THEN nu(a) = 3: nu(a + 21) = 3: nu(a + 42) = 1: kaik = 1: asend: GOTO 3 + IF nu(a) = 1 AND nu(a + 19) = 0 AND nu(a + 38) = 3 AND nu(a + 59) = 0 AND nu(a + 80) = 3 THEN nu(a) = 3: nu(a + 19) = 3: nu(a + 38) = 1: kaik = 1: asend: GOTO 3 + IF nu(a) = 1 AND nu(a + 19) = 0 AND nu(a + 38) = 3 AND nu(a + 17) = 0 AND nu(a - 4) = 3 THEN nu(a) = 3: nu(a + 19) = 3: nu(a + 38) = 1: kaik = 1: asend: GOTO 3 + IF nu(a) = 1 AND nu(a + 21) = 0 AND nu(a + 42) = 3 AND nu(a + 63) = 0 AND nu(a + 84) = 3 THEN nu(a) = 3: nu(a + 21) = 3: nu(a + 42) = 1: kaik = 1: asend: GOTO 3 + IF nu(a) = 1 AND nu(a + 19) = 0 AND nu(a + 38) = 3 AND nu(a + 57) = 0 AND nu(a + 76) = 3 THEN nu(a) = 3: nu(a + 19) = 3: nu(a + 38) = 1: aiki = 1: asend: GOTO 3 + + IF nu(a) = 1 AND nu(a - 21) = 0 AND nu(a - 42) = 3 AND nu(a - 61) = 0 AND nu(a - 80) = 3 THEN nu(a) = 3: nu(a - 21) = 3: nu(a - 42) = 1: kaik = 1: asend: GOTO 3 + IF nu(a) = 1 AND nu(a - 21) = 0 AND nu(a - 42) = 3 AND nu(a - 23) = 0 AND nu(a - 4) = 3 THEN nu(a) = 3: nu(a - 21) = 3: nu(a - 42) = 1: kaik = 1: asend: GOTO 3 + IF nu(a) = 1 AND nu(a - 19) = 0 AND nu(a - 38) = 3 AND nu(a - 59) = 0 AND nu(a - 80) = 3 THEN nu(a) = 3: nu(a - 19) = 3: nu(a - 38) = 1: kaik = 1: asend: GOTO 3 + IF nu(a) = 1 AND nu(a - 19) = 0 AND nu(a - 38) = 3 AND nu(a - 17) = 0 AND nu(a + 4) = 3 THEN nu(a) = 3: nu(a - 19) = 3: nu(a - 38) = 1: kaik = 1: asend: GOTO 3 + IF nu(a) = 1 AND nu(a - 21) = 0 AND nu(a - 42) = 3 AND nu(a - 63) = 0 AND nu(a - 84) = 3 THEN nu(a) = 3: nu(a - 21) = 3: nu(a - 42) = 1: kaik = 1: asend: GOTO 3 + IF nu(a) = 1 AND nu(a - 19) = 0 AND nu(a - 38) = 3 AND nu(a - 57) = 0 AND nu(a - 76) = 3 THEN nu(a) = 3: nu(a - 19) = 3: nu(a - 38) = 1: aiki = 1: asend: GOTO 3 +NEXT a + +REM L I H T S A L T L O O K +FOR a = 1 TO 200 + IF nu(a) = 1 AND nu(a + 21) = 0 AND nu(a + 42) = 3 THEN nu(a) = 3: nu(a + 21) = 3: nu(a + 42) = 1: GOTO 2 + IF nu(a) = 1 AND nu(a + 19) = 0 AND nu(a + 38) = 3 THEN nu(a) = 3: nu(a + 19) = 3: nu(a + 38) = 1: GOTO 2 + IF nu(a) = 1 AND nu(a - 21) = 0 AND nu(a - 42) = 3 THEN nu(a) = 3: nu(a - 21) = 3: nu(a - 42) = 1: GOTO 2 + IF nu(a) = 1 AND nu(a - 19) = 0 AND nu(a - 38) = 3 THEN nu(a) = 3: nu(a - 19) = 3: nu(a - 38) = 1: GOTO 2 +NEXT a +REM K A I T S E B +FOR a = 1 TO 200 + IF nu(a) = 1 AND nu(a + 19) = 3 AND nu(a + 21) = 3 AND nu(a + 40) = 1 AND nu(a + 38) = 3 AND nu(a + 61) = 0 THEN nu(a) = 3: nu(a + 19) = 1: GOTO 2 + IF nu(a) = 1 AND nu(a + 19) = 3 AND nu(a + 21) = 0 AND nu(a + 40) = 1 AND nu(a + 38) = 3 AND nu(a + 61) = 0 THEN nu(a) = 3: nu(a + 19) = 1: GOTO 2 + IF nu(a) = 1 AND nu(a + 19) = 3 AND nu(a + 21) = 3 AND nu(a + 40) = 1 AND nu(a + 38) = 1 AND nu(a + 61) = 0 THEN nu(a) = 3: nu(a + 19) = 1: GOTO 2 + IF nu(a) = 1 AND nu(a + 19) = 3 AND nu(a + 21) = 0 AND nu(a + 40) = 1 AND nu(a + 38) = 1 AND nu(a + 61) = 0 THEN nu(a) = 3: nu(a + 19) = 1: GOTO 2 + + IF nu(a - 2) = 1 AND nu(a + 19) = 3 AND nu(a) = 3 AND nu(a + 40) = 1 AND nu(a + 38) = 3 AND nu(a + 61) = 0 THEN nu(a - 2) = 3: nu(a + 19) = 1: GOTO 2 + IF nu(a - 2) = 1 AND nu(a + 19) = 3 AND nu(a) = 1 AND nu(a + 40) = 1 AND nu(a + 38) = 3 AND nu(a + 61) = 0 THEN nu(a - 2) = 3: nu(a + 19) = 1: GOTO 2 + IF nu(a - 2) = 1 AND nu(a + 19) = 3 AND nu(a) = 3 AND nu(a + 40) = 1 AND nu(a + 38) = 1 AND nu(a + 61) = 0 THEN nu(a - 2) = 3: nu(a + 19) = 1: GOTO 2 + IF nu(a - 2) = 1 AND nu(a + 19) = 3 AND nu(a) = 1 AND nu(a + 40) = 1 AND nu(a + 38) = 1 AND nu(a + 61) = 0 THEN nu(a - 2) = 3: nu(a + 19) = 1: GOTO 2 +NEXT a +REM L A H E B N U R K A +FOR a = 1 TO 200 + IF nu(a) = 1 AND nu(a + 2) = 4 AND nu(a + 21) = 3 THEN nu(a) = 3: nu(a + 21) = 1: GOTO 2 + IF nu(a) = 1 AND nu(a - 2) = 4 AND nu(a + 19) = 3 THEN nu(a) = 3: nu(a + 19) = 1: GOTO 2 +NEXT a +REM O H U T U K A I K +FOR a = 1 TO 200 + IF nu(a) = 1 AND nu(a + 19) = 3 AND nu(a + 38) = 3 AND nu(a + 40) = 3 THEN nu(a) = 3: nu(a + 19) = 1: GOTO 2 + IF nu(a) = 1 AND nu(a + 21) = 3 AND nu(a + 42) = 3 AND nu(a + 40) = 3 THEN nu(a) = 3: nu(a + 21) = 1: GOTO 2 + + IF nu(a) = 1 AND nu(a + 19) = 3 AND nu(a + 38) = 1 AND nu(a + 40) = 3 THEN nu(a) = 3: nu(a + 19) = 1: GOTO 2 + IF nu(a) = 1 AND nu(a + 21) = 3 AND nu(a + 42) = 1 AND nu(a + 40) = 3 THEN nu(a) = 3: nu(a + 21) = 1: GOTO 2 + + IF nu(a) = 1 AND nu(a + 19) = 3 AND nu(a + 38) = 3 AND nu(a + 40) = 1 THEN nu(a) = 3: nu(a + 19) = 1: GOTO 2 + IF nu(a) = 1 AND nu(a + 21) = 3 AND nu(a + 42) = 3 AND nu(a + 40) = 1 THEN nu(a) = 3: nu(a + 21) = 1: GOTO 2 + + IF nu(a) = 1 AND nu(a + 19) = 3 AND nu(a + 38) = 1 AND nu(a + 40) = 1 THEN nu(a) = 3: nu(a + 19) = 1: GOTO 2 + IF nu(a) = 1 AND nu(a + 21) = 3 AND nu(a + 42) = 1 AND nu(a + 40) = 1 THEN nu(a) = 3: nu(a + 21) = 1: GOTO 2 +NEXT a +REM M O T T E T U K A I K +FOR a = 1 TO 200 + IF nu(a) = 1 AND nu(a + 21) = 3 THEN nu(a) = 3: nu(a + 21) = 1: GOTO 2 + IF nu(a) = 1 AND nu(a + 19) = 3 THEN nu(a) = 3: nu(a + 19) = 1: GOTO 2 +NEXT a +LOCATE 4, 5 +PRINT " S I N U V O I T" +END +GOTO 3 +2 +asend +9 +END SUB + +SUB sisend + DIM asdf(1000) + + p = 1 + + 5 + a = ax1 + b = ax2 + + 7 + IF p = 1 THEN + LOCATE 1, 70 + PRINT "Kust !" + END IF + IF p = 2 THEN + LOCATE 1, 70 + PRINT "kuhu !" + END IF + + LOCATE 2, 60 + + qw = (((b \ 18) - 1) * 20) + (a \ 40) + PRINT qw + + GET (a, b)-(a + 10, b + 10), asdf + PUT (a, b), hiir, PSET + + a$ = INPUT$(1) + PUT (a, b), asdf, PSET + + IF p = 2 AND a$ = CHR$(13) THEN + a2 = qw + ax1 = a + ax2 = b + GOTO 8 + END IF + IF p = 1 AND a$ = CHR$(13) THEN + a1 = qw + p = 2 + END IF + + IF a$ = "q" THEN + END + END IF + IF a$ = "s" THEN + a = a + 40 + END IF + IF a$ = "a" THEN + a = a - 40 + END IF + IF a$ = "w" THEN + b = b - 18 + END IF + IF a$ = "z" THEN + b = b + 18 + END IF + + IF a < 1 THEN + a = 1 + END IF + + IF b < 1 THEN + b = 1 + END IF + + GOTO 7 + + 8 + kaik = 1 + + LOCATE 3, 60 + + PRINT a1; "-"; a2 + + 10 + ' K O N T R O L L + IF a1 = a2 + 19 AND nu(a1) = 0 AND nu(a2) = 3 THEN + BEEP + SWAP nu(a1), nu(a2) + END IF + IF a1 = a2 + 21 AND nu(a1) = 0 AND nu(a2) = 3 THEN + BEEP + SWAP nu(a1), nu(a2) + END IF + + zxcv = 0 + + IF a1 = a2 + 42 AND nu(a1) = 0 AND nu(a2) = 3 AND nu(a2 + 21) = 1 THEN + BEEP + SWAP nu(a1), nu(a2) + nu(a2 + 21) = 3 + zxcv = 1 + END IF + IF a1 = a2 + 38 AND nu(a1) = 0 AND nu(a2) = 3 AND nu(a2 + 19) = 1 THEN + BEEP + SWAP nu(a1), nu(a2) + nu(a2 + 19) = 3 + zxcv = 1 + END IF + IF a1 = a2 - 42 AND nu(a1) = 0 AND nu(a2) = 3 AND nu(a2 - 21) = 1 THEN + BEEP + SWAP nu(a1), nu(a2) + nu(a2 - 21) = 3 + zxcv = 1 + END IF + IF a1 = a2 - 38 AND nu(a1) = 0 AND nu(a2) = 3 AND nu(a2 - 19) = 1 THEN + BEEP + SWAP nu(a1), nu(a2) + nu(a2 - 19) = 3 + zxcv = 1 + END IF + + asend + + IF zxcv = 1 THEN + look + IF looma = 1 THEN + SOUND 1234, 1 + p = 2 + a1 = a2 + GOTO 5 + END IF + END IF + + 6 +END SUB