Skip to main content
deleted 77 characters in body
Source Link
nimi
  • 36k
  • 4
  • 35
  • 100

Haskell, 781781 733 Bytes

import System.Environment;import System.Random;import Graphics.GD
rD=round;fI=fromIntegral;cM=concatMap;q=0d=round;e=fromIntegral;h=concatMap;q=0.2588
mainj =a(x,y)=[(x,y),(d$c*e dox-s*e y,d$s*e x+c*e y)] where c=cos$pi/a;s=sin$pi/a
go s f w p@(x,y)((m,n):o)|x<1=go s f w(s,0)o|abs(e$y+n)>q*e x=go s f w p o|elem(x-m,y+n)f&&(v*z-z)*(b-q*z)-(-v*q*z-q*z)*(a-z)<0=p:go s(p:f)w(s,0)o|1<2=go s f w(x-m,y+n)o where z=e s;a=e x;b=e y;v=e w/100
main = do 
 k<-getArgs;g<-getStdGen;let(s:p:w:_)=map read k 
    i<-newImage(2*s,2*s)
    let;let t=cMt=h(j 3)$cM$h(\(x,y)->[(x,y),(rD$0d$0.866*fI866*e x+0.5*fI5*e y,
        rD$0d$0.5*fI5*e x-0.866*fI866*e y)])$take(s*rDs*d(q*fIq*e s)*p`div`100)$go s
        [s[(0,0)]w(s,0)$map(\r->((1+r)`mod`2,r))(randomRs(-1,1)g)
    mapM(\(x,y)->setPixel(x+s,y+s)(rgb 255 255 255)i)
        ((cMh(j(-3/2))t)++(cMh(j(3/2))t))
    savePngFile;savePngFile "o.png" i
j a(x,y)=[(x,y),(rD$c*fI x-s*fI y,rD$s*fI x+c*fI y)] where c=cos$pi/a;s=sin$pi/a
go s f w p@(x,y)((m,n):o)
    |x<1=go s f w(s,0)o
    |abs(fI$y+n)>q*fI x=go s f w p o
    |elem(x-m,y+n)f&&(v*z-z)*(b-q*z)-(-v*q*z-q*z)*(a-z)<0=p:go s(p:f)w(s,0)o
    |True=go s f w(x-m,y+n)o
    where z=fI s;a=fI x;b=fI y;v=fI w/100

Haskell, 781 Bytes

import System.Environment;import System.Random;import Graphics.GD
rD=round;fI=fromIntegral;cM=concatMap;q=0.2588
main = do
    k<-getArgs;g<-getStdGen;let(s:p:w:_)=map read k 
    i<-newImage(2*s,2*s)
    let t=cM(j 3)$cM(\(x,y)->[(x,y),(rD$0.866*fI x+0.5*fI y,
        rD$0.5*fI x-0.866*fI y)])$take(s*rD(q*fI s)*p`div`100)$go s
        [(0,0)]w(s,0)$map(\r->((1+r)`mod`2,r))(randomRs(-1,1)g)
    mapM(\(x,y)->setPixel(x+s,y+s)(rgb 255 255 255)i)
        ((cM(j(-3/2))t)++(cM(j(3/2))t))
    savePngFile "o.png" i
j a(x,y)=[(x,y),(rD$c*fI x-s*fI y,rD$s*fI x+c*fI y)] where c=cos$pi/a;s=sin$pi/a
go s f w p@(x,y)((m,n):o)
    |x<1=go s f w(s,0)o
    |abs(fI$y+n)>q*fI x=go s f w p o
    |elem(x-m,y+n)f&&(v*z-z)*(b-q*z)-(-v*q*z-q*z)*(a-z)<0=p:go s(p:f)w(s,0)o
    |True=go s f w(x-m,y+n)o
    where z=fI s;a=fI x;b=fI y;v=fI w/100

Haskell, 781 733 Bytes

import System.Environment;import System.Random;import Graphics.GD
d=round;e=fromIntegral;h=concatMap;q=0.2588
j a(x,y)=[(x,y),(d$c*e x-s*e y,d$s*e x+c*e y)] where c=cos$pi/a;s=sin$pi/a
go s f w p@(x,y)((m,n):o)|x<1=go s f w(s,0)o|abs(e$y+n)>q*e x=go s f w p o|elem(x-m,y+n)f&&(v*z-z)*(b-q*z)-(-v*q*z-q*z)*(a-z)<0=p:go s(p:f)w(s,0)o|1<2=go s f w(x-m,y+n)o where z=e s;a=e x;b=e y;v=e w/100
main = do 
 k<-getArgs;g<-getStdGen;let(s:p:w:_)=map read k
 i<-newImage(2*s,2*s);let t=h(j 3)$h(\(x,y)->[(x,y),(d$0.866*e x+0.5*e y,d$0.5*e x-0.866*e y)])$take(s*d(q*e s)*p`div`100)$go s[(0,0)]w(s,0)$map(\r->((1+r)`mod`2,r))(randomRs(-1,1)g)
 mapM(\(x,y)->setPixel(x+s,y+s)(rgb 255 255 255)i)((h(j(-3/2))t)++(h(j(3/2))t));savePngFile "o.png" i
added 1 character in body
Source Link
nimi
  • 36k
  • 4
  • 35
  • 100

Haskell, 781 Bytes

The program features the „specify the ratio of the lengths of the sides of the wedge“ option, so you have to call it with three command line arguments:

./sf 150 50 40

Argument #1 is the size of the image, #2 the % of pixels in the wedge and #3 the length (in %) of the shorter side of the wedge. The image is saved in a file called „o.png“.

150-50-40: 150-50-40

My program produces snowflakes with cut-off spikes, because new pixels start on the middle axis of the wedge (green dot, see below) and tend to stay there, because they move equally random to the left, up or down. As pixels outside the wedge are discarded, straight lines appear on the boundary of the wedge (green arrow). I was too lazy to try out other paths for the pixels.

150-50-40: 150-40-40e

When the wedge is big enough (3rd argument 100) the spikes on the middle axis can grow and then there are 12 of them.

150-40-100: 150-40-100

Few pixels make round shapes (left: 150-5-20; right 150-20-90).

150-5-20 150-20-90

The program:

import System.Environment;import System.Random;import Graphics.GD
rD=round;fI=fromIntegral;cM=concatMap;q=0.2588
main = do
    k<-getArgs;g<-getStdGen;let(s:p:w:_)=map read k 
    i<-newImage(2*s,2*s)
    let t=cM(j 3)$cM(\(x,y)->[(x,y),(rD$0.866*fI x+0.5*fI y,
        rD$0.5*fI x-0.866*fI y)])$take(s*rD(q*fI s)*p`div`100)$go s
        [(0,0)]w(s,0)$map(\r->((1+r)`mod`2,r))(randomRs(-1,1)g)
    mapM(\(x,y)->setPixel(x+s,y+s)(rgb 255 255 255)i)
        ((cM(j(-3/2))t)++(cM(j(3/2))t))
    savePngFile "o.png" i
j a(x,y)=[(x,y),(rD$c*fI x-s*fI y,rD$s*fI x+c*fI y)] where c=cos$pi/a;s=sin$pi/a
go s f w p@(x,y)((m,n):o)
    |x<1=go s f w(s,0)o
    |abs(fI$y+n)>q*fI x=go s f w p o
    |elem(x-m,y+n)f&&(v*z-z)*(b-q*z)-(-v*q*z-q*z)*(a-z)<0=p:go s(p:f)w(s,0)o
    |True=go s f w(x-m,y+n)o
    where z=fI s;a=fI x;b=fI y;v=fI w/100

Haskell, 781 Bytes

The program features the „specify the ratio of the lengths of the sides of the wedge“ option, so you have to call it with three command line arguments:

./sf 150 50 40

Argument #1 is the size of the image, #2 the % of pixels in the wedge and #3 the length (in %) of the shorter side of the wedge. The image is saved in a file called „o.png“.

150-50-40: 150-50-40

My program produces snowflakes with cut-off spikes, because new pixels start on the middle axis of the wedge (green dot, see below) and tend to stay there, because they move equally random to the left, up or down. As pixels outside the wedge are discarded, straight lines appear on the boundary of the wedge (green arrow). I was too lazy to try out other paths for the pixels.

150-50-40: 150-40-40e

When the wedge is big enough (3rd argument 100) the spikes on the middle axis can grow and then there are 12 of them.

150-40-100: 150-40-100

Few pixels make round shapes (left: 150-5-20; right 150-20-90).

150-5-20 150-20-90

The program:

import System.Environment;import System.Random;import Graphics.GD
rD=round;fI=fromIntegral;cM=concatMap;q=0.2588
main = do
k<-getArgs;g<-getStdGen;let(s:p:w:_)=map read k 
    i<-newImage(2*s,2*s)
    let t=cM(j 3)$cM(\(x,y)->[(x,y),(rD$0.866*fI x+0.5*fI y,
        rD$0.5*fI x-0.866*fI y)])$take(s*rD(q*fI s)*p`div`100)$go s
        [(0,0)]w(s,0)$map(\r->((1+r)`mod`2,r))(randomRs(-1,1)g)
    mapM(\(x,y)->setPixel(x+s,y+s)(rgb 255 255 255)i)
        ((cM(j(-3/2))t)++(cM(j(3/2))t))
    savePngFile "o.png" i
j a(x,y)=[(x,y),(rD$c*fI x-s*fI y,rD$s*fI x+c*fI y)] where c=cos$pi/a;s=sin$pi/a
go s f w p@(x,y)((m,n):o)
    |x<1=go s f w(s,0)o
    |abs(fI$y+n)>q*fI x=go s f w p o
    |elem(x-m,y+n)f&&(v*z-z)*(b-q*z)-(-v*q*z-q*z)*(a-z)<0=p:go s(p:f)w(s,0)o
    |True=go s f w(x-m,y+n)o
    where z=fI s;a=fI x;b=fI y;v=fI w/100

Haskell, 781 Bytes

The program features the „specify the ratio of the lengths of the sides of the wedge“ option, so you have to call it with three command line arguments:

./sf 150 50 40

Argument #1 is the size of the image, #2 the % of pixels in the wedge and #3 the length (in %) of the shorter side of the wedge. The image is saved in a file called „o.png“.

150-50-40: 150-50-40

My program produces snowflakes with cut-off spikes, because new pixels start on the middle axis of the wedge (green dot, see below) and tend to stay there, because they move equally random to the left, up or down. As pixels outside the wedge are discarded, straight lines appear on the boundary of the wedge (green arrow). I was too lazy to try out other paths for the pixels.

150-50-40: 150-40-40e

When the wedge is big enough (3rd argument 100) the spikes on the middle axis can grow and then there are 12 of them.

150-40-100: 150-40-100

Few pixels make round shapes (left: 150-5-20; right 150-20-90).

150-5-20 150-20-90

The program:

import System.Environment;import System.Random;import Graphics.GD
rD=round;fI=fromIntegral;cM=concatMap;q=0.2588
main = do
    k<-getArgs;g<-getStdGen;let(s:p:w:_)=map read k 
    i<-newImage(2*s,2*s)
    let t=cM(j 3)$cM(\(x,y)->[(x,y),(rD$0.866*fI x+0.5*fI y,
        rD$0.5*fI x-0.866*fI y)])$take(s*rD(q*fI s)*p`div`100)$go s
        [(0,0)]w(s,0)$map(\r->((1+r)`mod`2,r))(randomRs(-1,1)g)
    mapM(\(x,y)->setPixel(x+s,y+s)(rgb 255 255 255)i)
        ((cM(j(-3/2))t)++(cM(j(3/2))t))
    savePngFile "o.png" i
j a(x,y)=[(x,y),(rD$c*fI x-s*fI y,rD$s*fI x+c*fI y)] where c=cos$pi/a;s=sin$pi/a
go s f w p@(x,y)((m,n):o)
    |x<1=go s f w(s,0)o
    |abs(fI$y+n)>q*fI x=go s f w p o
    |elem(x-m,y+n)f&&(v*z-z)*(b-q*z)-(-v*q*z-q*z)*(a-z)<0=p:go s(p:f)w(s,0)o
    |True=go s f w(x-m,y+n)o
    where z=fI s;a=fI x;b=fI y;v=fI w/100
deleted 61 characters in body
Source Link
nimi
  • 36k
  • 4
  • 35
  • 100

Haskell, 781 Bytes

The program features the „specify the ratio of the lengths of the sides of the wedge“ option, so you have to call it with three command line arguments:

./sf 150 50 40

Argument #1 is the size of the image, #2 the % of pixels in the wedge and #3 the length (in %) of the shorter side of the wedge. The image is saved in a file called „o.png“.

150-50-40: 150-50-40

My program produces snowflakes with cut-off spikes, because new pixels start on the middle axis of the wedge (green dot, see below) and tend to stay there, because they move equally random to the left, up or down. As pixels outside the wedge are discarded, straight lines appear on the boundary of the wedge (green arrow). I was too lazy to try out other paths for the pixels.

150-50-40: 150-40-40e

When the wedge is big enough (3rd argument 100) the spikes on the middle axis can grow and then there are 12 of them.

150-40-100: 150-40-100

Few pixels make round shapes (left: 150-5-20; right 150-20-90).

150-5-20 150-20-90

The program:

import System.Environment;import System.Random;import Graphics.GD
rD=round;fI=fromIntegral;cM=concatMap;q=0.2588
main = do
    k<-getArgs;g<-getStdGen;let(s:p:w:_)=map read k 
    i<-newImage(2*s,2*s)
    let t=cM(j 3)$cM(\(x,y)->[(x,y),(rD$0.866*fI x+0.5*fI y,
            rD$0.5*fI x-0.866*fI y)])$take(s*rD(q*fI s)*p`div`100)$go s
            [(0,0)]w(s,0)$map(\r->((1+r)`mod`2,r))(randomRs(-1,1)g)
    mapM(\(x,y)->setPixel(x+s,y+s)(rgb 255 255 255)i)
            ((cM(j(-3/2))t)++(cM(j(3/2))t))
    savePngFile "o.png" i
j a(x,y)=[(x,y),(rD$c*fI x-s*fI y,rD$s*fI x+c*fI y)] where c=cos$pi/a;s=sin$pi/a
go s f w p@(x,y)((m,n):o)
    |x<1=go s f w(s,0)o
    |abs(fI$y+n)>q*fI x=go s f w p o
    |elem(x-m,y+n)f&&(v*z-z)*(b-q*z)-(-v*q*z-q*z)*(a-z)<0=p:go s(p:f)w(s,0)o
    |True=go s f w(x-m,y+n)o
    where z=fI s;a=fI x;b=fI y;v=fI w/100

Haskell, 781 Bytes

The program features the „specify the ratio of the lengths of the sides of the wedge“ option, so you have to call it with three command line arguments:

./sf 150 50 40

Argument #1 is the size of the image, #2 the % of pixels in the wedge and #3 the length (in %) of the shorter side of the wedge. The image is saved in a file called „o.png“.

150-50-40: 150-50-40

My program produces snowflakes with cut-off spikes, because new pixels start on the middle axis of the wedge (green dot, see below) and tend to stay there, because they move equally random to the left, up or down. As pixels outside the wedge are discarded, straight lines appear on the boundary of the wedge (green arrow). I was too lazy to try out other paths for the pixels.

150-50-40: 150-40-40e

When the wedge is big enough (3rd argument 100) the spikes on the middle axis can grow and then there are 12 of them.

150-40-100: 150-40-100

Few pixels make round shapes (left: 150-5-20; right 150-20-90).

150-5-20 150-20-90

The program:

import System.Environment;import System.Random;import Graphics.GD
rD=round;fI=fromIntegral;cM=concatMap;q=0.2588
main = do
    k<-getArgs;g<-getStdGen;let(s:p:w:_)=map read k 
    i<-newImage(2*s,2*s)
    let t=cM(j 3)$cM(\(x,y)->[(x,y),(rD$0.866*fI x+0.5*fI y,
            rD$0.5*fI x-0.866*fI y)])$take(s*rD(q*fI s)*p`div`100)$go s
            [(0,0)]w(s,0)$map(\r->((1+r)`mod`2,r))(randomRs(-1,1)g)
    mapM(\(x,y)->setPixel(x+s,y+s)(rgb 255 255 255)i)
            ((cM(j(-3/2))t)++(cM(j(3/2))t))
    savePngFile "o.png" i
j a(x,y)=[(x,y),(rD$c*fI x-s*fI y,rD$s*fI x+c*fI y)] where c=cos$pi/a;s=sin$pi/a
go s f w p@(x,y)((m,n):o)
    |x<1=go s f w(s,0)o
    |abs(fI$y+n)>q*fI x=go s f w p o
    |elem(x-m,y+n)f&&(v*z-z)*(b-q*z)-(-v*q*z-q*z)*(a-z)<0=p:go s(p:f)w(s,0)o
    |True=go s f w(x-m,y+n)o
    where z=fI s;a=fI x;b=fI y;v=fI w/100

Haskell, 781 Bytes

The program features the „specify the ratio of the lengths of the sides of the wedge“ option, so you have to call it with three command line arguments:

./sf 150 50 40

Argument #1 is the size of the image, #2 the % of pixels in the wedge and #3 the length (in %) of the shorter side of the wedge. The image is saved in a file called „o.png“.

150-50-40: 150-50-40

My program produces snowflakes with cut-off spikes, because new pixels start on the middle axis of the wedge (green dot, see below) and tend to stay there, because they move equally random to the left, up or down. As pixels outside the wedge are discarded, straight lines appear on the boundary of the wedge (green arrow). I was too lazy to try out other paths for the pixels.

150-50-40: 150-40-40e

When the wedge is big enough (3rd argument 100) the spikes on the middle axis can grow and then there are 12 of them.

150-40-100: 150-40-100

Few pixels make round shapes (left: 150-5-20; right 150-20-90).

150-5-20 150-20-90

The program:

import System.Environment;import System.Random;import Graphics.GD
rD=round;fI=fromIntegral;cM=concatMap;q=0.2588
main = do
k<-getArgs;g<-getStdGen;let(s:p:w:_)=map read k 
    i<-newImage(2*s,2*s)
    let t=cM(j 3)$cM(\(x,y)->[(x,y),(rD$0.866*fI x+0.5*fI y,
        rD$0.5*fI x-0.866*fI y)])$take(s*rD(q*fI s)*p`div`100)$go s
        [(0,0)]w(s,0)$map(\r->((1+r)`mod`2,r))(randomRs(-1,1)g)
    mapM(\(x,y)->setPixel(x+s,y+s)(rgb 255 255 255)i)
        ((cM(j(-3/2))t)++(cM(j(3/2))t))
    savePngFile "o.png" i
j a(x,y)=[(x,y),(rD$c*fI x-s*fI y,rD$s*fI x+c*fI y)] where c=cos$pi/a;s=sin$pi/a
go s f w p@(x,y)((m,n):o)
    |x<1=go s f w(s,0)o
    |abs(fI$y+n)>q*fI x=go s f w p o
    |elem(x-m,y+n)f&&(v*z-z)*(b-q*z)-(-v*q*z-q*z)*(a-z)<0=p:go s(p:f)w(s,0)o
    |True=go s f w(x-m,y+n)o
    where z=fI s;a=fI x;b=fI y;v=fI w/100
Source Link
nimi
  • 36k
  • 4
  • 35
  • 100
Loading