



I find them sort of interesting so I'd post.
Code: Select all
Strict
SeedRnd(MilliSecs())
Global points:TList = New TList
Type point
Field x:Int, y:Int
End Type
Function distance:Int(x:Int, y:Int, x2:Int, y2:Int)
Return Sqr(((x2 - x) * (x2 - x)) + ((y2 - y) * (y2 - y)))
End Function
rem
Function distance:Int(x:Int, y:Int, x2:Int, y2:Int)
Return Sin(Sqr(((x2 - x) * (x2 - x)) + ((y2 - y) * (y2 - y)))) * 1000
End Function
Function distance:Int(x:Int, y:Int, x2:Int, y2:Int)
Return atan(Sqr(((x2 - x) * (x2 - x)) + ((y2 - y) * (y2 - y)))) * 1000
End Function
Function distance:Int(x:Int, y:Int, x2:Int, y2:Int)
Return cos(Sqr(((x2 - x) * (x2 - x)) + ((y2 - y) * (y2 - y)))) * 1000
End Function
Function distance:Int(x:Int, y:Int, x2:Int, y2:Int)
Return tan(Sqr(((x2 - x) * (x2 - x)) + ((y2 - y) * (y2 - y)))) * 1000
End Function
endrem
Function average_distance(x:Int, y:Int)
Local d:Int = 1000000
For Local P:point = EachIn(points)
Local dd:Int = distance(x, y, p.x, p.y)
If dd < d
d = dd
EndIf
Next
Return d
End Function
Graphics 640, 480
Local m:Float = MilliSecs()
For Local i:Int = 0 To 0
Local P:point = New point
p.x = Rand(640)
p.y = Rand(480)
ListAddLast(points, p)
Next
Local cc:Float
For Local x:Int = 0 To 639
For Local y:Int = 0 To 479
Local ad:Int = average_distance(x, y)
If ad Mod 3 = 0
cc = Abs(Sin(ad * 4))
SetColor(cc * 255, cc * 255, 255 - cc * 255)
Plot(x, y)
EndIf
Next
Next
Notify(String(MilliSecs() - m))
Flip
WaitKey()