Here's very simple program generating unpredictable effect

The idea is simple:
1) put some worm in center of the screen
2) increase color value (grey intensity in this case) on this point
3) take new worm direction from table
4) move worm to new location
5) repeat the algorithm
the table (program) has 2 dimension dim(255, 7) and it stores worm directions 0 up, 1 up-right, 2 right, 3 down-right etc..
so for every color value and current worm direction we can establish new direction
but to find out equation that generates some nic-looking effect is not so easy

There are 5 effects currently (key 1 - 5)
+ Code SnippetRem Project: Unpredictable Worm
Rem Created: 2003-10-13 12:07:39
Rem By Mariusz Skowroński
Rem ***** Main Source File *****
set display mode 640, 480, 16
sync on: sync rate 0
global g_xPos as integer
global g_yPos as integer
global g_dir as integer
global g_bmpWidth as integer
global g_bmpHeight as integer
global dim g_program(255, 7) as integer
global g_scrPtr as dword
global g_addr as dword
rem I use this becouse my demo version of DBP has DarkBasic logo which couses some artifacts
g_bmpWidth = 500
g_bmpHeight = 400
rem this is set here only for cleariance
g_xPos = g_bmpWidth >> 1
g_yPos = g_bmpHeight >> 1
g_dir = 0
g_scrPtr = 0
g_addr = 0
rem use 1st efect
CreateWormProgram(1)
rem start
local char as string
local i as integer
rem main loop
do
lock backbuffer
g_scrPtr = get backbuffer ptr()
rem update screen every 200 iterations
for i = 0 to 200
g_addr = g_scrPtr + (g_yPos * screen width() + g_xPos)*4
color = rgbr(*g_addr)
g_dir = g_program(color, g_dir)
inc color, 4
*g_addr = (color << 16) || (color << 8) || (color)
select g_dir
case 0 : dec g_yPos: endcase : rem up
case 1 : dec g_yPos: inc g_xPos: endcase : rem up right
case 2 : inc g_xPos: endcase : rem right
case 3 : inc g_yPos: inc g_xPos: endcase : rem right down
case 4 : inc g_yPos: endcase : rem down
case 5 : inc g_yPos: dec g_xPos: endcase : rem down left
case 6 : dec g_xPos: endcase : rem left
case 7 : dec g_yPos: dec g_xPos: endcase : rem left up
endselect
if g_xPos < 0 then g_xPos = g_bmpWidth-1
if g_xPos >= g_bmpWidth then g_xPos = 0
if g_yPos < 0 then g_yPos = g_bmpHeight-1
if g_yPos >= g_bmpHeight then g_yPos = 0
next i
unlock backbuffer
sync
char = inkey$()
select char
case "1": CreateWormProgram(1): endcase
case "2": CreateWormProgram(2): endcase
case "3": CreateWormProgram(3): endcase
case "4": CreateWormProgram(4): endcase
case "5": CreateWormProgram(5): endcase
endselect
loop
end
rem currently available 5 programms
function CreateWormProgram(program as integer)
local color, d as integer
randomize 100
for color = 0 to 255
for d = 0 to 7
select program
rem program 1
case 1: g_program(color, d) = int(rnd(7)): endcase
rem program 2
case 2: g_program(color, d) = int(sqrt(color*color)+d) mod 8 : endcase
rem program 3
case 3: g_program(color, d) = int(sqrt(color*color)-sqrt(color)+d) mod 8 : endcase
rem program 4
case 4: g_program(color, d) = int((color*color)/d +d) mod 8 : endcase
rem program 5
case 5: g_program(color, d) = int((color*color/10)+(d*d)+d) mod 8: endcase
case default: g_program(color, d) = int(rnd(7)): endcase
endselect
next d
next r
g_xPos = g_bmpWidth >> 1
g_yPos = g_bmpHeight >> 1
g_dir = 0
cls
endfunction
there is function CreateWormProgram() which 'controls' worm behavior. there you can add your own equations.
please if you'll find out some nic-looking effect snipp it here

P.S. sorry for my english. if dont understand somethig ask, and i'll try to answer as far as I can