The program simply generates random points and moves them around the screen, bouncing off the edges as they go; connecting points into different shapes of various colour. Run the program and you will see a moving modern art display on your screen. Click the mouse to reset to a new initial configuration.
Rubbish! |
Call THAT artwork? |
No, not really, but it is a fun project and there is plenty to tweak in the code below. |
BB4Win Source code below:
REM modern art is rubbish
REM T Street
REM 2015-11-26
MODE 12:OFF
SW_MAXIMIZE = 3
SYS "ShowWindow", @hwnd%, SW_MAXIMIZE
VDU 26
NUM% = 300
_WIDTH% = 1920
_HEIGHT% = 1640
MAX_SPEED% = 100
_CHANGE_RATE% = 12
DIM point{(NUM%) x, y, dx, dy, pmode%, tmode%, cmode% }
REPEAT
PROC_createPoints( point{()} )
REPEAT
PROC_movePoints( point{()} )
PROC_drawPoints( point{()} )
WAIT 1
MOUSE x%, y%, click%
UNTIL click% = 4 OR click% = 1
UNTIL FALSE
DEFPROC_drawPoints( point{()} )
LOCAL i%
*refresh off
CLS
FOR i% = 0 TO NUM%
GCOL point{(i%)}.tmode%, point{(i%)}.cmode%
PLOT point{(i%)}.pmode%, point{(i%)}.x, point{(i%)}.y
NEXT
*refresh on
*refresh
ENDPROC
DEFPROC_createPoints( point{()} )
LOCAL i%
FOR i% = 0 TO NUM%
point{(i%)}.x = RND(_WIDTH%)
point{(i%)}.y = RND(_HEIGHT%)
point{(i%)}.dx = RND(MAX_SPEED%)-(MAX_SPEED% DIV 2)
point{(i%)}.dy = RND(MAX_SPEED%)-(MAX_SPEED% DIV 2)
point{(i%)}.pmode% = RND(254)
point{(i%)}.tmode% = RND(5)-1
point{(i%)}.cmode% = RND(17)-1
NEXT
ENDPROC
DEFPROC_movePoints( point{()} )
LOCAL i%
FOR i% = 0 TO NUM%
IF point{(i%)}.x + point{(i%)}.dx >= _WIDTH% OR point{(i%)}.x + point{(i%)}.dx<=0 THEN
point{(i%)}.dx = point{(i%)}.dx *-1
ELSE
point{(i%)}.x += point{(i%)}.dx
ENDIF
IF point{(i%)}.y + point{(i%)}.dy >= _HEIGHT% OR point{(i%)}.y + point{(i%)}.dy<=0 THEN
point{(i%)}.dy = point{(i%)}.dy *-1
ELSE
point{(i%)}.y += point{(i%)}.dy
ENDIF
IF NOT(-SGN(RND(_CHANGE_RATE%) MOD _CHANGE_RATE%)) point{(i%)}.tmode% -= 1
IF point{(i%)}.tmode% < 0 point{(i%)}.tmode% = 5
IF NOT(-SGN(RND(_CHANGE_RATE%*100) MOD (_CHANGE_RATE%*100))) point{(i%)}.pmode% -= 1
IF point{(i%)}.pmode% <= 0 point{(i%)}.pmode% = 254
NEXT
ENDPROC