Page 1 of 1

First graphic program... congratulate me...

Posted: Mon Dec 18, 2006 3:29 pm
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.

Posted: Mon Dec 18, 2006 6:45 pm
by sid6.7
neat program...good job....