-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes #1533 # Demo ``` scripts/test/run-tests.sh --test-options '--pattern "sow"' ``` or ``` scripts/play.sh -i data/scenarios/Testing/1533-sow-command.yaml --autoplay ``` ![Screenshot from 2024-05-03 19-12-08](https://github.com/swarm-game/swarm/assets/261693/52df7de4-c158-4973-b109-5337e38c35f1) ## Other changes * Introduced the `ChildInheritance` type to specify how the `Display` attribute is inherited by built child robots. * Introduce the `mature` property of `growth`. For example, it doesn't make much sense to plant an `acorn` and call the resulting, fully-grown plant also an `acorn`. Instead, an `acorn` matures into an `oak`.
- Loading branch information
Showing
17 changed files
with
549 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,195 @@ | ||
version: 1 | ||
name: Sow command and spread | ||
seed: 0 | ||
description: | | ||
Demonstrate `sow` command and spreading growth with biome restrictions. | ||
Illustrates different rates of spread for different crops. | ||
creative: false | ||
attrs: | ||
- name: clay | ||
fg: "#444444" | ||
bg: "#c2b280" | ||
- name: wheat | ||
fg: "#444444" | ||
bg: "#F5DEB3" | ||
- name: barley | ||
fg: "#444444" | ||
bg: "#F6E9B1" | ||
- name: maize | ||
fg: "#444444" | ||
bg: "#FBEC5D" | ||
- name: mint | ||
bg: "#3EB489" | ||
terrains: | ||
- name: clay | ||
attr: clay | ||
description: | | ||
Sandy soil | ||
objectives: | ||
- goal: | ||
- | | ||
Observe `kudzu`{=entity} spread | ||
condition: | | ||
r <- robotnamed "kudzubot"; | ||
as r { | ||
kCount <- resonate "kudzu" ((0, 0), (10, 4)); | ||
return $ kCount >= 45; | ||
} | ||
solution: | | ||
def doN = \n. \f. if (n > 0) {f; doN (n - 1) f} {}; end; | ||
doN 6 move; | ||
harvest; | ||
doN 13 move; | ||
turn right; | ||
harvest; | ||
doN 6 move; | ||
sow "mint"; | ||
turn right; | ||
doN 13 move; | ||
sow "barley"; | ||
turn left; | ||
doN 7 move; | ||
sow "barley"; | ||
turn left; | ||
doN 13 move; | ||
sow "kudzu"; | ||
doN 6 move; | ||
robots: | ||
- name: base | ||
dir: east | ||
devices: | ||
- branch predictor | ||
- calculator | ||
- comparator | ||
- dictionary | ||
- harvester | ||
- logger | ||
- seed spreader | ||
- treads | ||
inventory: | ||
- [2, barley] | ||
- [1, kudzu] | ||
- [1, mint] | ||
- name: kudzubot | ||
dir: east | ||
system: true | ||
entities: | ||
- name: wheat | ||
display: | ||
char: 'w' | ||
attr: wheat | ||
description: | ||
- Grain | ||
properties: [known, pickable, growable] | ||
growth: | ||
duration: [20, 30] | ||
spread: | ||
radius: 2 | ||
density: 0.3 | ||
biomes: [dirt, clay] | ||
- name: barley | ||
display: | ||
char: 'b' | ||
attr: barley | ||
description: | ||
- Grain | ||
properties: [known, pickable, growable] | ||
growth: | ||
duration: [30, 50] | ||
spread: | ||
radius: 2 | ||
density: 0.3 | ||
biomes: [dirt, clay] | ||
- name: corn | ||
display: | ||
char: 'c' | ||
attr: maize | ||
description: | ||
- Animal feed | ||
properties: [known, pickable, growable] | ||
growth: | ||
duration: [30, 60] | ||
spread: | ||
radius: 3 | ||
density: 0.1 | ||
biomes: [dirt, clay] | ||
- name: kudzu | ||
display: | ||
char: 'k' | ||
attr: plant | ||
description: | ||
- Dense, impassable plant. | ||
properties: [known, unwalkable, growable] | ||
growth: | ||
duration: [30, 50] | ||
spread: | ||
radius: 1 | ||
density: 3 | ||
biomes: [dirt, clay] | ||
- name: mint | ||
display: | ||
char: 'm' | ||
attr: mint | ||
description: | ||
- Invasive | ||
properties: [known, pickable, growable] | ||
growth: | ||
duration: [10, 50] | ||
spread: | ||
radius: 2 | ||
density: 0.6 | ||
biomes: [dirt, clay] | ||
- name: seed spreader | ||
display: | ||
char: 's' | ||
description: | ||
- A handheld pouch with a manual crank to broadcast seeds evenly within a small radius | ||
properties: [known] | ||
capabilities: [sow] | ||
known: [flower] | ||
world: | ||
default: [blank] | ||
palette: | ||
'.': [grass] | ||
'B': [grass, null, base] | ||
'd': [dirt] | ||
'c': [clay] | ||
'K': [clay, null, kudzubot] | ||
'C': [dirt, corn] | ||
'W': [clay, wheat] | ||
upperleft: [-1, 1] | ||
map: | | ||
.......................... | ||
.ddddddddddd..ccccccccccc. | ||
.ddddddddddd..ccccccccccc. | ||
BdddddCddddd..cccccWccccc. | ||
.ddddddddddd..ccccccccccc. | ||
.ddddddddddd..ccccccccccc. | ||
.......................... | ||
.ccccccccccc..ddddddddddd. | ||
.ccccccccccc..ddddddddddd. | ||
.ccccccccccc..ddddddddddd. | ||
.ccccccccccc..ddddddddddd. | ||
.ccccccccccc..ddddddddddd. | ||
.......................... | ||
.......................... | ||
.ddddddddddd..ccccccccccc. | ||
.ddddddddddd..ccccccccccc. | ||
.ddddddddddd..ccccccccccc. | ||
.ddddddddddd..ccccccccccc. | ||
.ddddddddddd..Kcccccccccc. | ||
.......................... | ||
.......................... | ||
.......................... | ||
.ccccccccccc..ddddddddddd. | ||
.ccccccccccc..ddddddddddd. | ||
.ccccccccccc..ddddddddddd. | ||
.ccccccccccc..ddddddddddd. | ||
.ccccccccccc..ddddddddddd. | ||
.......................... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
version: 1 | ||
name: Seed maturation | ||
description: | | ||
A seed grows into a different entity, which again | ||
yields the original seed when harvested. | ||
The 'mature' sub-property of the 'growth' property | ||
facilitates the distinction between seeds and the | ||
entities those seeds produce. For example, it doesn't make much sense | ||
to plant an `acorn`{=entity} and call the resulting, | ||
fully-grown plant also an `acorn`{=entity}. | ||
In combination with 'yields', it | ||
effectively precludes the grown entity (as it exists in the world) | ||
from entering into the player's inventory. | ||
creative: false | ||
objectives: | ||
- id: plant_acorn | ||
goal: | ||
- | | ||
Plant an `acorn`{=entity} | ||
condition: | | ||
as base { | ||
x <- has "acorn"; | ||
return $ not x; | ||
} | ||
- goal: | ||
- | | ||
Go to the `oak`{=entity} | ||
condition: | | ||
as base { | ||
ishere "oak"; | ||
} | ||
- goal: | ||
- | | ||
Pick another `acorn`{=entity} | ||
prerequisite: plant_acorn | ||
condition: | | ||
as base { | ||
has "acorn"; | ||
} | ||
solution: | | ||
sow "acorn"; | ||
move; | ||
watch back; | ||
turn back; | ||
wait 1000; | ||
move; | ||
harvest; | ||
robots: | ||
- name: base | ||
dir: east | ||
devices: | ||
- branch predictor | ||
- calculator | ||
- comparator | ||
- dictionary | ||
- harvester | ||
- logger | ||
- rolex | ||
- scanner | ||
- seed spreader | ||
- treads | ||
inventory: | ||
- [1, acorn] | ||
entities: | ||
- name: acorn | ||
display: | ||
char: 'a' | ||
description: | ||
- Seed of an `oak`{=entity} | ||
properties: [known, pickable, growable] | ||
growth: | ||
duration: [200, 300] | ||
mature: oak | ||
- name: oak | ||
display: | ||
char: 'k' | ||
description: | ||
- Grows from an `acorn`{=entity} | ||
properties: [known, pickable, growable] | ||
growth: | ||
duration: [200, 300] | ||
yields: acorn | ||
- name: seed spreader | ||
display: | ||
char: 's' | ||
description: | ||
- A handheld pouch with a manual crank to broadcast seeds evenly within a small radius | ||
properties: [known] | ||
capabilities: [sow] | ||
world: | ||
default: [blank] | ||
palette: | ||
'.': [grass] | ||
'B': [grass, null, base] | ||
upperleft: [-2, 2] | ||
map: | | ||
..... | ||
..B.. | ||
..... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,6 +62,7 @@ | |
"turn" | ||
"grab" | ||
"harvest" | ||
"sow" | ||
"ignite" | ||
"place" | ||
"ping" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.