Teaching Aid

Two blocks of rules

 

 
Copy/Paste the following code to your GroIMP project:
//**********************************************************
/* You will learn with this example:
– how to make several blocks of rules accessible for
interactive use (call by the user)
– and the effects of using these rule blocks
Execute the rule blocks in varying ways, and modify them
*/

// Example of a simple tree architecture (Schoute architecture)

//———– Extension to the alphabet ————-
// Shoot() is an extension of the turtle command F() and stands
// for an annual shoot

module Shoot(float len) extends F(len);

// Bud is an extension of a sphere obeject and stands for a terminal bud

module Bud(float strength) extends Sphere(0.2)
{{ setShader(RED); setTransform(0, 0, 0.3); }};

//—————————————————-

// Start block with the start word
protected void init()
[
Axiom ==> Bud(5);
]

// first public block (appears in the menu as a button)
public void grow()
[
Bud(x), (x > 2) ==> Shoot(x) [ RU(50) Bud(0.7*x) ] [ RU(-50) Bud(0.7*x) ] Bud(x);
]

// second public block (appears in the menue as a button)
public void die()
[
Bud(x), (x < 3) ==> ;
]

//**********************************************************

DATE: 2009

 

AUTHOR: W. Kurth

 

DESCRIPTION:  see model

 

Welcome to the website grogra.de. This site is the web centre of growth grammars of the Department Ecoinformatics, Biometrics and Forest Growth at the Georg-August University of Göttingen and its cooperation partners.

--- not found