From f6178ba6146cac062d066058d083375dd8ab8725 Mon Sep 17 00:00:00 2001 From: Karl Ostmo Date: Thu, 19 Sep 2024 09:22:20 -0700 Subject: [PATCH] fix placement offsets --- .../00-ORDER.txt | 3 +- .../coordinate-offset-propagation.yaml | 66 +++++++++++++++++++ .../offsets-fix.yaml | 62 +++++++++++++++++ 3 files changed, 130 insertions(+), 1 deletion(-) create mode 100644 data/scenarios/Testing/1780-structure-merge-expansion/coordinate-offset-propagation.yaml create mode 100644 data/scenarios/Testing/1780-structure-merge-expansion/offsets-fix.yaml diff --git a/data/scenarios/Testing/1780-structure-merge-expansion/00-ORDER.txt b/data/scenarios/Testing/1780-structure-merge-expansion/00-ORDER.txt index ed9116ef4..4734101ca 100644 --- a/data/scenarios/Testing/1780-structure-merge-expansion/00-ORDER.txt +++ b/data/scenarios/Testing/1780-structure-merge-expansion/00-ORDER.txt @@ -1,4 +1,5 @@ nonoverlapping-structure-merge.yaml root-map-expansion.yaml structure-composition.yaml -sequential-placement.yaml \ No newline at end of file +sequential-placement.yaml +coordinate-offset-propagation.yaml \ No newline at end of file diff --git a/data/scenarios/Testing/1780-structure-merge-expansion/coordinate-offset-propagation.yaml b/data/scenarios/Testing/1780-structure-merge-expansion/coordinate-offset-propagation.yaml new file mode 100644 index 000000000..6355fa3d4 --- /dev/null +++ b/data/scenarios/Testing/1780-structure-merge-expansion/coordinate-offset-propagation.yaml @@ -0,0 +1,66 @@ +version: 1 +name: Structure coordinate offset propagation +author: Karl Ostmo +description: | + If a structure incorporates subplacements + entailing negative offsets, its coordinate origin must be shifted. + + The updated coordinate origin should be propagated to parent structures + and utilized to offset placement. +robots: + - name: base + dir: north +creative: true +objectives: + - goal: + - Must have 3 of each color visible + condition: | + return false +solution: | + noop +known: [boulder, log, pixel (R), pixel (G), pixel (B), gold] +world: + structures: + - name: micro + structure: + mask: '.' + palette: + 'x': [stone, gold] + map: | + xxx + x.x + xxx + - name: block + structure: + mask: '.' + palette: + 'x': [stone, pixel (R)] + map: | + xxxx + x..x + x..x + xxxx + - name: master + structure: + mask: '.' + placements: + - src: block + - src: micro + offset: [-3, 1] + map: "" + dsl: | + overlay + [ {grass} + , mask (y > -4 && y < 4 || x > -4 && x < 4) {stone} + , mask (y > -2 && y < 2 || x > -2 && x < 2) {ice} + , mask (y > -1 && y < 1 || x > -1 && x < 1) {dirt} + ] + palette: + 'Ω': [grass, erase, base] + mask: '.' + placements: + - src: master + offset: [0, 0] + upperleft: [0, 0] + map: | + Ω diff --git a/data/scenarios/Testing/1780-structure-merge-expansion/offsets-fix.yaml b/data/scenarios/Testing/1780-structure-merge-expansion/offsets-fix.yaml new file mode 100644 index 000000000..d1dd06a2b --- /dev/null +++ b/data/scenarios/Testing/1780-structure-merge-expansion/offsets-fix.yaml @@ -0,0 +1,62 @@ +version: 1 +name: Structure coordinate offsets +author: Karl Ostmo +description: | + Avoid garbled structure +robots: + - name: base + dir: north +creative: true +objectives: + - goal: + - Must have 3 of each color visible + condition: | + return false +solution: | + noop +known: [boulder, log, pixel (R), pixel (G), pixel (B), gold] +world: + structures: + - name: micro + structure: + mask: '.' + palette: + 'x': [stone, gold] + map: | + xxx + x.x + xxx + - name: block + structure: + mask: '.' + palette: + 'x': [stone, pixel (R)] + map: | + xxxx + x..x + x..x + xxxx + - name: master + structure: + mask: '.' + placements: + - src: micro + offset: [-3, 1] + - src: block + map: "" + dsl: | + overlay + [ {grass} + , mask (y > -4 && y < 4 || x > -4 && x < 4) {stone} + , mask (y > -2 && y < 2 || x > -2 && x < 2) {ice} + , mask (y > -1 && y < 1 || x > -1 && x < 1) {dirt} + ] + palette: + 'Ω': [grass, erase, base] + mask: '.' + placements: + - src: master + offset: [0, 0] + upperleft: [0, 0] + map: | + Ω