The DSL was created with the aim of being expressive enough to allow programs solving arbitrary ARC tasks, and generic, i.e. consisting of only few primitives, each useful for many tasks (see dsl.py). As a proof of concept, solver programs for the training tasks were written (see solvers.py). See arc_dsl_writeup.pdf for a more detailed description of the work.
def solve_00d62c1b(I):
x1 = objects(I, T, F, F)
x2 = colorfilter(x1, ZERO)
x3 = rbind(bordering, I)
x4 = compose(flip, x3)
x5 = mfilter(x2, x4)
O = fill(I, FOUR, x5)
return OThe function solve_00d62c1b takes an input grid I and returns the correct output grid O. An explanation of what the variables store and how their values were computed:
-
x1: the set of objects extracted from the input gridIthat are single-colored only, where individual objects may only have cells that are connected directly, and cells may be of the background color (black); the result of calling theobjectsprimitive onIwithunivalued=True,diagonal=Falseandwithout_background=True -
x2: the subset of the objectsx1which are black; the result of filtering objects by their color, i.e. callingcolorfilterwithobjects=x1andcolor=ZERO(black) -
x3: a function with signature$f: object \rightarrow bool$ that returnsTrueiff an object is at the border of the grid; the result of fixing the right argument of theborderingprimitive toIby calling the functionrbindonfunction=borderingandfixed=I -
x4: a function that returns the inverse of the previous function, i.e. a function that returnsTrueiff an object does not border the grid border; the result of composing theflipprimitive (which simply negates flips a boolean) andx3 -
x5: a single object defined as the union of objectsx2for which functionx4returnsTrue, i.e. the black objects which do not border the grid border (corresponding to the "holes" in the green objects); the result of callingmfilter(which combinesmergeandfilter) withcontainer=x2andcondition=x4 -
O: the output grid, created by coloring all pixels of the objectx5yellow; the result of calling thefillprimitive onIwithcolor=FOUR(yellow) andpatch=x5
