SlideShare a Scribd company logo
1 of 43
Activity:
“Figuring with Algorithms”
Using Context Free Art Generator to figure out patterns of behaviour
Design grammars are sets of very simple non-
deterministic rules to produce images.
Context Free is a graphical environment for editing,
rendering, and exploring CFDG.
John HoriganChris Coyne Mark Lentczner
startshape startclouds
background { b -0.1 h 220 sat 0.75 }
rule startclouds {
3* { x 1 } startcloud { a -1 }
}
rule startcloud {
side { y -0.5 }
}
rule startcloud {
side { y 0.5 }
}
rule cloud {
step { }
horiz { s 0.7 }
side { }
}
rule side {
step { }
cloud { x -1 a 0.0005 s 0.99 }
}
rule side {
step { }
cloud { x 1 a 0.001 s 0.99 }
}
rule horiz {
step { }
rotatecloud { y -1 }
}
rule side {}
rule horiz {
step { }
rotatecloud { y 1 }
}
rule rotatecloud {
cloud { r 15 }
}
rule rotatecloud {
cloud { r -15 }
}
rule step {
SQUARE { b 1 }
}
rule step {
CIRCLE { b 1 }
}
Start with a root symbol/shape (the startshape) and use grammar
rules to elaborate this into a sentence of symbols/shapes.
When Context Free draws a shape it remembers some state
information for the shape (colour, xyz position, size, rotation). To
draw the shape Context Free evaluates a rule for the shape and
replaces the shape with the shapes listed in the rule. The state for
these replacement shapes is relative to the state of the parent
shape.
https://www.contextfreeart.org/gallery/search.php?by=lazymoon
https://www.contextfreeart.org/gallery/search.php?by=lazymoon
https://www.contextfreeart.org/gallery/search.php?by=lagroue
https://www.contextfreeart.org/gallery/search.php?by=Guigui
https://www.contextfreeart.org/gallery/search.php?by=Guigui
https://www.contextfreeart.org/gallery/search.php?by=craftycurate
https://www.contextfreeart.org/gallery/search.php?by=benjy
https://www.contextfreeart.org/gallery/search.php?by=bluesky
https://www.contextfreeart.org/gallery/search.php?by=bluesky
https://www.contextfreeart.org/gallery/search.php?by=chris
https://www.contextfreeart.org/gallery/view.php?id=2592
https://www.contextfreeart.org/gallery/view.php?id=697
https://www.contextfreeart.org/gallery/view.php?id=3215
Start with a simple example
Copy and Paste into Context Free Art and hit Ctrl + R (Render)
startshape tree
shape tree
rule {
SQUARE []
tree [ s .99 r 2 y .995]
}
rule 33 {
SQUARE []
tree [ s .99 r 2 y .995 flip 90]
}
rule {
SQUARE []
tree [[ s .5 r 10 y .995 b .07 z -.07 ]]
tree [ s .99 y .995 flip 90 ]
tree [[ s .5 flip 90 r 10 y .995 b .07 z -.07]]
}
rule 3 {
SQUARE []
tree [[ sat 0.5 b 0.1 s .8 r 10 y .995 b .01 z -.001]]
tree [[ sat 0.5 b 0.1 s .8 flip 90 r 10 y .995 b .01 z -.001]]
}
startshape tree
shape tree
rule {
SQUARE []
tree [ s .99 r 2 y .995]
}
rule 33 {
SQUARE []
tree [ s .99 r 2 y .995 flip 90]
}
rule {
SQUARE []
tree [[ s .5 r 10 y .995 b .07 z -.07 ]]
tree [ s .99 y .995 flip 90 ]
tree [[ s .5 flip 90 r 10 y .995 b .07 z -.07]]
}
rule 3 {
SQUARE []
tree [[ hue 30 sat 0.5 b 0.1 s .8 r 10 y .995 b .01 z -.001]]
tree [[ hue 30 sat 0.5 b 0.1 s .8 flip 90 r 10 y .995 b .01 z -.001]]
}
Using colour to figure out what rules generate trunk,
main and secondary branches
startshape tree
shape tree
rule {
SQUARE []
tree [ hue 30 sat 0.5 b 0.1 s .99 r 2 y .995]
}
rule 33 {
SQUARE []
tree [ hue 30 sat 0.5 b 0.1 s .99 r 2 y .995 flip 90]
}
rule {
SQUARE []
tree [[ s .5 r 10 y .995 b .07 z -.07 ]]
tree [ s .99 y .995 flip 90 ]
tree [[ s .5 flip 90 r 10 y .995 b .07 z -.07]]
}
rule 3 {
SQUARE []
tree [[ s .8 r 10 y .995 b .01 z -.001]]
tree [[ s .8 flip 90 r 10 y .995 b .01 z -.001]]
}
Using colour to figure out what rules generate trunk,
main and secondary branches
startshape tree
shape tree
rule {
SQUARE []
tree [ s .99 r 2 y .995]
}
rule 33 {
SQUARE []
tree [ s .99 r 2 y .995 flip 90]
}
First two rules generate thick, mainly vertical
arrangement of squares: ‘trunk’
startshape tree
shape tree
rule {
SQUARE []
tree [ s .99 r 2 y .995]
}
rule {
SQUARE []
tree [ s .99 r 2 y .995 flip 90]
}
Change the odds for each rule to trigger to see effects
in the type of trunks generated
startshape tree
shape tree
rule {
SQUARE []
tree [ s .99 r 2 y .995]
}
rule 33 {
SQUARE []
tree [ s .99 r 2 y .995 flip 90]
}
Second rule is called 33x more than the first rule
startshape tree
shape tree
rule {
SQUARE []
tree [ s .99 r 2 y .995]
}
rule 33 {
SQUARE []
tree [ s .99 r 2 y .995 flip 90]
}
rule {
SQUARE []
tree [[ s .5 r 10 y .995 b .07 z -.07 ]]
tree [ s .99 y .995 flip 90 ]
tree [[ s .5 flip 90 r 10 y .995 b .07 z -.07]]
}
rule 3 {
SQUARE []
tree [[ sat 0.5 b 0.1 s .8 r 10 y .995 b .01 z -.001]]
tree [[ sat 0.5 b 0.1 s .8 flip 90 r 10 y .995 b .01 z -.001]]
}
Play with the third and fourth rules to see branching
effects. Remember to “Render” a few times to see
variations due to randomness
First… some mechanics
(It’s way easier than you may have been led to believe)
startshape PLANT
shape PLANT {
CIRCLE [ ]
}
Starting point:
This code draws a simple black circle,
we arbitrarily call the function “PLANT”:
startshape PLANT
shape PLANT {
BL [ h 10 sat 1 b 1 ]
}
shape BL {
CIRCLE [ ]
}
Two changes:
1. The “CIRCLE” definition moved to a function that we call “BL”
2. Shape parameters are sent when invoking BL:
a) hue 10
b) saturation 1
c) brightness 1
startshape PLANT
shape PLANT {
BL [ h 10 sat 1 b 1 ]
}
shape BL {
CIRCLE [ ]
BL [size (0.95) y 1 ]
}
Recursion:
We introduce an operation after the CIRCLE, which
the program applies in a loop (until the shapes are
too small to be rendered, then it stops).
The new line is effectively, updating itself (shape BL)
scaling down its size and moving in the y axis 1 unit
up
startshape PLANT
shape PLANT {
BL [ h 10 sat 1 b 1 ]
}
shape BL {
CIRCLE [ ]
BL [size (0.95) y 1 x 1 ]
}
Recursion:
Now each new shape is moved one unit up and one
unit right on every step
startshape PLANT
shape PLANT {
BL [ h 10 sat 1 b 1 ]
}
shape BL
rule {
CIRCLE [ ]
BL [size (0.95) y 1 x 1]
}
Randomness:
This is exactly the same code as before, it just shows
that shapes can have more than one operations, i.e.,
“rules”. Here BL has a single rule, the same as the
previous step
startshape PLANT
shape PLANT {
BL [ h 10 sat 1 b 1 ]
}
shape BL
rule {
CIRCLE [ ]
BL [size (0.95) y 1 ]
}
rule {
CIRCLE [ ]
BL [size (0.95) x 1 ]
}
Randomness: Now the fun begins: randomness. When two rules
are defined for a shape, then the software chooses
randomly only one of them to execute. The results
start being a bit unpredictable…
startshape PLANT
shape PLANT {
BL [ h 10 sat 1 b 1 ]
}
shape BL
rule {
CIRCLE [ ]
BL [ rotate randint(0, 8) size (0.95) y 1 ]
}
rule {
CIRCLE [ ]
BL [ rotate randint(0, 8) size (0.95) x 1 ]
}
More randomness: Now we also add a random rotation (an integer
value between 0 and 8), so every time that the code
is executed, it renders a slightly different image:
overall the same logic, but with the specific details
different every time.
startshape PLANT
shape PLANT {
BL [ sat 1 b 1 ]
}
shape BL
rule {
CIRCLE [ ]
BL [ h randint(0, 360) rotate randint(0, 8) size (0.95) y 1 ]
}
rule {
CIRCLE [ ]
BL [ h randint(0, 360) rotate randint(0, 8) size (0.95) x 1 ]
}
Even more randomness:
We take the hue parameter out from the BL
definition in “shape PLANT” and make it random too
every time BL is called in a rule.
But now the code is getting “messy” and things are
duplicated… let’s do some cleaning next
startshape PLANT
shape PLANT {
BL [ sat 1 b 1 ]
}
shape BL {
CIRCLE [ ]
WL [ size (0.985) y 1 ]
}
shape WL
rule { BL [ h randint(0, 360) rotate randint(0, 8)] }
Recursion between shapes:
Compare the code with the previous version. Shape
BL now declares a circle and calls shape WL with a
change in size and location in y axis
And shape WL has one rule where it calls shape BL
with a change in hue and rotation. The program
continues with this recursive loop until it can’t
render new shapes because they are too small
startshape PLANT
shape PLANT {
BL [ sat 1 b 1 ]
}
shape BL {
CIRCLE [ ]
WL [ size (0.985) y 1 ]
}
shape WL
rule 50 { BL [ h randint(0, 360) rotate randint(0, 8)] }
rule { BRANCH [] }
shape BRANCH {
BL [ rotate 1 flip 90]
BL [ rotate -1 flip 90]
}
Recursion between shapes: The advantage of separating and calling shapes
recursively, is that we can create routines with
several rules, each with a “weight” or probability of
being chosen and executed.
This is how the shape BRANCH looks, and we add a
weight of 50 to the rule that calls shape BL.
Now every instance looks quite different! (within a
shared generative grammar)
Download and install: https://www.contextfreeart.org
To Do:
- Play with the code
- Document and share your results in your blog
Credits:
Chris Coyne designed the CFDG grammar and wrote the original command-line version.
Mark Lentczner saw Chris' site and decided he had to have an interactive version. He is responsible for the Macintosh version.
John Horigan got sucked into this project and it immediately ate all of his spare time. He wrote the Windows version. Mark and John
jointly maintain the common code base and the Posix/Unix version.
Activity: Figuring with Algorithms 2020

