version: 1 name: Cave shaped maze author: Ondřej Šebek description: A maze shaped like a cave. It only goes down or forward. objectives: - goal: - You are at the top of a cave that gradually descends until reaching a dead end. - At its bottom is a great treasure. - Luckily, the cave does not branch out, so it is easy to find the path to the treasure. - Send a robot to the the item marked as '!'. You win once the robot grabs it. condition: | j <- robotNamed "judge"; as j {has "goal"} solution: | def until = \p. \c. b <- p; if b {} {c; until p c} end; def fwd = until blocked move end; build { require "branch predictor"; // #540 turn east; until (ishere "goal") (fwd; turn right; fwd; turn left); grab } robots: - name: base dir: [0,1] display: char: 'Ω' attr: robot devices: - dictionary - 3D printer - logger - grabber inventory: - [50, solar panel] - [50, treads] - [50, compass] - [50, scanner] - [50, lambda] - [50, branch predictor] - [50, strange loop] - [50, logger] - [50, grabber] - [0, goal] - name: judge dir: [0,0] system: true program: | def until = \c. b <- c; if b {} {until c} end; until (d <- scan down; return (d == inl ())); create "goal" known: [water] entities: - name: wall display: char: █ attr: rock description: - An impassable stone wall. properties: [unwalkable, known] - name: goal display: char: '!' attr: device description: - The place you're trying to reach! You win by executing `grab` on this item. properties: [known, portable] world: default: [ice] palette: 'Ω': [stone, null, base] ' ': [stone, null] '~': [stone, water] '█': [stone, wall] '!': [stone, goal, judge] upperleft: [0,0] map: | ██████████████████████████████ █Ω ████████ █████████████████ ███ ██████████████████████ █ █████ ███████████ ██████████ █ █████ ███████~███ ███ █████ ████████ ███████████ ██ ██████ ███ ████ ██████~█~█ █████ ██~██████████ █████~~███ █ ██ ████████ █████ █████████~████ ███ ███████████ ███████~~███ ███ █ ███ ██████ ██████~~████ █ ██ ███ ██████ ████████████ ██ █ █ ██ █████ █████████ ██~~~~~~~██~~~██████ !█ ██████████████████████████████