Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
kostmo committed Aug 19, 2024
1 parent d1791a1 commit 7b1dcae
Show file tree
Hide file tree
Showing 3 changed files with 202 additions and 0 deletions.
37 changes: 37 additions & 0 deletions data/scenarios/Challenges/_pied-piper/rat.sw
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
def findGoodDirection =
isBlocked <- blocked;
if isBlocked {
turn left;
findGoodDirection;
} {};
end;

def moveUntilBlocked =
isBlocked <- blocked;
if isBlocked {
} {
move;
moveUntilBlocked;
};
end;

def pauseAtRandom =
r <- random 3;
if (r == 0) {
r2 <- random 8;
wait $ 4 + r2;
} {}
end;

def doMovement =
findGoodDirection;
moveUntilBlocked;
pauseAtRandom
end;

def go =
doMovement;
go;
end;

go;
Empty file.
165 changes: 165 additions & 0 deletions data/scenarios/Challenges/pied-piper.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
version: 1
name: Pied Piper
author: Karl Ostmo
description: |
Rid the village of pests.
creative: false
attrs:
- name: oats
fg: "#444444"
bg: "#F5DEB3"
- name: bridge
bg: "#806040"
terrains:
- name: bridge
attr: bridge
description: |
Wooden raised path
robots:
- name: base
dir: north
devices:
- 3D printer
- ADT calculator
- antenna
- branch predictor
- clock
- comparator
- counter
- dictionary
- grabber
- lambda
- logger
- net
- scanner
- strange loop
- string
- workbench
- name: rat
system: true
dir: west
display:
invisible: false
char: 'r'
devices:
- logger
program: |
run "scenarios/Challenges/_pied-piper/rat.sw"
- name: helper
loc: [0, 0]
system: true
dir: west
display:
invisible: false
devices:
- logger
program: |
teleport base (12, -13);
objectives:
- goal:
- Rats have infested the dwellings. Clear them out!
condition: |
try {
r <- robotNamed "rat";
return false;
} {return true}
solution: |
run "scenarios/Challenges/_pied-piper/solution.sw"
entities:
- name: door
display:
char: 'X'
description:
- door
properties: [known]
- name: oats
display:
attr: oats
char: 'a'
description:
- Grain
properties: [known, pickable, growable]
growth:
duration: [20, 30]
known: [water]
seed: 0
world:
structures:
- name: house
structure:
palette:
'd': [stone, door]
'x': [stone, boulder]
'.': [stone]
'r': [stone, erase, rat]
map: |
xxxxxxxxxx
x........x
d........x
x........x
x.....r..x
x........x
x........x
xxxxxxxxxx
- name: street pair
structure:
palette:
's': [stone]
'.': [grass]
placements:
- src: house
offset: [-9, 0]
orient:
up: south
- src: house
offset: [17, 0]
orient:
flip: true
map: |
..ssss..
..ssss..
..ssss..
..ssss..
..ssss..
..ssss..
..ssss..
..ssss..
..ssss..
..ssss..
..ssss..
- name: block
structure:
placements:
- src: street pair
offset: [0, 0]
orient:
flip: true
- src: street pair
offset: [0, 6]
map: ""
palette:
'Ω': [grass, erase, base]
's': [stone, erase]
'.': [grass]
'b': [bridge, erase]
placements:
- src: block
offset: [-7, -11]
upperleft: [0, 7]
dsl: |
overlay
[ {grass}
, mask (y > -2 && y < 2) {water}
]
map: |
....ssss..
....ssss..
....ssss..
....ssss..
Ω...ssss..
....bbbb..
....bbbb..
....bbbb..
....bbbb..
....bbbb..
....ssss..

0 comments on commit 7b1dcae

Please sign in to comment.