More Related Content

Similar to Activity: Figuring with Algorithms 2020

2012 University of Dayton .docx
2012   University of Dayton                   .docx2012   University of Dayton                   .docx
2012 University of Dayton .docxeugeniadean34240
 
Rpartii 131126003007-phpapp01
Rpartii 131126003007-phpapp01Rpartii 131126003007-phpapp01
Rpartii 131126003007-phpapp01Sunil0108
 
Shaped blade centeress_grinding_v0
Shaped blade centeress_grinding_v0Shaped blade centeress_grinding_v0
Shaped blade centeress_grinding_v0Marco Leonesio
 
Linear Control Hard-Disk Read/Write Controller Assignment
Linear Control Hard-Disk Read/Write Controller AssignmentLinear Control Hard-Disk Read/Write Controller Assignment
Linear Control Hard-Disk Read/Write Controller AssignmentIsham Rashik
 
Row Pattern Matching 12c MATCH_RECOGNIZE OOW14
Row Pattern Matching 12c MATCH_RECOGNIZE OOW14Row Pattern Matching 12c MATCH_RECOGNIZE OOW14
Row Pattern Matching 12c MATCH_RECOGNIZE OOW14stewashton
 
Linear models
Linear modelsLinear models
Linear modelsFAO
 
Numerical Investigation of Aerodynamic Performance of H-Rotor Darrieus Wind T...
Numerical Investigation of Aerodynamic Performance of H-Rotor Darrieus Wind T...Numerical Investigation of Aerodynamic Performance of H-Rotor Darrieus Wind T...
Numerical Investigation of Aerodynamic Performance of H-Rotor Darrieus Wind T...Bharath Ningaraj
 
