Generative Art - Functional Vilnius 2015
-
Upload
phillip-trelford -
Category
Software
-
view
1.669 -
download
1
Transcript of Generative Art - Functional Vilnius 2015
F#unctional londoners
• Founded Feb 2010
• 1000+ Members
• Meets every 2 weeks
• Topics include• Machine Learning
• Finance
• Games
• Web
• Arthttp://meetup.com/fsharplondon
Generative Art: Functional?
• Functional Geometry Paper
• Peter Henderson, 1984
http://pmh-systems.co.uk/phAcademic/papers/funcgeo.pdf
Mondrian: Procedurally Generated
http://www.clear-lines.com/blog/post/Transform-a-picture-in-the-style-of-Mondrian-with-FSharp.aspx
Loewensburg Reanimated
http://trelford.com/blog/post/Loewensberg.aspx
Happy endings
// Generate text from Philippe Decrauzat's D.T.A.B.T.W.H.A.H.E. 2010
let print (s:string) =
[|for y in 0..s.Length-1 ->
[|for x in 0..y-1 -> s.[x]
for x in y..s.Length-1 -> s.[y]
|]
|> fun cs ->
System.String(cs) +
System.String(cs |> Array.rev |> Seq.skip 1 |> Seq.toArray)
|]
|> fun ys -> [|yield! ys; yield! (Array.rev ys |> Seq.skip 1)|]
|> String.concat "\r\n"
print "A HAPPY ENDING"
http://fssnip.net/ii
Emoji Art
http://nf2p.com/f-sharp/generating-emoji-art-using-f-sharp/
Choose your own adventure
http://www.pinksquirrellabs.com/post/2013/07/29/Choose-Your-Own-Adventure-Type-Provider.aspx
SmallSharp: Lines
open Library
do GraphicsWindow.Show()
GraphicsWindow.BrushColor <- red
for i in 0..5..200 do
GraphicsWindow.DrawLine(i,0,n-i,n)
GraphicsWindow.DrawLine(0,i,n,n-i)
Turing Drawings
match action with
| Action.Left ->
xPos <- xPos + 1
if xPos >= mapWidth then xPos <- xPos - mapWidth
| Action.Right ->
xPos <- xPos - 1
if (xPos < 0) then xPos <- xPos + mapWidth
| Action.Up ->
yPos <- yPos - 1
if (yPos < 0) then yPos <- yPos + mapHeight
| Action.Down ->
yPos <- yPos + 1
if yPos >= mapHeight then yPos <- yPos - mapHeight
http://trelford.com/blog/post/Turing.aspx
Resources
http://smallsharp.codeplex.com (Windows only Graphics)
http://funsharp.github.com (Cross Platform Graphics)
http://funscript.info (F# -> JS)
http://www.pinksquirrellabs.com (CYOA Type Provider)
http://c4fsharp.net/#fsharp-coding-dojos (Dojos)