Skip to content

Commit

Permalink
more imap examples
Browse files Browse the repository at this point in the history
  • Loading branch information
byorgey committed Jun 26, 2024
1 parent 8c67163 commit d09ce76
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 0 deletions.
1 change: 1 addition & 0 deletions data/scenarios/00-ORDER.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ Speedruns
Testing
Vignettes
Mechanics
World Examples
3 changes: 3 additions & 0 deletions data/scenarios/World Examples/00-ORDER.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
clearing.yaml
rorschach.yaml
stretch.yaml
22 changes: 22 additions & 0 deletions data/scenarios/World Examples/clearing.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
version: 1
name: Clearing
description: |
The base is in a clearing in the forest: the area within a certain
radius of the base is completely clear of trees; then there are
random trees at increasing density up to another radius; outside of
the outer radius there are only trees.
creative: true
robots:
- name: base
display:
char: Ω
loc: [0, 0]
dir: north
world:
dsl: |
overlay
[ {dirt}
, mask ((x*x + 4*y*y) >= (6*6) && (x*x + 4*y*y) <= (30*30))
(let h = hash % 24 in if (36 + h*h) <= (x*x + 4*y*y) then {tree,dirt} else {dirt} )
, mask ((x*x + 4*y*y) > (30*30)) {tree, dirt}
]
21 changes: 21 additions & 0 deletions data/scenarios/World Examples/rorschach.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
version: 1
name: Rorschach
description: |
A world with both horizontal and vertical reflection symmetry,
created with 'imap'.
creative: true
robots:
- name: base
dir: north
loc: [0, 0]
known: [tree]
world:
dsl: |
let trees = if (hash % 4 == 0) then {tree, dirt} else {stone}
in
overlay
[ mask (x >= 0 && y >= 0) trees
, mask (x >= 0 && y < 0) (imap x (-y) trees)
, mask (x < 0 && y >= 0) (imap (-x) y trees)
, mask (x < 0 && y < 0) (imap (-x) (-y) trees)
]
16 changes: 16 additions & 0 deletions data/scenarios/World Examples/stretch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: 1
name: Stretch
description: |
A world created by stretching a random pattern of trees, with the
amount of stretching determined by the distance from the origin.
creative: true
robots:
- name: base
dir: north
loc: [0, 0]
known: [tree]
world:
dsl: |
let trees = if (hash % 4 == 0) then {tree, dirt} else {stone}
in
imap (if (y == 0) then 0 else (x/abs(y))) (if (abs x <= 1) then 0 else (y/abs(x/2))) trees

0 comments on commit d09ce76

Please sign in to comment.