8. Vectors data frames
8. Vectors data frames8. Vectors data frames
8. Vectors data framesExternalEvents
 
Electrical engg material
Electrical engg material Electrical engg material
Electrical engg material Ramesh Meti
 
Basic Control System unit6
Basic Control System unit6Basic Control System unit6
Basic Control System unit6Asraf Malik
 
WRI Sales Compensation Plan
WRI Sales Compensation PlanWRI Sales Compensation Plan
WRI Sales Compensation PlanScott Pickering
 

Similar to Activity: Figuring with Algorithms 2020 (20)

2012 University of Dayton .docx
2012   University of Dayton                   .docx2012   University of Dayton                   .docx
2012 University of Dayton .docx
 
Relatório
RelatórioRelatório
Relatório
 
R part II
R part IIR part II
R part II
 
Rpartii 131126003007-phpapp01
Rpartii 131126003007-phpapp01Rpartii 131126003007-phpapp01
Rpartii 131126003007-phpapp01
 
Shaped blade centeress_grinding_v0
Shaped blade centeress_grinding_v0Shaped blade centeress_grinding_v0
Shaped blade centeress_grinding_v0
 
Linear Control Hard-Disk Read/Write Controller Assignment
Linear Control Hard-Disk Read/Write Controller AssignmentLinear Control Hard-Disk Read/Write Controller Assignment
Linear Control Hard-Disk Read/Write Controller Assignment
 
Row Pattern Matching 12c MATCH_RECOGNIZE OOW14
Row Pattern Matching 12c MATCH_RECOGNIZE OOW14Row Pattern Matching 12c MATCH_RECOGNIZE OOW14
Row Pattern Matching 12c MATCH_RECOGNIZE OOW14
 
12. Linear models
12. Linear models12. Linear models
12. Linear models
 
Linear models
Linear modelsLinear models
Linear models
 
Numerical Investigation of Aerodynamic Performance of H-Rotor Darrieus Wind T...
Numerical Investigation of Aerodynamic Performance of H-Rotor Darrieus Wind T...Numerical Investigation of Aerodynamic Performance of H-Rotor Darrieus Wind T...
Numerical Investigation of Aerodynamic Performance of H-Rotor Darrieus Wind T...
 
130070119095_2151908
130070119095_2151908130070119095_2151908
130070119095_2151908
 
Autocad electrical
Autocad electricalAutocad electrical
Autocad electrical
 
8. Vectors data frames
8. Vectors data frames8. Vectors data frames
8. Vectors data frames
 
Electrical engg material
Electrical engg material Electrical engg material
Electrical engg material
 
R Programming Homework Help
R Programming Homework HelpR Programming Homework Help
R Programming Homework Help
 
Basic Control System unit6
Basic Control System unit6Basic Control System unit6
Basic Control System unit6
 
Bode
BodeBode
Bode
 
