Karel

Embedded 2D Karel. Coordinates start at the top left; north/east/south/west are 0/1/2/3. Worlds are immutable. Blocked moves and empty picks are no-ops. Native primitives implement the grid; program composition is ordinary Aeon code.
Table of Contents

Types

World

(type)
Embedded 2D Karel. Coordinates start at the top left; north/east/south/west are 0/1/2/3. Worlds are immutable. Blocked moves and empty picks are no-ops. Native primitives implement the grid; program composition is ordinary Aeon code.
type World

Examples

(type)
type Examples

Dataset

(type)
type Dataset

Functions

north

def north : Int

east

def east : Int

south

def south : Int

west

def west : Int

world

def world (width : Int) (height : Int) (x : Int) (y : Int) (facing : Int) : World

with_wall

def with_wall (w : World) (x : Int) (y : Int) : World

random_world

def random_world (width : Int) (height : Int) (seed : Int) : World

with_markers

def with_markers (w : World) (x : Int) (y : Int) (count : Int) : World

marker_count_at

def marker_count_at (w : World) (x : Int) (y : Int) : Int

front_is_clear

def front_is_clear (w : World) : Bool

left_is_clear

def left_is_clear (w : World) : Bool

right_is_clear

def right_is_clear (w : World) : Bool

markers_present

def markers_present (w : World) : Bool

move

def move (w : World) : World

turn_left

def turn_left (w : World) : World

turn_right

def turn_right (w : World) : World

pick_marker

def pick_marker (w : World) : World

put_marker

def put_marker (w : World) : World

marker_count

def marker_count (w : World) : Int

render

def render (w : World) : String

same_world

def same_world (a : World) (b : World) : Bool

example

def example (initial : World) (expected : World) : Examples

append_examples

def append_examples (a : Examples) (b : Examples) : Examples

load_dataset

def load_dataset (path : String) : Dataset

dataset_size

def dataset_size (dataset : Dataset) : Int

dataset_task

def dataset_task (dataset : Dataset) (index : Int) : Examples

fitness

def fitness (program : (w : World) → World) (examples : Examples) : Float

require_finished

def require_finished (fuel : Int) (test : (w : World) → Bool) (w : World) : World

repeat_tick

def repeat_tick (w : World) : World

load_task_examples

def load_task_examples (path : String) : Examples

robot_x

def robot_x (w : World) : Int

robot_y

def robot_y (w : World) : Int

direction

def direction (w : World) : Int

width

def width (w : World) : Int

height

def height (w : World) : Int

no_markers_present

def no_markers_present (w : World) : Bool

not_karel

def not_karel (test : (w : World) → Bool) (w : World) : Bool

stay

def stay (w : World) : World

sequence

def sequence (first : (w : World) → World) (second : (w : World) → World) (w : World) : World

repeat

def repeat (count : Int) (step : (w : World) → World) (w : World) : World

if_karel

def if_karel (test : (w : World) → Bool) (yes : (w : World) → World) (no : (w : World) → World) (w : World) : World

when_karel

def when_karel (test : (w : World) → Bool) (step : (w : World) → World) (w : World) : World

while_karel

Exhaustion raises a runtime error when the guard remains true, never a partial success.
def while_karel (fuel : Int) (test : (w : World) → Bool) (step : (w : World) → World) (w : World) : World