First graphic program... congratulate me...

Discuss whatever you want here--both QB and non-QB related. Anything from the DEF INT command to the meaning of life!

Moderators: Pete, Mods

Post Reply
Patz QuickBASIC Creations
Veteran
Posts: 399
Joined: Wed Mar 02, 2005 9:01 pm
Location: Nashville, Tennessee
Contact:

First graphic program... congratulate me...

Post by Patz QuickBASIC Creations »

This is one of those inkblot tests that psychiatrists give you to find out if you are crazy. (If you're a programmer, then doesn't that qualify enough? :wink: )

Note: Make sure your BREAK works! (ex DOSBox under Linux doesn't!) There seems to be an error! (read below the code)

Code: Select all

RANDOMIZE TIMER
SCREEN 9
WINDOW (-320, -175)-(319, 174)
Pxls% = (INT(RND * 5) + 1) * 50
Y = 0: X = 0
Colr% = INT(RND * 15) + 1
DO
FOR Count% = 1 TO Pxls%
 Direct% = INT(RND * 4) + 1
 SELECT CASE Direct%
  CASE 1
   Y = Y + 1
   X = X + 1
  CASE 2
   Y = Y + 1
   X = X - 1
  CASE 3
   Y = Y - 1
   X = X + 1
  CASE 4
   Y = Y - 1
   X = X - 1
  END SELECT
 PSET (X, Y), Colr%
 PSET (-X, Y), Colr%
 IF Key$ = "" THEN Key$ = INKEY$: EXIT FOR
NEXT Count%
Waiter! = TIMER + 5
DO
 IF Key$ = "" THEN Key$ = INKEY$
LOOP UNTIL Waiter! > TIMER OR Key$ <> ""
LOOP UNTIL Key$ <> ""
Tell me if it's just this crappy computer at school (W2K on an old Compaq), or my mistake in programming, but it seems like the FOR loop doesn't increment. Running through the code in my head, it seems right. Oh well. That's my first graphic program in a nutshell.
sid6.7
Veteran
Posts: 318
Joined: Tue Jun 21, 2005 8:51 am
Location: west USA
Contact:

Post by sid6.7 »

neat program...good job....
Post Reply