WRI Sales Compensation Plan
WRI Sales Compensation PlanWRI Sales Compensation Plan
WRI Sales Compensation Plan
 
Project ppt 18 june.pptx
Project ppt 18 june.pptxProject ppt 18 june.pptx
Project ppt 18 june.pptx
 
s1233587_Report
s1233587_Reports1233587_Report
s1233587_Report
 

More from R. Sosa

Week 1: Lecture What is Design by Ricardo Sosa
Week 1: Lecture What is Design by Ricardo SosaWeek 1: Lecture What is Design by Ricardo Sosa
Week 1: Lecture What is Design by Ricardo SosaR. Sosa
 
100 IDEAS THAT CHANGED DESIGN
100 IDEAS THAT CHANGED DESIGN100 IDEAS THAT CHANGED DESIGN
100 IDEAS THAT CHANGED DESIGNR. Sosa
 
Edgar Morin El Metodo 4: Las ideas
Edgar Morin El Metodo 4: Las ideasEdgar Morin El Metodo 4: Las ideas
Edgar Morin El Metodo 4: Las ideasR. Sosa
 
USYD Virtual Design lecture
USYD Virtual Design lectureUSYD Virtual Design lecture
USYD Virtual Design lectureR. Sosa
 
Design School Confidential Class Projects
Design School Confidential Class ProjectsDesign School Confidential Class Projects
Design School Confidential Class ProjectsR. Sosa
 
La Golosina Visual de Ignacio Ramonet
La Golosina Visual de Ignacio RamonetLa Golosina Visual de Ignacio Ramonet
La Golosina Visual de Ignacio RamonetR. Sosa
 
Apocalípticos e Integrados
Apocalípticos e IntegradosApocalípticos e Integrados
Apocalípticos e IntegradosR. Sosa
 
Understanding Computers and Cognition
Understanding Computers and CognitionUnderstanding Computers and Cognition
Understanding Computers and CognitionR. Sosa
 
Convivial Toolbox
Convivial ToolboxConvivial Toolbox
Convivial ToolboxR. Sosa
 
Brecht on Theatre.pdf
Brecht on Theatre.pdfBrecht on Theatre.pdf
Brecht on Theatre.pdfR. Sosa
 
Simulation (or Computation) and its Discontents
Simulation (or Computation) and its DiscontentsSimulation (or Computation) and its Discontents
Simulation (or Computation) and its DiscontentsR. Sosa
 
Gui Bonsiepe: Las Siete Columnas del Diseño_.pdf
Gui Bonsiepe: Las Siete Columnas del Diseño_.pdfGui Bonsiepe: Las Siete Columnas del Diseño_.pdf
Gui Bonsiepe: Las Siete Columnas del Diseño_.pdfR. Sosa
 
The Invention of Creativity by Reckwitz.pdf
The Invention of Creativity by Reckwitz.pdfThe Invention of Creativity by Reckwitz.pdf
The Invention of Creativity by Reckwitz.pdfR. Sosa
 
Write your Thesis using AI
Write your Thesis using AIWrite your Thesis using AI
Write your Thesis using AIR. Sosa
 
Tikanga Māori
Tikanga MāoriTikanga Māori
Tikanga MāoriR. Sosa
 
The richness of life, Stephen Jay Gould
The richness of life, Stephen Jay GouldThe richness of life, Stephen Jay Gould
The richness of life, Stephen Jay GouldR. Sosa
 
Las Ideas Estéticas de Marx.pdf
Las Ideas Estéticas de Marx.pdfLas Ideas Estéticas de Marx.pdf
Las Ideas Estéticas de Marx.pdfR. Sosa
 
Māori Philosophies
Māori PhilosophiesMāori Philosophies
Māori PhilosophiesR. Sosa
 
Herbot Design Analysis annotated 58 points.pdf
Herbot Design Analysis annotated 58 points.pdfHerbot Design Analysis annotated 58 points.pdf
Herbot Design Analysis annotated 58 points.pdfR. Sosa
 

More from R. Sosa (20)

Week 1: Lecture What is Design by Ricardo Sosa
Week 1: Lecture What is Design by Ricardo SosaWeek 1: Lecture What is Design by Ricardo Sosa
Week 1: Lecture What is Design by Ricardo Sosa
 
Causation
CausationCausation
Causation
 
100 IDEAS THAT CHANGED DESIGN
100 IDEAS THAT CHANGED DESIGN100 IDEAS THAT CHANGED DESIGN
100 IDEAS THAT CHANGED DESIGN
 
Edgar Morin El Metodo 4: Las ideas
Edgar Morin El Metodo 4: Las ideasEdgar Morin El Metodo 4: Las ideas
Edgar Morin El Metodo 4: Las ideas
 
USYD Virtual Design lecture
USYD Virtual Design lectureUSYD Virtual Design lecture
USYD Virtual Design lecture
 
Design School Confidential Class Projects
Design School Confidential Class ProjectsDesign School Confidential Class Projects
Design School Confidential Class Projects
 
La Golosina Visual de Ignacio Ramonet
La Golosina Visual de Ignacio RamonetLa Golosina Visual de Ignacio Ramonet
La Golosina Visual de Ignacio Ramonet
 
