Advertisement
LBASIC

12HPSET.BAS

Jun 5th, 2023
637
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
QBasic 0.72 KB | Source Code | 0 0
  1. DECLARE SUB testpattern (d%)
  2. SCREEN 12
  3. DO
  4.   k$ = INKEY$
  5.   IF k$ > "" THEN EXIT DO
  6.   testpattern INT(RND * 30 + 1)
  7.   SLEEP 2
  8. LOOP
  9. SCREEN 0: WIDTH 80, 25
  10.  
  11. SUB testpattern (d%)
  12.   DIM Lft AS INTEGER, Rgt AS INTEGER
  13.   DIM Top AS INTEGER, Bot AS INTEGER
  14.   Lft = 160: Rgt = 479: Top = 120: Bot = 360
  15.   DIM x(Lft TO Rgt) AS LONG, y(Top TO Bot) AS LONG
  16.   FOR t% = Lft TO Rgt: x(t%) = t%: NEXT
  17.   FOR t% = Top TO Bot: y(t%) = t%: NEXT
  18.   FOR t% = 0 TO 3000
  19.     SWAP x((t% MOD 320) + Lft), x(RND * 200 + Lft)
  20.     SWAP y((t% MOD 240) + Top), y(RND * 200 + Top)
  21.   NEXT
  22.   FOR v% = Top TO Bot
  23.     FOR h% = Lft TO Rgt
  24.       PSET (x(h%), y(v%)), ((x(h%) * y(v%) \ d%) AND 15)
  25.       IF INKEY$ > "" THEN EXIT SUB
  26.     NEXT
  27.   NEXT
  28. END SUB
Tags: qbasic
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement