-
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.
A walkability "blacklist" had already been implemented in #1536. The whitelist shall **only** permit walking on the specified entities; blank cells become unwalkable. This feature would allow use of the `path` command to check for "connectivity" by way of a "trail" of entities. ## Use cases * system robots or goal conditions can use this to check whether the player has connected two points with a road, cable, aqueduct, etc. * monkeys, which can only move along `tree`s * sea life, which should only be able to move in `water` ## Testing scripts/run-tests.sh --test-arguments '--pattern "walkable-entities"'
- Loading branch information
Showing
21 changed files
with
377 additions
and
105 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
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,86 @@ | ||
version: 1 | ||
name: Custom walkability | ||
description: | | ||
The monkey can only walk on `tree`{=entity}s (and `banana`{=entity}s). | ||
The `path` command must fail until the path of `tree`{=entity}s is completed. | ||
NOTE: In order for the objectives to be evaluated properly for a "Win", they must be | ||
ordered strictly with "banana_access" coming before "placed_tree" in the | ||
list below. | ||
objectives: | ||
- id: banana_access | ||
teaser: Banana access | ||
goal: | ||
- Give monkey access to `banana`{=entity} | ||
condition: | | ||
m <- robotnamed "monkey"; | ||
as m { | ||
p <- path (inR 10) (inR "banana"); | ||
return $ case p (\_. false) (\_. true); | ||
}; | ||
- id: placed_tree | ||
teaser: Tree placed | ||
prerequisite: | ||
not: banana_access | ||
goal: | ||
- Tree must be placed | ||
condition: | | ||
x <- as base {has "tree"}; | ||
return $ not x; | ||
solution: | | ||
move; | ||
move; | ||
place "tree" | ||
entities: | ||
- name: banana | ||
display: | ||
char: ')' | ||
attr: gold | ||
description: | ||
- Tasty treat for a monkey | ||
properties: [known, pickable] | ||
robots: | ||
- name: base | ||
dir: east | ||
display: | ||
attr: robot | ||
devices: | ||
- logger | ||
- grabber | ||
- treads | ||
- dictionary | ||
- net | ||
inventory: | ||
- [1, tree] | ||
- name: monkey | ||
dir: south | ||
display: | ||
char: M | ||
attr: robot | ||
devices: | ||
- logger | ||
- grabber | ||
- treads | ||
- dictionary | ||
- net | ||
walkable: | ||
only: | ||
- tree | ||
- banana | ||
known: [tree] | ||
world: | ||
dsl: | | ||
{grass} | ||
palette: | ||
'B': [grass, null, base] | ||
'M': [grass, null, monkey] | ||
'.': [grass] | ||
'T': [grass, tree] | ||
'b': [grass, banana] | ||
upperleft: [0, 0] | ||
map: | | ||
..M. | ||
..T. | ||
B... | ||
..T. | ||
..b. |
101 changes: 101 additions & 0 deletions
101
data/scenarios/Testing/1721-walkability-whitelist-path-cache.yaml
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: Custom walkability - whitelist | ||
description: | | ||
Exercise various scenarios of path cache invalidation. | ||
objectives: | ||
- goal: | ||
- Get somewhere | ||
condition: | | ||
as base {ishere "platform"} | ||
solution: | | ||
def goDir = \f. \result. | ||
let d = fst result in | ||
if (d == down) {return ()} {turn d; move; f;} | ||
end; | ||
def followRoute = | ||
nextDir <- path (inL ()) (inR "platform"); | ||
case nextDir return $ goDir followRoute; | ||
end; | ||
followRoute; | ||
entities: | ||
- name: platform | ||
display: | ||
char: 'P' | ||
attr: ice | ||
description: | ||
- Goal at the end of the trees | ||
properties: [known] | ||
- name: wayfinder | ||
display: | ||
char: 'w' | ||
description: | ||
- | | ||
Enables the `path` command: | ||
- | | ||
`path : (unit + int) -> ((int * int) + text) -> cmd (unit + (dir * int))` | ||
- | | ||
Optionally supply a distance limit as the first argument, and | ||
supply either a location (`inL`) or an entity (`inR`) as the second argument. | ||
- | | ||
Example: | ||
- | | ||
`path (inL ()) (inR "tree");` | ||
- If a path exists, returns the direction to proceed along. | ||
properties: [known, pickable] | ||
capabilities: [path] | ||
robots: | ||
- name: base | ||
dir: east | ||
display: | ||
attr: robot | ||
devices: | ||
- ADT calculator | ||
- branch predictor | ||
- comparator | ||
- compass | ||
- dictionary | ||
- grabber | ||
- logger | ||
- net | ||
- treads | ||
- wayfinder | ||
walkable: | ||
only: | ||
- tree | ||
- platform | ||
- name: sysbot | ||
dir: east | ||
system: true | ||
display: | ||
attr: robot | ||
invisible: false | ||
program: | | ||
move; | ||
t <- grab; | ||
move; | ||
place t; | ||
turn left; | ||
move; | ||
move; | ||
t2 <- grab; | ||
turn back; | ||
move; | ||
known: [tree] | ||
world: | ||
dsl: | | ||
{grass} | ||
palette: | ||
'B': [grass, null, base] | ||
'S': [grass, null, sysbot] | ||
'.': [grass] | ||
'T': [grass, tree] | ||
'P': [grass, platform] | ||
upperleft: [0, 0] | ||
map: | | ||
............ | ||
......TTT... | ||
BTTTTTTTTP.. | ||
............ | ||
.....ST..... |
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
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.