SlideShare une entreprise Scribd logo
1  sur  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

Contenu connexe

Similaire à 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
 

Similaire à 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
 

Plus de R. 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
 
Design research in industry and academia Ricardo Sosa SUTD.pdf
Design research in industry and academia Ricardo Sosa SUTD.pdfDesign research in industry and academia Ricardo Sosa SUTD.pdf
Design research in industry and academia Ricardo Sosa SUTD.pdfR. Sosa
 

Plus de R. Sosa (20)

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
 
Design research in industry and academia Ricardo Sosa SUTD.pdf
Design research in industry and academia Ricardo Sosa SUTD.pdfDesign research in industry and academia Ricardo Sosa SUTD.pdf
Design research in industry and academia Ricardo Sosa SUTD.pdf
 

Dernier

Chapter 19_DDA_TOD Policy_First Draft 2012.pdf
Chapter 19_DDA_TOD Policy_First Draft 2012.pdfChapter 19_DDA_TOD Policy_First Draft 2012.pdf
Chapter 19_DDA_TOD Policy_First Draft 2012.pdfParomita Roy
 
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
 
Captivating Charm: Exploring Marseille's Hillside Villas with Our 3D Architec...
Captivating Charm: Exploring Marseille's Hillside Villas with Our 3D Architec...Captivating Charm: Exploring Marseille's Hillside Villas with Our 3D Architec...
Captivating Charm: Exploring Marseille's Hillside Villas with Our 3D Architec...Yantram Animation Studio Corporation
 
VIP College Call Girls Gorakhpur Bhavna 8250192130 Independent Escort Service...
VIP College Call Girls Gorakhpur Bhavna 8250192130 Independent Escort Service...VIP College Call Girls Gorakhpur Bhavna 8250192130 Independent Escort Service...
VIP College Call Girls Gorakhpur Bhavna 8250192130 Independent Escort Service...Suhani Kapoor
 
Design Portfolio - 2024 - William Vickery
Design Portfolio - 2024 - William VickeryDesign Portfolio - 2024 - William Vickery
Design Portfolio - 2024 - William VickeryWilliamVickery6
 
3D Printing And Designing Final Report.pdf
3D Printing And Designing Final Report.pdf3D Printing And Designing Final Report.pdf
3D Printing And Designing Final Report.pdfSwaraliBorhade
 
A level Digipak development Presentation
A level Digipak development PresentationA level Digipak development Presentation
A level Digipak development Presentationamedia6
 
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
 
Cheap Rate Call girls Malviya Nagar 9205541914 shot 1500 night
Cheap Rate Call girls Malviya Nagar 9205541914 shot 1500 nightCheap Rate Call girls Malviya Nagar 9205541914 shot 1500 night
Cheap Rate Call girls Malviya Nagar 9205541914 shot 1500 nightDelhi Call girls
 
How to Be Famous in your Field just visit our Site
How to Be Famous in your Field just visit our SiteHow to Be Famous in your Field just visit our Site
How to Be Famous in your Field just visit our Sitegalleryaagency
 
NO1 Famous Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi Add...
NO1 Famous Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi Add...NO1 Famous Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi Add...
NO1 Famous Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi Add...Amil baba
 
SCRIP Lua HTTP PROGRACMACION PLC WECON CA
SCRIP Lua HTTP PROGRACMACION PLC  WECON CASCRIP Lua HTTP PROGRACMACION PLC  WECON CA
SCRIP Lua HTTP PROGRACMACION PLC WECON CANestorGamez6
 
Revit Understanding Reference Planes and Reference lines in Revit for Family ...
Revit Understanding Reference Planes and Reference lines in Revit for Family ...Revit Understanding Reference Planes and Reference lines in Revit for Family ...
Revit Understanding Reference Planes and Reference lines in Revit for Family ...Narsimha murthy
 
VIP Russian Call Girls in Gorakhpur Deepika 8250192130 Independent Escort Ser...
VIP Russian Call Girls in Gorakhpur Deepika 8250192130 Independent Escort Ser...VIP Russian Call Girls in Gorakhpur Deepika 8250192130 Independent Escort Ser...
VIP Russian Call Girls in Gorakhpur Deepika 8250192130 Independent Escort Ser...Suhani Kapoor
 
Kala jadu for love marriage | Real amil baba | Famous amil baba | kala jadu n...
Kala jadu for love marriage | Real amil baba | Famous amil baba | kala jadu n...Kala jadu for love marriage | Real amil baba | Famous amil baba | kala jadu n...
Kala jadu for love marriage | Real amil baba | Famous amil baba | kala jadu n...babafaisel
 
WAEC Carpentry and Joinery Past Questions
WAEC Carpentry and Joinery Past QuestionsWAEC Carpentry and Joinery Past Questions
WAEC Carpentry and Joinery Past QuestionsCharles Obaleagbon
 
