hscool ONLINE: QPiton Sutra
'QPiton.BAS hscool sutra
DEFINT A-Z: CONST MX = 80, MY = 25: DIM PX(255), PY(255), S(MX, MY)
DECLARE SUB PutFood () : CLS : X = (MX + 1) / 2: Y = (MY - 1) / 2: C = 32
PX(0) = 2: PY(0) = 2: S(2, 2) = 1: dX = 1
LOCATE Y, X - 4, 0: PRINT "P I"
FOR I = 2 TO MY - 1: LOCATE 1 + MY - I, 1: PRINT "³";
LOCATE I, MX: PRINT "³";
S(1, I) = 2: S(MX, I) = 2
NEXT
LOCATE Y, X: PRINT "T O"
FOR I = 2 TO MX - 1: LOCATE 1, I: PRINT "Ä"
LOCATE MY, 1 + MX - I: PRINT "Ä";
S(I, 1) = 2: S(I, MY) = 2
NEXT
LOCATE Y, X + 4: X = (MX - 19) / 2: PRINT "N"
WHILE " " <> INKEY$
LOCATE Y + 2, X: PRINT "P R E S S S P A C E"
LOCATE Y + 2, X: PRINT SPC(21);
WEND
LOCATE Y, X: PRINT SPC(15); : PutFood
DO
T! = TIMER: LOCATE PY(PH), PX(PH): PRINT "0";
I = 255 AND (PH + 1): PX(I) = PX(PH) + dX: PY(I) = PY(PH) + dY
IF S(PX(I), PY(I)) THEN EXIT DO ELSE IF X = PX(I) AND Y = PY(I) THEN PutFood
LOCATE PY(I), PX(I): PRINT "1"; : S(PX(I), PY(I)) = 1: PH = I
IF dT THEN
dT = 0: LOCATE MY, 5
PRINT C; "="; HEX$(C); "h*"; 255 AND (PH - PT);
ELSE
LOCATE PY(PT), PX(PT): PRINT " ";
S(PX(PT), PY(PT)) = 0: PT = 255 AND (PT + 1)
END IF
I = INSTR(" KHPM", RIGHT$(INKEY$, 1))
IF I > 1 THEN dX = FIX(I - 3.5): dY = 2 * I - 7 - 3 * dX
WHILE 1.5 / MY > TIMER - T!: WEND
LOOP
LOCATE (MY + 1) / 2, (MX - 21) / 2: PRINT " G A M E 0 V E R "
LOCATE PY(I), PX(I), 1, 0, 31
DO
K$ = INPUT$(1): IF " " = K$ THEN RUN
LOOP UNTIL K$ = CHR$(27)
SUB PutFood
SHARED X, Y, S(), C, dT
DO
X = 2 + (MX - 3) * RND: Y = 2 + (MY - 3) * RND
LOOP WHILE S(X, Y)
C = 33 + (C - 32) MOD 223: LOCATE Y, X: PRINT CHR$(C); : dT = 1
END SUB
:
hscool@netclub.ru