Apocalípticos e Integrados
Apocalípticos e IntegradosApocalípticos e Integrados
Apocalípticos e Integrados
 
Understanding Computers and Cognition
Understanding Computers and CognitionUnderstanding Computers and Cognition
Understanding Computers and Cognition
 
Convivial Toolbox
Convivial ToolboxConvivial Toolbox
Convivial Toolbox
 
Brecht on Theatre.pdf
Brecht on Theatre.pdfBrecht on Theatre.pdf
Brecht on Theatre.pdf
 
Simulation (or Computation) and its Discontents
Simulation (or Computation) and its DiscontentsSimulation (or Computation) and its Discontents
Simulation (or Computation) and its Discontents
 
Gui Bonsiepe: Las Siete Columnas del Diseño_.pdf
Gui Bonsiepe: Las Siete Columnas del Diseño_.pdfGui Bonsiepe: Las Siete Columnas del Diseño_.pdf
Gui Bonsiepe: Las Siete Columnas del Diseño_.pdf
 
The Invention of Creativity by Reckwitz.pdf
The Invention of Creativity by Reckwitz.pdfThe Invention of Creativity by Reckwitz.pdf
The Invention of Creativity by Reckwitz.pdf
 
Write your Thesis using AI
Write your Thesis using AIWrite your Thesis using AI
Write your Thesis using AI
 
Tikanga Māori
Tikanga MāoriTikanga Māori
Tikanga Māori
 
The richness of life, Stephen Jay Gould
The richness of life, Stephen Jay GouldThe richness of life, Stephen Jay Gould
The richness of life, Stephen Jay Gould
 
Las Ideas Estéticas de Marx.pdf
Las Ideas Estéticas de Marx.pdfLas Ideas Estéticas de Marx.pdf
Las Ideas Estéticas de Marx.pdf
 
Māori Philosophies
Māori PhilosophiesMāori Philosophies
Māori Philosophies
 
Herbot Design Analysis annotated 58 points.pdf
Herbot Design Analysis annotated 58 points.pdfHerbot Design Analysis annotated 58 points.pdf
Herbot Design Analysis annotated 58 points.pdf
 

Recently uploaded

Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Gi...
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Gi...Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Gi...
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Gi...Pooja Nehwal
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756dollysharma2066
 
Design Inspiration for College by Slidesgo.pptx
Design Inspiration for College by Slidesgo.pptxDesign Inspiration for College by Slidesgo.pptx
Design Inspiration for College by Slidesgo.pptxTusharBahuguna2
 
The history of music videos a level presentation
The history of music videos a level presentationThe history of music videos a level presentation
The history of music videos a level presentationamedia6
 
💫✅jodhpur 24×7 BEST GENUINE PERSON LOW PRICE CALL GIRL SERVICE FULL SATISFACT...
💫✅jodhpur 24×7 BEST GENUINE PERSON LOW PRICE CALL GIRL SERVICE FULL SATISFACT...💫✅jodhpur 24×7 BEST GENUINE PERSON LOW PRICE CALL GIRL SERVICE FULL SATISFACT...
💫✅jodhpur 24×7 BEST GENUINE PERSON LOW PRICE CALL GIRL SERVICE FULL SATISFACT...sonalitrivedi431
 
SD_The MATATAG Curriculum Training Design.pptx
SD_The MATATAG Curriculum Training Design.pptxSD_The MATATAG Curriculum Training Design.pptx
SD_The MATATAG Curriculum Training Design.pptxjanettecruzeiro1
 
Booking open Available Pune Call Girls Kirkatwadi 6297143586 Call Hot Indian...
Booking open Available Pune Call Girls Kirkatwadi  6297143586 Call Hot Indian...Booking open Available Pune Call Girls Kirkatwadi  6297143586 Call Hot Indian...
Booking open Available Pune Call Girls Kirkatwadi 6297143586 Call Hot Indian...Call Girls in Nagpur High Profile
 
Stark Industries Marketing Plan (1).pptx
Stark Industries Marketing Plan (1).pptxStark Industries Marketing Plan (1).pptx
Stark Industries Marketing Plan (1).pptxjeswinjees
 
Top Rated Pune Call Girls Koregaon Park ⟟ 6297143586 ⟟ Call Me For Genuine S...
Top Rated  Pune Call Girls Koregaon Park ⟟ 6297143586 ⟟ Call Me For Genuine S...Top Rated  Pune Call Girls Koregaon Park ⟟ 6297143586 ⟟ Call Me For Genuine S...
Top Rated Pune Call Girls Koregaon Park ⟟ 6297143586 ⟟ Call Me For Genuine S...Call Girls in Nagpur High Profile
 
Booking open Available Pune Call Girls Nanded City 6297143586 Call Hot India...
Booking open Available Pune Call Girls Nanded City  6297143586 Call Hot India...Booking open Available Pune Call Girls Nanded City  6297143586 Call Hot India...
Booking open Available Pune Call Girls Nanded City 6297143586 Call Hot India...Call Girls in Nagpur High Profile
 
Peaches App development presentation deck
Peaches App development presentation deckPeaches App development presentation deck
Peaches App development presentation decktbatkhuu1
 
Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...
Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...
Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...home
 
Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)amitlee9823
 