Best VIP Call Girls Noida Sector 47 Call Me: 8448380779
Best VIP Call Girls Noida Sector 47 Call Me: 8448380779Best VIP Call Girls Noida Sector 47 Call Me: 8448380779
Best VIP Call Girls Noida Sector 47 Call Me: 8448380779Delhi Call girls
 

Dernier (20)

Chapter 19_DDA_TOD Policy_First Draft 2012.pdf
Chapter 19_DDA_TOD Policy_First Draft 2012.pdfChapter 19_DDA_TOD Policy_First Draft 2012.pdf
Chapter 19_DDA_TOD Policy_First Draft 2012.pdf
 
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
 
Captivating Charm: Exploring Marseille's Hillside Villas with Our 3D Architec...
Captivating Charm: Exploring Marseille's Hillside Villas with Our 3D Architec...Captivating Charm: Exploring Marseille's Hillside Villas with Our 3D Architec...
Captivating Charm: Exploring Marseille's Hillside Villas with Our 3D Architec...
 
escort service sasti (*~Call Girls in Prasad Nagar Metro❤️9953056974
escort service sasti (*~Call Girls in Prasad Nagar Metro❤️9953056974escort service sasti (*~Call Girls in Prasad Nagar Metro❤️9953056974
escort service sasti (*~Call Girls in Prasad Nagar Metro❤️9953056974
 
VIP College Call Girls Gorakhpur Bhavna 8250192130 Independent Escort Service...
VIP College Call Girls Gorakhpur Bhavna 8250192130 Independent Escort Service...VIP College Call Girls Gorakhpur Bhavna 8250192130 Independent Escort Service...
VIP College Call Girls Gorakhpur Bhavna 8250192130 Independent Escort Service...
 
Design Portfolio - 2024 - William Vickery
Design Portfolio - 2024 - William VickeryDesign Portfolio - 2024 - William Vickery
Design Portfolio - 2024 - William Vickery
 
3D Printing And Designing Final Report.pdf
3D Printing And Designing Final Report.pdf3D Printing And Designing Final Report.pdf
3D Printing And Designing Final Report.pdf
 
A level Digipak development Presentation
A level Digipak development PresentationA level Digipak development Presentation
A level Digipak development Presentation
 
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...
 
Cheap Rate Call girls Malviya Nagar 9205541914 shot 1500 night
Cheap Rate Call girls Malviya Nagar 9205541914 shot 1500 nightCheap Rate Call girls Malviya Nagar 9205541914 shot 1500 night
Cheap Rate Call girls Malviya Nagar 9205541914 shot 1500 night
 
How to Be Famous in your Field just visit our Site
How to Be Famous in your Field just visit our SiteHow to Be Famous in your Field just visit our Site
How to Be Famous in your Field just visit our Site
 
NO1 Famous Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi Add...
NO1 Famous Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi Add...NO1 Famous Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi Add...
NO1 Famous Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi Add...
 
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
 
young call girls in Vivek Vihar🔝 9953056974 🔝 Delhi escort Service
young call girls in Vivek Vihar🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Vivek Vihar🔝 9953056974 🔝 Delhi escort Service
young call girls in Vivek Vihar🔝 9953056974 🔝 Delhi escort Service
 
SCRIP Lua HTTP PROGRACMACION PLC WECON CA
SCRIP Lua HTTP PROGRACMACION PLC  WECON CASCRIP Lua HTTP PROGRACMACION PLC  WECON CA
SCRIP Lua HTTP PROGRACMACION PLC WECON CA
 
Revit Understanding Reference Planes and Reference lines in Revit for Family ...
Revit Understanding Reference Planes and Reference lines in Revit for Family ...Revit Understanding Reference Planes and Reference lines in Revit for Family ...
Revit Understanding Reference Planes and Reference lines in Revit for Family ...
 
VIP Russian Call Girls in Gorakhpur Deepika 8250192130 Independent Escort Ser...
VIP Russian Call Girls in Gorakhpur Deepika 8250192130 Independent Escort Ser...VIP Russian Call Girls in Gorakhpur Deepika 8250192130 Independent Escort Ser...
VIP Russian Call Girls in Gorakhpur Deepika 8250192130 Independent Escort Ser...
 
Kala jadu for love marriage | Real amil baba | Famous amil baba | kala jadu n...
Kala jadu for love marriage | Real amil baba | Famous amil baba | kala jadu n...Kala jadu for love marriage | Real amil baba | Famous amil baba | kala jadu n...
Kala jadu for love marriage | Real amil baba | Famous amil baba | kala jadu n...
 
WAEC Carpentry and Joinery Past Questions
WAEC Carpentry and Joinery Past QuestionsWAEC Carpentry and Joinery Past Questions
WAEC Carpentry and Joinery Past Questions
 
Best VIP Call Girls Noida Sector 47 Call Me: 8448380779
Best VIP Call Girls Noida Sector 47 Call Me: 8448380779Best VIP Call Girls Noida Sector 47 Call Me: 8448380779
Best VIP Call Girls Noida Sector 47 Call Me: 8448380779
 

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.