sprout-garden-phase-7
Sprout Garden Phase 7: Harvests & Recipes
Accumulation and Synthesis - Collecting, filtering, and combining
Overview
Phase 7 introduces advanced harvests - plots that collect, filter, count, and combine sprouts. This teaches data aggregation, pipelines, and synthesis - turning raw ingredients into finished products.
This phase teaches: Collect many things. Combine them into new things. Build something greater than the parts.
Plot Types Introduced
| Plot | Symbol | Category | Behavior |
|---|---|---|---|
| Filter | π§Ή | selection | Only passes matching sprouts |
| Counter | π’ | aggregation | Counts sprouts, outputs count |
| Basket | π§Ί | collection | Holds until N sprouts arrive |
| Recipe Pot | π² | synthesis | Combines sprouts into new form |
| Splitter Emitter | π±βΏ | source | Emits N sprouts |
| Timed Emitter | π±β±οΈ | source | Emits one sprout every X ticks |
Filter Mechanics
Only passes sprouts matching criteria:
// "Only red sprouts pass"
redFilter = createFilter({ color: 'red' });
// "Only stars pass"
starFilter = createFilter({ shape: 'star' });
// "Only red stars pass"
redStarFilter = createFilter({ shape: 'star', color: 'red' }); π΄ ββββ
π’ ββββΌββββΆ [π§Ή red only] ββββΆ π΄
π΅ ββββ
(green and blue are blocked/discarded)Basket Mechanics
Holds sprouts until threshold reached:
basket = createBasket({
capacity: 5,
releaseMode: 'all' // or 'first', 'random'
}); π± ββββΆ [π§Ί need 5] ββββΆ (nothing yet)
π± ββββΆ [π§Ί need 4] ββββΆ (nothing yet)
π± ββββΆ [π§Ί need 3] ββββΆ (nothing yet)
π± ββββΆ [π§Ί need 2] ββββΆ (nothing yet)
π± ββββΆ [π§Ί need 1] ββββΆ π±π±π±π±π± (all release!)Use case: Synchronize multiple streams before continuing.
Recipe Pot Mechanics
Combines specific sprouts into new form:
recipe:
name: "Build a Car"
requires:
- { shape: 'star', color: 'red', count: 4 } # 4 red stars (wheels)
- { shape: 'square', color: 'blue', count: 1 } # 1 blue square (body)
produces:
shape: 'car'
color: 'red' β
π΄ ββββ
β
π΄ ββββ€
β
π΄ ββββΌββββΆ [π² car recipe] ββββΆ ππ΄
β
π΄ ββββ€
β π΅ ββββThe magic moment: Five simple shapes become a car!
Counter Mechanics
Counts sprouts and outputs the count:
counter = createCounter({
outputMode: 'continuous', // Output count after each sprout
// or 'final' // Output count at end
}); π± ββββΆ [π’] ββββΆ "1"
π± ββββΆ [π’] ββββΆ "2"
π± ββββΆ [π’] ββββΆ "3"Use case: "How many red sprouts came through?"
Emitter Modes
Burst Emitter (π±βΏ)
burstEmitter = createSpring({
mode: 'burst',
count: 5,
emits: { shape: 'circle', color: 'red' }
});
// Emits 5 sprouts at once on tick 0Timed Emitter (π±β±οΈ)
timedEmitter = createSpring({
mode: 'timed',
interval: 3, // Every 3 ticks
emits: { shape: 'circle', color: 'red' }
});
// Emits 1 sprout every 3 ticksContinuous Emitter (π±β)
continuousEmitter = createSpring({
mode: 'continuous',
emits: { shape: 'circle', color: 'red' }
});
// Emits 1 sprout every tick until stoppedSource Files (To Be Created)
| File | Purpose |
|---|---|
src/plots/types/filter.js |
Property-based filtering |
src/plots/types/counter.js |
Sprout counting |
src/plots/types/basket.js |
Collect N before release |
src/plots/types/recipe-pot.js |
Combine into new forms |
src/core/recipes.js |
Recipe definitions |
API Documentation
files:
- /Users/graemefawcett/working/ben.fawcett.family/activities/sprout-garden/src/plots/types/filter.js
- /Users/graemefawcett/working/ben.fawcett.family/activities/sprout-garden/src/plots/types/counter.js
- /Users/graemefawcett/working/ben.fawcett.family/activities/sprout-garden/src/plots/types/basket.js
- /Users/graemefawcett/working/ben.fawcett.family/activities/sprout-garden/src/plots/types/recipe-pot.jsβ Fence Execution Error: "'code-api-docs' - Down the rabbit hole we went, but that node doesn't exist! Try 'oculus list' to see what's available."
Implementation Notes
Recipe System
// recipes.js
export const RECIPES = {
'car': {
requires: [
{ shape: 'star', color: 'red', count: 4 },
{ shape: 'square', color: 'blue', count: 1 }
],
produces: { shape: 'car', color: 'red' }
},
'house': {
requires: [
{ shape: 'square', color: 'red', count: 4 },
{ shape: 'triangle', color: 'blue', count: 1 }
],
produces: { shape: 'house', color: 'red' }
},
'rainbow': {
requires: [
{ color: 'red', count: 1 },
{ color: 'green', count: 1 },
{ color: 'blue', count: 1 },
{ color: 'yellow', count: 1 }
],
produces: { shape: 'rainbow', color: 'multi' }
}
};Recipe Pot State
recipePot.state = {
collected: [],
recipe: RECIPES['car']
};
recipePot.receive(sprout) {
this.state.collected.push(sprout);
if (this.checkRecipeComplete()) {
const product = this.synthesize();
this.state.collected = [];
this.emit(product);
}
}
recipePot.checkRecipeComplete() {
for (const requirement of this.state.recipe.requires) {
const matches = this.state.collected.filter(s =>
(!requirement.shape || s.shape === requirement.shape) &&
(!requirement.color || s.color === requirement.color)
);
if (matches.length < requirement.count) {
return false;
}
}
return true;
}Level Ideas
| Level | Challenge | Teaches |
|---|---|---|
| 46 | Filter red from mixed | Selection |
| 47 | Count how many stars | Aggregation |
| 48 | Collect 5 in basket | Synchronization |
| 49 | Build your first car | Synthesis! |
| 50 | Build a house | Recipe variation |
| 51 | Sort then count each color | Pipeline |
| 52 | Build rainbow from all colors | Complex recipe |
| 53 | Factory: continuous car production | Automation |
| 54 | Optimize throughput | Efficiency |
| 55 | FINAL: Build the ultimate machine | Everything combined |
Pedagogy
What Kids Learn (Without Knowing It)
- Data pipelines: Filter β Transform β Aggregate
- Map/Filter/Reduce: The fundamental operations
- Synthesis: Combining ingredients
- Manufacturing: Continuous production
- Optimization: Throughput and efficiency
- Systems thinking: Everything connects
The Factory Floor
By Phase 7, kids have built a visual factory:
Raw materials (springs)
β
Transformation (growers)
β
Quality control (filters)
β
Assembly (recipe pots)
β
Output (harvest)They've built a data pipeline without knowing it.
The Grand Finale
Level 55: Build a machine that:
- Takes continuous input from multiple springs
- Filters by property
- Routes through forks
- Transforms through growers
- Synchronizes with logic gates
- Assembles with recipes
- Outputs finished products
They've built Factorio. They've built ETL. They've built Wanderland.
Verification
Live test results from [[sprout-garden-phase-7-test]]:
| Test | Status | Details |
|---|---|---|
| filter.js exists | fail | not yet implemented |
| counter.js exists | fail | not yet implemented |
| basket.js exists | fail | not yet implemented |
| recipe-pot.js exists | fail | not yet implemented |
| recipes.js exists | fail | not yet implemented |
Slots
North
slots:
- sprout-garden
- sprout-gardenSouth
slots:
- sprout-garden-phase-7-testEast
slots: []West
slots:
- sprout-garden-phase-6