Government polytechnic college-1.pptxabcd
Government polytechnic college-1.pptxabcdGovernment polytechnic college-1.pptxabcd
Government polytechnic college-1.pptxabcdshivubhavv
 
DragonBall PowerPoint Template for demo.pptx
DragonBall PowerPoint Template for demo.pptxDragonBall PowerPoint Template for demo.pptx
DragonBall PowerPoint Template for demo.pptxmirandajeremy200221
 
Pastel Portfolio _ by Slidesgo.pptx. Xxx
Pastel Portfolio _ by Slidesgo.pptx. XxxPastel Portfolio _ by Slidesgo.pptx. Xxx
Pastel Portfolio _ by Slidesgo.pptx. XxxSegundoManuelFaichin1
 
Jigani Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...
Jigani Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...Jigani Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...
Jigani Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...amitlee9823
 
call girls in Dakshinpuri (DELHI) 🔝 >༒9953056974 🔝 genuine Escort Service 🔝✔️✔️
call girls in Dakshinpuri  (DELHI) 🔝 >༒9953056974 🔝 genuine Escort Service 🔝✔️✔️call girls in Dakshinpuri  (DELHI) 🔝 >༒9953056974 🔝 genuine Escort Service 🔝✔️✔️
call girls in Dakshinpuri (DELHI) 🔝 >༒9953056974 🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
RT Nagar Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...
RT Nagar Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...RT Nagar Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...
RT Nagar Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...amitlee9823
 

Recently uploaded (20)

Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Gi...
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Gi...Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Gi...
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Gi...
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
 
Design Inspiration for College by Slidesgo.pptx
Design Inspiration for College by Slidesgo.pptxDesign Inspiration for College by Slidesgo.pptx
Design Inspiration for College by Slidesgo.pptx
 
The history of music videos a level presentation
The history of music videos a level presentationThe history of music videos a level presentation
The history of music videos a level presentation
 
💫✅jodhpur 24×7 BEST GENUINE PERSON LOW PRICE CALL GIRL SERVICE FULL SATISFACT...
💫✅jodhpur 24×7 BEST GENUINE PERSON LOW PRICE CALL GIRL SERVICE FULL SATISFACT...💫✅jodhpur 24×7 BEST GENUINE PERSON LOW PRICE CALL GIRL SERVICE FULL SATISFACT...
💫✅jodhpur 24×7 BEST GENUINE PERSON LOW PRICE CALL GIRL SERVICE FULL SATISFACT...
 
SD_The MATATAG Curriculum Training Design.pptx
SD_The MATATAG Curriculum Training Design.pptxSD_The MATATAG Curriculum Training Design.pptx
SD_The MATATAG Curriculum Training Design.pptx
 
Booking open Available Pune Call Girls Kirkatwadi 6297143586 Call Hot Indian...
Booking open Available Pune Call Girls Kirkatwadi  6297143586 Call Hot Indian...Booking open Available Pune Call Girls Kirkatwadi  6297143586 Call Hot Indian...
Booking open Available Pune Call Girls Kirkatwadi 6297143586 Call Hot Indian...
 
Stark Industries Marketing Plan (1).pptx
Stark Industries Marketing Plan (1).pptxStark Industries Marketing Plan (1).pptx
Stark Industries Marketing Plan (1).pptx
 
Top Rated Pune Call Girls Koregaon Park ⟟ 6297143586 ⟟ Call Me For Genuine S...
Top Rated  Pune Call Girls Koregaon Park ⟟ 6297143586 ⟟ Call Me For Genuine S...Top Rated  Pune Call Girls Koregaon Park ⟟ 6297143586 ⟟ Call Me For Genuine S...
Top Rated Pune Call Girls Koregaon Park ⟟ 6297143586 ⟟ Call Me For Genuine S...
 
Booking open Available Pune Call Girls Nanded City 6297143586 Call Hot India...
Booking open Available Pune Call Girls Nanded City  6297143586 Call Hot India...Booking open Available Pune Call Girls Nanded City  6297143586 Call Hot India...
Booking open Available Pune Call Girls Nanded City 6297143586 Call Hot India...
 
Peaches App development presentation deck
Peaches App development presentation deckPeaches App development presentation deck
Peaches App development presentation deck
 
Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...
Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...
Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...
 
Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)
 
Government polytechnic college-1.pptxabcd
Government polytechnic college-1.pptxabcdGovernment polytechnic college-1.pptxabcd
Government polytechnic college-1.pptxabcd
 
DragonBall PowerPoint Template for demo.pptx
DragonBall PowerPoint Template for demo.pptxDragonBall PowerPoint Template for demo.pptx
DragonBall PowerPoint Template for demo.pptx
 
Pastel Portfolio _ by Slidesgo.pptx. Xxx
Pastel Portfolio _ by Slidesgo.pptx. XxxPastel Portfolio _ by Slidesgo.pptx. Xxx
Pastel Portfolio _ by Slidesgo.pptx. Xxx
 
Jigani Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...
Jigani Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...Jigani Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...
Jigani Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...
 
call girls in Dakshinpuri (DELHI) 🔝 >༒9953056974 🔝 genuine Escort Service 🔝✔️✔️
call girls in Dakshinpuri  (DELHI) 🔝 >༒9953056974 🔝 genuine Escort Service 🔝✔️✔️call girls in Dakshinpuri  (DELHI) 🔝 >༒9953056974 🔝 genuine Escort Service 🔝✔️✔️
call girls in Dakshinpuri (DELHI) 🔝 >༒9953056974 🔝 genuine Escort Service 🔝✔️✔️
 
