@genocode/core 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ast.d.ts +17 -1
- package/dist/ast.d.ts.map +1 -1
- package/dist/ast.js.map +1 -1
- package/dist/builtins.d.ts +1 -1
- package/dist/builtins.d.ts.map +1 -1
- package/dist/builtins.js +5 -2
- package/dist/builtins.js.map +1 -1
- package/dist/checker.d.ts +10 -1
- package/dist/checker.d.ts.map +1 -1
- package/dist/checker.js +102 -2
- package/dist/checker.js.map +1 -1
- package/dist/colour.d.ts +1 -1
- package/dist/colour.d.ts.map +1 -1
- package/dist/colour.js +8 -4
- package/dist/colour.js.map +1 -1
- package/dist/format.d.ts.map +1 -1
- package/dist/format.js +37 -3
- package/dist/format.js.map +1 -1
- package/dist/genetics.d.ts.map +1 -1
- package/dist/genetics.js +3 -1
- package/dist/genetics.js.map +1 -1
- package/dist/help.d.ts.map +1 -1
- package/dist/help.js +30 -3
- package/dist/help.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/interpreter.js +3 -1
- package/dist/interpreter.js.map +1 -1
- package/dist/lexer.d.ts.map +1 -1
- package/dist/lexer.js +1 -0
- package/dist/lexer.js.map +1 -1
- package/dist/parser.js +48 -2
- package/dist/parser.js.map +1 -1
- package/dist/values.d.ts +2 -0
- package/dist/values.d.ts.map +1 -1
- package/dist/values.js +1 -1
- package/dist/values.js.map +1 -1
- package/package.json +1 -1
- package/reference/LANGUAGE.md +61 -8
- package/reference/creatures/Alien.genie +653 -0
- package/reference/creatures/Breeze.genie +386 -0
- package/reference/creatures/Cobra.genie +386 -0
- package/reference/creatures/Flowerball.genie +302 -39
- package/reference/creatures/FlyingFish.genie +786 -0
- package/reference/creatures/Genes.genie +470 -0
- package/reference/creatures/Genie.genie +548 -0
- package/reference/creatures/Greenbay.genie +786 -0
- package/reference/creatures/Jellyfish.genie +472 -0
- package/reference/creatures/Monster.genie +594 -0
- package/reference/creatures/Neuron.genie +649 -0
- package/reference/creatures/Octoplant.genie +334 -0
- package/reference/creatures/Parasite.genie +393 -0
- package/reference/creatures/Pesky.genie +473 -0
- package/reference/creatures/Phoenix.genie +294 -0
- package/reference/creatures/Picstix.genie +1788 -0
- package/reference/creatures/Psybat.genie +602 -0
- package/reference/creatures/Star.genie +339 -0
- package/reference/creatures/Starfish.genie +458 -0
- package/reference/creatures/Transformer.genie +297 -0
- package/reference/creatures/TwoByTwo.genie +547 -0
- package/reference/creatures/Flower.genie +0 -41
- package/reference/creatures/Flyer.genie +0 -142
- package/reference/creatures/StarBurstShell.genie +0 -102
- package/reference/creatures/StarBurstShell9.genie +0 -102
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
creature Flyer
|
|
2
|
-
// A little bird that beats its wings and bobs as time goes by.
|
|
3
|
-
|
|
4
|
-
gene body = hsv(200, 0.7, 0.9) in hsv(0, 0.3, 0.5)..hsv(360, 1, 1)
|
|
5
|
-
gene tips = hsv(320, 0.7, 1) in hsv(0, 0.3, 0.5)..hsv(360, 1, 1)
|
|
6
|
-
gene flap = 35 in 0..70 // how far the wings beat
|
|
7
|
-
gene speed = 1.5 in 0.2..4 log // wing beats per second
|
|
8
|
-
gene span = 6 in 3..12 step 1 // feathers in each wing
|
|
9
|
-
gene tailWag = 25 in 0..50 // How wide the tail swings
|
|
10
|
-
gene beakLength = 0.6 in 0.2..1.2 // Length of the beak
|
|
11
|
-
gene crestSize = 0.8 in 0.3..1.5 // Scale of the feather crest
|
|
12
|
-
|
|
13
|
-
let skin = gradient(body, tips)
|
|
14
|
-
|
|
15
|
-
move (0, 0.3 * wave(time * speed), 0)
|
|
16
|
-
pitch 35 // lean towards the viewer, so the wings show
|
|
17
|
-
|
|
18
|
-
branch {
|
|
19
|
-
colour body
|
|
20
|
-
lay { grow (1.6, 1.4, 2.2) }
|
|
21
|
-
forward 1.2
|
|
22
|
-
move (0, 0.5, 0)
|
|
23
|
-
lay { grow 1.1 }
|
|
24
|
-
|
|
25
|
-
// ATTACH HEAD FEATURES HERE:
|
|
26
|
-
headFeatures
|
|
27
|
-
|
|
28
|
-
colour tips
|
|
29
|
-
shape cone
|
|
30
|
-
forward 0.7
|
|
31
|
-
lay { grow (0.3, 0.3, 0.6) }
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// A part call doesn't put the turtle back, so branch: otherwise the wings
|
|
35
|
-
// would grow from the tip of the tail, turned and drawn as cones
|
|
36
|
-
branch {
|
|
37
|
-
// Shift slightly backward to attach to the rear of the body
|
|
38
|
-
move (0, 0, -1.0)
|
|
39
|
-
tail
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
symmetric x {
|
|
43
|
-
wing
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
part wing {
|
|
47
|
-
yaw 90
|
|
48
|
-
forward 0.6
|
|
49
|
-
pitch -flap * wave(time * speed)
|
|
50
|
-
repeat span as i {
|
|
51
|
-
colour skin(i / (span - 1))
|
|
52
|
-
forward 0.45
|
|
53
|
-
lay { grow (0.7, 0.15, 0.9 - 0.05 * i) }
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
background {
|
|
58
|
-
fill gradient(hsv(220, 0.6, 0.15), hsv(200, 0.5, 0.45))
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
part tail {
|
|
62
|
-
// Face backward (away from the head/body direction)
|
|
63
|
-
yaw 180
|
|
64
|
-
|
|
65
|
-
// Create a chain of 4 tail segments
|
|
66
|
-
repeat 4 as i {
|
|
67
|
-
// Side-to-side wagging
|
|
68
|
-
yaw tailWag * wave(time * speed)
|
|
69
|
-
|
|
70
|
-
// Up-and-down vertical motion (offset by 0.25 time cycles for a fluid, organic wave)
|
|
71
|
-
pitch tailWag * wave((time + 0.25) * speed)
|
|
72
|
-
|
|
73
|
-
// Move to the next joint position
|
|
74
|
-
forward 0.4
|
|
75
|
-
|
|
76
|
-
// Assign color blending from body to tips based on segment index
|
|
77
|
-
colour skin(i / 3)
|
|
78
|
-
|
|
79
|
-
// Render a basic 3D shape
|
|
80
|
-
shape cone
|
|
81
|
-
|
|
82
|
-
// Shrink the thickness (X and Y) as it gets closer to the tip
|
|
83
|
-
lay { grow (0.6 - 0.1 * i, 0.6 - 0.1 * i, 0.5) }
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
// --- FIN / FEATHER TIP ---
|
|
87
|
-
// Move slightly forward past the last segment to place the fin
|
|
88
|
-
forward 0.3
|
|
89
|
-
|
|
90
|
-
// Switch completely to the accent tip color
|
|
91
|
-
colour tips
|
|
92
|
-
|
|
93
|
-
// Orient the fin flat/horizontal (pitch) or vertical (yaw) depending on style
|
|
94
|
-
pitch 90
|
|
95
|
-
|
|
96
|
-
// Create a wide, flat decorative fin shape
|
|
97
|
-
shape cone
|
|
98
|
-
lay { grow (1.2, 0.1, 0.8) }
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
part headFeatures {
|
|
102
|
-
// 1. THE BEAK
|
|
103
|
-
branch {
|
|
104
|
-
// Move to the very front tip of the head
|
|
105
|
-
forward 0.6
|
|
106
|
-
|
|
107
|
-
// Give the beak a sharp accent color
|
|
108
|
-
colour tips
|
|
109
|
-
|
|
110
|
-
// Face forward and point outward
|
|
111
|
-
pitch -90
|
|
112
|
-
|
|
113
|
-
// Scale it to be long, narrow, and sharp
|
|
114
|
-
shape cone
|
|
115
|
-
lay { grow (0.25, 0.25, beakLength) }
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
// 2. THE HEAD CREST (FEATHERS)
|
|
119
|
-
branch {
|
|
120
|
-
// Move to the top-back area of the head
|
|
121
|
-
move (0, 0.5, -0.2)
|
|
122
|
-
|
|
123
|
-
// Rotate backward slightly for a swept-back look
|
|
124
|
-
pitch -35
|
|
125
|
-
|
|
126
|
-
// Create a layered crest of 3 feathers
|
|
127
|
-
repeat 3 as i {
|
|
128
|
-
// Fan the feathers out sequentially backwards
|
|
129
|
-
pitch -15
|
|
130
|
-
|
|
131
|
-
// Alternating colors for a layered look
|
|
132
|
-
colour skin(i / 2)
|
|
133
|
-
|
|
134
|
-
// Move up for each feather layer
|
|
135
|
-
move (0, 0.2, 0)
|
|
136
|
-
|
|
137
|
-
// Render a flat, elongated feather shape
|
|
138
|
-
shape cone
|
|
139
|
-
lay { grow (0.15, crestSize - 0.2 * i, 0.6) }
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
}
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
creature StarBurstShell
|
|
2
|
-
// A spiraling geometric shell composed of bead spikes that unfurls into a sprawling celestial star.
|
|
3
|
-
// Fixed color gene ranges and reserved keyword variables.
|
|
4
|
-
|
|
5
|
-
gene unfurl = 0.45 in 0..1 // 0 packs the spikes into a tight spiral shell; 1 explodes them into a star
|
|
6
|
-
gene gloss = 0.75 in 0..1 // intensity of the metallic shell sheen
|
|
7
|
-
gene focus = 0.40 in 0..1 // sharpness of the light reflections
|
|
8
|
-
gene heightOffset = 8.0 in -15..15 // vertical expansion amplitude as it opens
|
|
9
|
-
|
|
10
|
-
shine gloss
|
|
11
|
-
sharpness focus
|
|
12
|
-
|
|
13
|
-
// Wrap the top-level part call in a branch to protect downstream rendering
|
|
14
|
-
branch {
|
|
15
|
-
shellSpikes
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
forward heightOffset * unfurl
|
|
19
|
-
pitch 90
|
|
20
|
-
|
|
21
|
-
// Generate 6 primary crown spikes circling the top axis
|
|
22
|
-
repeat 6 {
|
|
23
|
-
branch {
|
|
24
|
-
crownSpike
|
|
25
|
-
}
|
|
26
|
-
yaw 60
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// The core body structure: 10 concentric, winding layers of beads
|
|
30
|
-
part shellSpikes {
|
|
31
|
-
gene maxRadius = 12 in 5..20
|
|
32
|
-
gene baseBeadSize = 0.75 in 0.2..1.5
|
|
33
|
-
|
|
34
|
-
// Galactic neon palette gradient with mandatory range specifications
|
|
35
|
-
gene coreColor = hsv(240, 0.85, 0.2) in hsv(0, 0, 0)..hsv(360, 1, 1) // Deep space blue
|
|
36
|
-
gene midColor1 = hsv(300, 0.90, 0.5) in hsv(0, 0, 0)..hsv(360, 1, 1) // Cosmic magenta
|
|
37
|
-
gene midColor2 = hsv(340, 0.95, 0.8) in hsv(0, 0, 0)..hsv(360, 1, 1) // Electric pink
|
|
38
|
-
gene outerColor = hsv(15, 0.80, 0.95) in hsv(0, 0, 0)..hsv(360, 1, 1) // Nebula orange
|
|
39
|
-
|
|
40
|
-
let skin = gradient(coreColor, midColor1, midColor2, outerColor)
|
|
41
|
-
shape ball
|
|
42
|
-
|
|
43
|
-
repeat 10 as layer {
|
|
44
|
-
let latAngle = 180 * layer / 10
|
|
45
|
-
colour skin(layer / 10)
|
|
46
|
-
|
|
47
|
-
// As unfurl approaches 1, structural layout transitions from flat spirals to a wide-latitude sphere
|
|
48
|
-
let distance = mix(layer, sin(latAngle) * maxRadius, unfurl)
|
|
49
|
-
let verticalZ = unfurl * cos(latAngle) * maxRadius
|
|
50
|
-
let stepCount = tau * layer
|
|
51
|
-
|
|
52
|
-
repeat floor(stepCount) as s {
|
|
53
|
-
let lonAngle = 360 * s / stepCount
|
|
54
|
-
|
|
55
|
-
branch {
|
|
56
|
-
// Positional placement using standard trigonometric displacement
|
|
57
|
-
move (distance * cos(lonAngle), distance * sin(lonAngle), verticalZ)
|
|
58
|
-
lay { grow baseBeadSize }
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// A twisting, needle-sharp spike branch that reacts heavily to the unfurl gene
|
|
65
|
-
part crownSpike {
|
|
66
|
-
gene twistFactor = 1.25 in -3..3 // how sharply the crown arms curve outward
|
|
67
|
-
|
|
68
|
-
// Crown color parameters with mandatory range specifications
|
|
69
|
-
gene rootColor = hsv(160, 0.70, 0.6) in hsv(0, 0, 0)..hsv(360, 1, 1) // Turquoise heart
|
|
70
|
-
gene bodyColor = hsv(200, 0.80, 0.8) in hsv(0, 0, 0)..hsv(360, 1, 1) // Cyan mid-section
|
|
71
|
-
gene flareColor = hsv(280, 0.85, 0.7) in hsv(0, 0, 0)..hsv(360, 1, 1) // Violet edge
|
|
72
|
-
gene apexColor = hsv(0, 0.0, 1.0) in hsv(0, 0, 0)..hsv(360, 1, 1) // Pure white tips
|
|
73
|
-
|
|
74
|
-
let skin = gradient(rootColor, bodyColor, flareColor, apexColor)
|
|
75
|
-
|
|
76
|
-
branch {
|
|
77
|
-
forward 3.0
|
|
78
|
-
pitch -25
|
|
79
|
-
yaw 15
|
|
80
|
-
roll 45
|
|
81
|
-
shape ball
|
|
82
|
-
|
|
83
|
-
// Iteratively chain 25 progressively scaling segments to build a fine tip
|
|
84
|
-
for segment from 1 to 25 {
|
|
85
|
-
let taper = bump(segment / 26) // custom envelope tracking
|
|
86
|
-
colour skin(taper)
|
|
87
|
-
|
|
88
|
-
yaw 8
|
|
89
|
-
branch {
|
|
90
|
-
forward 0.15
|
|
91
|
-
pitch 45 * taper * twistFactor
|
|
92
|
-
// Drastically changes length/width profile when unrolled
|
|
93
|
-
lay { grow (unfurl, unfurl, unfurl * 4 * (taper + 0.5)) }
|
|
94
|
-
}
|
|
95
|
-
move (0.35 * unfurl, 0, 0)
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
background {
|
|
101
|
-
fill gradient(hsv(275, 0.6, 0.08), hsv(220, 0.5, 0.25))
|
|
102
|
-
}
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
creature StarBurstShell
|
|
2
|
-
// A spiraling geometric shell composed of bead spikes that unfurls into a sprawling celestial star.
|
|
3
|
-
// Fixed color gene ranges and reserved keyword variables.
|
|
4
|
-
|
|
5
|
-
gene unfurl = 0.2016 in 0..1 // 0 packs the spikes into a tight spiral shell; 1 explodes them into a star
|
|
6
|
-
gene gloss = 0.5104 in 0..1 // intensity of the metallic shell sheen
|
|
7
|
-
gene focus = 0.3599 in 0..1 // sharpness of the light reflections
|
|
8
|
-
gene heightOffset = 9.545 in -15..15 // vertical expansion amplitude as it opens
|
|
9
|
-
|
|
10
|
-
shine gloss
|
|
11
|
-
sharpness focus
|
|
12
|
-
|
|
13
|
-
// Wrap the top-level part call in a branch to protect downstream rendering
|
|
14
|
-
branch {
|
|
15
|
-
shellSpikes
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
forward heightOffset * unfurl
|
|
19
|
-
pitch 90
|
|
20
|
-
|
|
21
|
-
// Generate 6 primary crown spikes circling the top axis
|
|
22
|
-
repeat 6 {
|
|
23
|
-
branch {
|
|
24
|
-
crownSpike
|
|
25
|
-
}
|
|
26
|
-
yaw 60
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// The core body structure: 10 concentric, winding layers of beads
|
|
30
|
-
part shellSpikes {
|
|
31
|
-
gene maxRadius = 10.95 in 5..20
|
|
32
|
-
gene baseBeadSize = 0.6653 in 0.2..1.5
|
|
33
|
-
|
|
34
|
-
// Galactic neon palette gradient with mandatory range specifications
|
|
35
|
-
gene coreColor = hsv(240, 0.85, 0.2) in hsv(0, 0, 0)..hsv(360, 1, 1) // Deep space blue
|
|
36
|
-
gene midColor1 = hsv(300, 0.87, 0.49) in hsv(0, 0, 0)..hsv(360, 1, 1) // Cosmic magenta
|
|
37
|
-
gene midColor2 = hsv(35.9, 0.81, 0.71) in hsv(0, 0, 0)..hsv(360, 1, 1) // Electric pink
|
|
38
|
-
gene outerColor = hsv(38.8, 0.79, 0.75) in hsv(0, 0, 0)..hsv(360, 1, 1) // Nebula orange
|
|
39
|
-
|
|
40
|
-
let skin = gradient(coreColor, midColor1, midColor2, outerColor)
|
|
41
|
-
shape ball
|
|
42
|
-
|
|
43
|
-
repeat 10 as layer {
|
|
44
|
-
let latAngle = 180 * layer / 10
|
|
45
|
-
colour skin(layer / 10)
|
|
46
|
-
|
|
47
|
-
// As unfurl approaches 1, structural layout transitions from flat spirals to a wide-latitude sphere
|
|
48
|
-
let distance = mix(layer, sin(latAngle) * maxRadius, unfurl)
|
|
49
|
-
let verticalZ = unfurl * cos(latAngle) * maxRadius
|
|
50
|
-
let stepCount = tau * layer
|
|
51
|
-
|
|
52
|
-
repeat floor(stepCount) as s {
|
|
53
|
-
let lonAngle = 360 * s / stepCount
|
|
54
|
-
|
|
55
|
-
branch {
|
|
56
|
-
// Positional placement using standard trigonometric displacement
|
|
57
|
-
move (distance * cos(lonAngle), distance * sin(lonAngle), verticalZ)
|
|
58
|
-
lay { grow baseBeadSize }
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// A twisting, needle-sharp spike branch that reacts heavily to the unfurl gene
|
|
65
|
-
part crownSpike {
|
|
66
|
-
gene twistFactor = 1.161 in -3..3 // how sharply the crown arms curve outward
|
|
67
|
-
|
|
68
|
-
// Crown color parameters with mandatory range specifications
|
|
69
|
-
gene rootColor = hsv(184.3, 0.71, 0.68) in hsv(0, 0, 0)..hsv(360, 1, 1) // Turquoise heart
|
|
70
|
-
gene bodyColor = hsv(184.8, 0.8, 0.76) in hsv(0, 0, 0)..hsv(360, 1, 1) // Cyan mid-section
|
|
71
|
-
gene flareColor = hsv(253.4, 0.74, 0.7) in hsv(0, 0, 0)..hsv(360, 1, 1) // Violet edge
|
|
72
|
-
gene apexColor = hsv(0, 0.03, 1) in hsv(0, 0, 0)..hsv(360, 1, 1) // Pure white tips
|
|
73
|
-
|
|
74
|
-
let skin = gradient(rootColor, bodyColor, flareColor, apexColor)
|
|
75
|
-
|
|
76
|
-
branch {
|
|
77
|
-
forward 3.0
|
|
78
|
-
pitch -25
|
|
79
|
-
yaw 15
|
|
80
|
-
roll 45
|
|
81
|
-
shape ball
|
|
82
|
-
|
|
83
|
-
// Iteratively chain 25 progressively scaling segments to build a fine tip
|
|
84
|
-
for segment from 1 to 25 {
|
|
85
|
-
let taper = bump(segment / 26) // custom envelope tracking
|
|
86
|
-
colour skin(taper)
|
|
87
|
-
|
|
88
|
-
yaw 8
|
|
89
|
-
branch {
|
|
90
|
-
forward 0.15
|
|
91
|
-
pitch 45 * taper * twistFactor
|
|
92
|
-
// Drastically changes length/width profile when unrolled
|
|
93
|
-
lay { grow (unfurl, unfurl, unfurl * 4 * (taper + 0.5)) }
|
|
94
|
-
}
|
|
95
|
-
move (0.35 * unfurl, 0, 0)
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
background {
|
|
101
|
-
fill gradient(hsv(275, 0.6, 0.08), hsv(220, 0.5, 0.25))
|
|
102
|
-
}
|