Skip to content

Commit

Permalink
use built-in portal functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
kostmo committed Nov 22, 2023
1 parent 724650d commit f91b906
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 67 deletions.
22 changes: 22 additions & 0 deletions data/scenarios/Challenges/_hackman/teleport_monitor.sw
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/* Algorithm:
If, at any point, the base is more than two cells from its previous location,
it must have teleported.
*/

def abs = \n. if (n<0) {-n} {n} end;

def getBasePos =
as base {whereami};
end;

def go = \lastBasePos.
wait 1;
curBasePos <- getBasePos;
let deltaX = abs(fst curBasePos - fst lastBasePos) in
if (deltaX > 1) {
create "bit (0)";
} {go curBasePos};
end;

curBasePos <- getBasePos;
go curBasePos;
41 changes: 0 additions & 41 deletions data/scenarios/Challenges/_hackman/teleporter.sw

This file was deleted.

75 changes: 49 additions & 26 deletions data/scenarios/Challenges/hackman.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ objectives:
- |
Be teleported
condition: |
r <- robotnamed "teleporter";
r <- robotnamed "teleport_monitor";
loc <- as r {
has "bit (0)"
};
Expand Down Expand Up @@ -149,14 +149,14 @@ robots:
- strange loop
- treads
- workbench
- name: teleporter
- name: teleport_monitor
dir: [0, 1]
system: true
display:
invisible: true
char: 'T'
program: |
run "scenarios/Challenges/_hackman/teleporter.sw"
run "scenarios/Challenges/_hackman/teleport_monitor.sw"
- name: ghost1
dir: [0, 1]
system: true
Expand Down Expand Up @@ -272,38 +272,61 @@ world:
'b': [blank, null, ghost2]
'c': [blank, null, ghost3]
'd': [blank, null, ghost4]
'T': [blank, null, teleporter]
'.': [blank, pellet]
'*': [blank, donut]
'x': [blank, wall]
'T': [blank, null, teleport_monitor]
'=': [blank, gate]
'': [stone, upper left corner]
'': [stone, upper right corner]
'': [stone, lower left corner]
'': [stone, lower right corner]
'': [stone, horizontal wall]
'': [stone, vertical wall]
'W':
cell: [blank]
waypoint:
name: western_exit
'X':
cell: [blank]
waypoint:
name: western_entrance
'Y':
cell: [blank]
waypoint:
name: eastern_exit
'Z':
cell: [blank]
waypoint:
name: eastern_entrance
portals:
- entrance: eastern_entrance
exitInfo:
exit: western_exit
- entrance: western_entrance
exitInfo:
exit: eastern_exit
upperleft: [-11, 10]
map: |-
xxxxxxxxxxxxxxxxxxxxxxx
x..........x..........x
x*xxx.xxxx.x.xxxx.xxx*x
x.xxx.xxxx.x.xxxx.xxx.x
x.....................x
x.xxx.x.xxxxxxx.x.xxx.x
x.....x....x....x.....x
xxxxx.xxxxBxBxxxx.xxxxx
BBBBx.xBBBBBBBBBx.xBBBB
xxxxx.xB┌──=──┐Bx.xxxxx
TBBBB.BB│abBcd│BB.BBBBT
xxxxx.xB└─────┘Bx.xxxxx
BBBBx.xBBBfΩBBBBx.xBBBB
xxxxx.xBxxxxxxxBx.xxxxx
x..........x..........x
x.xxx.xxxx.x.xxxx.xxx.x
x*..x.............x..*x
xxx.x.x.xxxxxxx.x.x.xxx
x.....x....x....x.....x
x.xxxxxxxx.x.xxxxxxxx.x
x.....................x
xxxxxxxxxxxxxxxxxxxxxxx
BxxxxxxxxxxxxxxxxxxxxxxxT
Bx..........x..........xB
Bx*xxx.xxxx.x.xxxx.xxx*xB
Bx.xxx.xxxx.x.xxxx.xxx.xB
Bx.....................xB
Bx.xxx.x.xxxxxxx.x.xxx.xB
Bx.....x....x....x.....xB
Bxxxxx.xxxxBxBxxxx.xxxxxB
BBBBBx.xBBBBBBBBBx.xBBBBB
Bxxxxx.xB┌──=──┐Bx.xxxxxB
ZYBBBB.BB│abBcd│BB.BBBBWX
Bxxxxx.xB└─────┘Bx.xxxxxB
BBBBBx.xBBBfΩBBBBx.xBBBBB
Bxxxxx.xBxxxxxxxBx.xxxxxB
Bx..........x..........xB
Bx.xxx.xxxx.x.xxxx.xxx.xB
Bx*..x.............x..*xB
Bxxx.x.x.xxxxxxx.x.x.xxxB
Bx.....x....x....x.....xB
Bx.xxxxxxxx.x.xxxxxxxx.xB
Bx.....................xB
BxxxxxxxxxxxxxxxxxxxxxxxB

0 comments on commit f91b906

Please sign in to comment.