RT Nagar Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...
RT Nagar Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...RT Nagar Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...
RT Nagar Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...
 
young call girls in Pandav nagar 🔝 9953056974 🔝 Delhi escort Service
young call girls in Pandav nagar 🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Pandav nagar 🔝 9953056974 🔝 Delhi escort Service
young call girls in Pandav nagar 🔝 9953056974 🔝 Delhi escort Service
 

Activity: Figuring with Algorithms 2020

  • 1. Activity: “Figuring with Algorithms” Using Context Free Art Generator to figure out patterns of behaviour
  • 2. Design grammars are sets of very simple non- deterministic rules to produce images. Context Free is a graphical environment for editing, rendering, and exploring CFDG. John HoriganChris Coyne Mark Lentczner
  • 3. startshape startclouds background { b -0.1 h 220 sat 0.75 } rule startclouds { 3* { x 1 } startcloud { a -1 } } rule startcloud { side { y -0.5 } } rule startcloud { side { y 0.5 } } rule cloud { step { } horiz { s 0.7 } side { } } rule side { step { } cloud { x -1 a 0.0005 s 0.99 } } rule side { step { } cloud { x 1 a 0.001 s 0.99 } } rule horiz { step { } rotatecloud { y -1 } } rule side {} rule horiz { step { } rotatecloud { y 1 } } rule rotatecloud { cloud { r 15 } } rule rotatecloud { cloud { r -15 } } rule step { SQUARE { b 1 } } rule step { CIRCLE { b 1 } }
  • 4. Start with a root symbol/shape (the startshape) and use grammar rules to elaborate this into a sentence of symbols/shapes. When Context Free draws a shape it remembers some state information for the shape (colour, xyz position, size, rotation). To draw the shape Context Free evaluates a rule for the shape and replaces the shape with the shapes listed in the rule. The state for these replacement shapes is relative to the state of the parent shape.
  • 9.
  • 10.
  • 11.
  • 12.
  • 22. Start with a simple example Copy and Paste into Context Free Art and hit Ctrl + R (Render)
  • 23. startshape tree shape tree rule { SQUARE [] tree [ s .99 r 2 y .995] } rule 33 { SQUARE [] tree [ s .99 r 2 y .995 flip 90] } rule { SQUARE [] tree [[ s .5 r 10 y .995 b .07 z -.07 ]] tree [ s .99 y .995 flip 90 ] tree [[ s .5 flip 90 r 10 y .995 b .07 z -.07]] } rule 3 { SQUARE [] tree [[ sat 0.5 b 0.1 s .8 r 10 y .995 b .01 z -.001]] tree [[ sat 0.5 b 0.1 s .8 flip 90 r 10 y .995 b .01 z -.001]] }
  • 24.
  • 25. startshape tree shape tree rule { SQUARE [] tree [ s .99 r 2 y .995] } rule 33 { SQUARE [] tree [ s .99 r 2 y .995 flip 90] } rule { SQUARE [] tree [[ s .5 r 10 y .995 b .07 z -.07 ]] tree [ s .99 y .995 flip 90 ] tree [[ s .5 flip 90 r 10 y .995 b .07 z -.07]] } rule 3 { SQUARE [] tree [[ hue 30 sat 0.5 b 0.1 s .8 r 10 y .995 b .01 z -.001]] tree [[ hue 30 sat 0.5 b 0.1 s .8 flip 90 r 10 y .995 b .01 z -.001]] } Using colour to figure out what rules generate trunk, main and secondary branches
  • 26. startshape tree shape tree rule { SQUARE [] tree [ hue 30 sat 0.5 b 0.1 s .99 r 2 y .995] } rule 33 { SQUARE [] tree [ hue 30 sat 0.5 b 0.1 s .99 r 2 y .995 flip 90] } rule { SQUARE [] tree [[ s .5 r 10 y .995 b .07 z -.07 ]] tree [ s .99 y .995 flip 90 ] tree [[ s .5 flip 90 r 10 y .995 b .07 z -.07]] } rule 3 { SQUARE [] tree [[ s .8 r 10 y .995 b .01 z -.001]] tree [[ s .8 flip 90 r 10 y .995 b .01 z -.001]] } Using colour to figure out what rules generate trunk, main and secondary branches
  • 27. startshape tree shape tree rule { SQUARE [] tree [ s .99 r 2 y .995] } rule 33 { SQUARE [] tree [ s .99 r 2 y .995 flip 90] } First two rules generate thick, mainly vertical arrangement of squares: ‘trunk’
  • 28. startshape tree shape tree rule { SQUARE [] tree [ s .99 r 2 y .995] } rule { SQUARE [] tree [ s .99 r 2 y .995 flip 90] } Change the odds for each rule to trigger to see effects in the type of trunks generated
  • 29. startshape tree shape tree rule { SQUARE [] tree [ s .99 r 2 y .995] } rule 33 { SQUARE [] tree [ s .99 r 2 y .995 flip 90] } Second rule is called 33x more than the first rule
  • 30. startshape tree shape tree rule { SQUARE [] tree [ s .99 r 2 y .995] } rule 33 { SQUARE [] tree [ s .99 r 2 y .995 flip 90] } rule { SQUARE [] tree [[ s .5 r 10 y .995 b .07 z -.07 ]] tree [ s .99 y .995 flip 90 ] tree [[ s .5 flip 90 r 10 y .995 b .07 z -.07]] } rule 3 { SQUARE [] tree [[ sat 0.5 b 0.1 s .8 r 10 y .995 b .01 z -.001]] tree [[ sat 0.5 b 0.1 s .8 flip 90 r 10 y .995 b .01 z -.001]] } Play with the third and fourth rules to see branching effects. Remember to “Render” a few times to see variations due to randomness
  • 31. First… some mechanics (It’s way easier than you may have been led to believe)
  • 32. startshape PLANT shape PLANT { CIRCLE [ ] } Starting point: This code draws a simple black circle, we arbitrarily call the function “PLANT”:
  • 33. startshape PLANT shape PLANT { BL [ h 10 sat 1 b 1 ] } shape BL { CIRCLE [ ] } Two changes: 1. The “CIRCLE” definition moved to a function that we call “BL” 2. Shape parameters are sent when invoking BL: a) hue 10 b) saturation 1 c) brightness 1
  • 34. startshape PLANT shape PLANT { BL [ h 10 sat 1 b 1 ] } shape BL { CIRCLE [ ] BL [size (0.95) y 1 ] } Recursion: We introduce an operation after the CIRCLE, which the program applies in a loop (until the shapes are too small to be rendered, then it stops). The new line is effectively, updating itself (shape BL) scaling down its size and moving in the y axis 1 unit up
  • 35. startshape PLANT shape PLANT { BL [ h 10 sat 1 b 1 ] } shape BL { CIRCLE [ ] BL [size (0.95) y 1 x 1 ] } Recursion: Now each new shape is moved one unit up and one unit right on every step
  • 36. startshape PLANT shape PLANT { BL [ h 10 sat 1 b 1 ] } shape BL rule { CIRCLE [ ] BL [size (0.95) y 1 x 1] } Randomness: This is exactly the same code as before, it just shows that shapes can have more than one operations, i.e., “rules”. Here BL has a single rule, the same as the previous step
  • 37. startshape PLANT shape PLANT { BL [ h 10 sat 1 b 1 ] } shape BL rule { CIRCLE [ ] BL [size (0.95) y 1 ] } rule { CIRCLE [ ] BL [size (0.95) x 1 ] } Randomness: Now the fun begins: randomness. When two rules are defined for a shape, then the software chooses randomly only one of them to execute. The results start being a bit unpredictable…
  • 38. startshape PLANT shape PLANT { BL [ h 10 sat 1 b 1 ] } shape BL rule { CIRCLE [ ] BL [ rotate randint(0, 8) size (0.95) y 1 ] } rule { CIRCLE [ ] BL [ rotate randint(0, 8) size (0.95) x 1 ] } More randomness: Now we also add a random rotation (an integer value between 0 and 8), so every time that the code is executed, it renders a slightly different image: overall the same logic, but with the specific details different every time.
  • 39. startshape PLANT shape PLANT { BL [ sat 1 b 1 ] } shape BL rule { CIRCLE [ ] BL [ h randint(0, 360) rotate randint(0, 8) size (0.95) y 1 ] } rule { CIRCLE [ ] BL [ h randint(0, 360) rotate randint(0, 8) size (0.95) x 1 ] } Even more randomness: We take the hue parameter out from the BL definition in “shape PLANT” and make it random too every time BL is called in a rule. But now the code is getting “messy” and things are duplicated… let’s do some cleaning next
  • 40. startshape PLANT shape PLANT { BL [ sat 1 b 1 ] } shape BL { CIRCLE [ ] WL [ size (0.985) y 1 ] } shape WL rule { BL [ h randint(0, 360) rotate randint(0, 8)] } Recursion between shapes: Compare the code with the previous version. Shape BL now declares a circle and calls shape WL with a change in size and location in y axis And shape WL has one rule where it calls shape BL with a change in hue and rotation. The program continues with this recursive loop until it can’t render new shapes because they are too small
  • 41. startshape PLANT shape PLANT { BL [ sat 1 b 1 ] } shape BL { CIRCLE [ ] WL [ size (0.985) y 1 ] } shape WL rule 50 { BL [ h randint(0, 360) rotate randint(0, 8)] } rule { BRANCH [] } shape BRANCH { BL [ rotate 1 flip 90] BL [ rotate -1 flip 90] } Recursion between shapes: The advantage of separating and calling shapes recursively, is that we can create routines with several rules, each with a “weight” or probability of being chosen and executed. This is how the shape BRANCH looks, and we add a weight of 50 to the rule that calls shape BL. Now every instance looks quite different! (within a shared generative grammar)
  • 42. Download and install: https://www.contextfreeart.org To Do: - Play with the code - Document and share your results in your blog Credits: Chris Coyne designed the CFDG grammar and wrote the original command-line version. Mark Lentczner saw Chris' site and decided he had to have an interactive version. He is responsible for the Macintosh version. John Horigan got sucked into this project and it immediately ate all of his spare time. He wrote the Windows version. Mark and John jointly maintain the common code base and the Posix/Unix version.