'=========================================================================== ' Subject: BALL PATTERN USING XOR Date: Unknown Date (00:00:00) ' Author: Scott Bailey Code: QB, QBasic ' Keys: BALL,PATTERN,XOR Packet: EGAVGA.ABC '=========================================================================== 'BALLPTRN.BAS by Scott Bailey 'public domain 'draws patterns by XORing the ball bouncing off the walls 'hitting the spacebar starts a different pattern DEFINT A-Z RANDOMIZE TIMER SCREEN 12 CLS CIRCLE (10, 10), 2, 3 CIRCLE (10, 10), 1, 9 DIM fly(0 TO 19) GET (7, 7)-(12, 12), fly restart: CLS FOR h = 0 TO 639 STEP 10 LINE (0, h)-(639, h), 4 LINE (h, 0)-(h, 479), 4 NEXT LINE (0, 0)-(639, 479), 4, B direction = INT(RND * 4) + 1 x = RND * 300 + 10 y = RND * 460 + 10 DO a$ = INKEY$ IF a$ = CHR$(27) THEN END IF a$ = " " THEN GOTO restart SELECT CASE direction CASE 1 x = x + 4 y = y - 4 CASE 2 y = y + 4 x = x + 4 CASE 3 x = x - 4 y = y + 4 CASE 4 x = x - 4 y = y - 4 END SELECT IF x > 620 OR x < 20 OR y > 460 OR y < 20 THEN SELECT CASE direction CASE 1 direction = 2 CASE 2 direction = 3 CASE 3 direction = 4 CASE 4 direction = 1 END SELECT END IF PUT (x, y), fly LOOP