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F+F-F-F-F+F+F-F-F-F+F+F-F+F-F+F+F-F+F-F+F+F-F-F-F+F+F-F"
System No.2 'Subway':
VOCAB:
F= Forward(18);
B = Right(45), Forward(18);
+ = Right(45); - = Left(45);
[ = push(); ] =pop()
AXIOM: "B"
RULES: ('F', "FF[B]"); ('B', "F[-BF]F[+FB]F")
n=1: F[-BF]F[+FB]F
n=2: FF[B][-F[-BF]F[+FB]FFF[B]]FF[B][+FF[B]F[-BF]F[+FB]F]FF[B]
n=3: FF[B]FF[B][F[-BF]F[+FB]F][-FF[B][-F[-BF]F[+FB]FFF[B]]FF[B][+FF[B]F[-BF]F[+FB]F]FF[B]FF[B]FF[B][F[-BF]F[+FB]F]]FF[B]FF[B][F[-BF]F[+FB]F][+FF[B]FF[B][F[-BF]F[+FB]F]FF[B][-F[-BF]F[+FB]FFF[B]]FF[B][+FF[B]F[-BF]F[+FB]F]FF[B]]FF[B]FF[B][F[-BF]F[+FB]F]
System No.3 "Hexagons":
VOCAB:
F= Forward(30);
B = Right(60), Forward(30);
+ = Right(60); - = Left(60);
[ = push(); ] =pop()
AXIOM: "F+F"
RULES: ('F', "FB+F[F-F]-F[BB]FFF"); ('B', "B+B")
n=1: "FB+F[F-F]-F[BB]FFF+FB+F[F-F]-F[BB]FFF"
n=2: "FB+F[F-F]-F[BB]FFFB+B+FB+F[F-F]-F[BB]FFF[FB+F[F-F]-F[BB]FFF-FB+F[F-F]-F[BB]FFF]-FB+F[F-F]-F[BB]FFF[B+BB+B]FB+F[F-F]-F[BB]FFFFB+F[F-F]-F[BB]FFFFB+F[F-F]-F[BB]FFF+FB+F[F-F]-F[BB]FFFB+B+FB+F[F-F]-F[BB]FFF[FB+F[F-F]-F[BB]FFF-FB+F[F-F]-F[BB]FFF]-FB+F[F-F]-F[BB]FFF[B+BB+B]FB+F[F-F]-F[BB]FFFFB+F[F-F]-F[BB]FFFFB+F[F-F]-F[BB]FFF"
n=3: "FB+F[F-F]-F[BB]FFFB+B+FB+F[F-F]-F[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FFFFB+F[F-F]-F[BB]FFFFB+F[F-F]-F[BB]FFF[B+B+B+BB+B+B+B]FB+F[F-F]-F[BB]FFFB+B+FB+F[F-F]-F[BB]FFF[FB+F[F-F]-F[BB]FFF-FB+F[F-F]-F[BB]FFF]-FB+F[F-F]-F[BB]FFF[B+BB+B]FB+F[F-F]-F[BB]FFFFB+F[F-F]-F[BB]FFFFB+F[F-F]-F[BB]FFFFB+F[F-F]-F[BB]FFFB+B+FB+F[F-F]-F[BB]FFF[FB+F[F-F]-F[BB]FFF-FB+F[F-F]-F[BB]FFF]-FB+F[F-F]-F[BB]FFF[B+BB+B]FB+F[F-F]-F[BB]FFFFB+F[F-F]-F[BB]FFFFB+F[F-F]-F[BB]FFFFB+F[F-F]-F[BB]FFFB+B+FB+F[F-F]-F[BB]FFF[FB+F[F-F]-F[BB]FFF-FB+F[F-F]-F[BB]FFF]-FB+F[F-F]-F[BB]FFF[B+BB+B]FB+F[F-F]-F[BB]FFFFB+F[F-F]-F[BB]FFFFB+F[F-F]-F[BB]FFF"
TASK FOUR: FABRICATE
LASER ETCHING
Left: "Subways" on Cedar
Right: "Triangles" on Acrylic
EXTRA CREDIT: PROBABLILISTIC L-SYSTEMS
PROBABLILISTIC SYSTEM ONE:
"B+B"
RULES:
RULES:
float randomNum = random(1,10);
float moveDist = randomNum;
float rotateAngle = 10*randomNum;
float moveDist = randomNum;
float rotateAngle = 10*randomNum;
('F', "FF[B]");
('B', "FF[+B][-B]F");
('B', "FF[+B][-B]F");
OUTPUT
PROBABLILISTIC SYSTEM TWO:
"B+B"
RULES:
RULES:
float moveDist = 10;
float rotateAngle = 40;
float rotateAngle = 40;
('F', "FF[B]");
('B', "FF[+B][-B]F");
('B', "FF[+B][-B]F");
float P = random(1);
for (int i = 0; i < current.length(); i++) {
char c = current.charAt(i);
for (int i = 0; i < current.length(); i++) {
char c = current.charAt(i);
if (P < .33) {
// Apply replacement rules based on the current character
if (c == 'F') {
replacement = "F[B]"; } // Apply the rule for 'F'
else if (c == 'B') {
replacement = "F[-B]"; } // Apply the rule for 'B'
else {
replacement = String.valueOf(c); // No rule, keep the character unchanged
}
}
else if (P > .66) {
if (c == 'F') {
replacement = "FF[B]"; } // Apply the rule for 'F'
else if (c == 'B') {
replacement = "FF[+B][-B]F"; } // Apply the rule for 'B'
else {
replacement = String.valueOf(c); // No rule, keep the character unchanged
}
}
else {
replacement = String.valueOf(c); // No rule, keep the character unchanged
}
// Apply replacement rules based on the current character
if (c == 'F') {
replacement = "F[B]"; } // Apply the rule for 'F'
else if (c == 'B') {
replacement = "F[-B]"; } // Apply the rule for 'B'
else {
replacement = String.valueOf(c); // No rule, keep the character unchanged
}
}
else if (P > .66) {
if (c == 'F') {
replacement = "FF[B]"; } // Apply the rule for 'F'
else if (c == 'B') {
replacement = "FF[+B][-B]F"; } // Apply the rule for 'B'
else {
replacement = String.valueOf(c); // No rule, keep the character unchanged
}
}
else {
replacement = String.valueOf(c); // No rule, keep the character unchanged
}
OUTPUT