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 O
The 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 gridI
that 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 theobjects
primitive onI
withunivalued=True
,diagonal=False
andwithout_background=True
-
x2
: the subset of the objectsx1
which are black; the result of filtering objects by their color, i.e. callingcolorfilter
withobjects=x1
andcolor=ZERO
(black) -
x3
: a function with signature$f: object \rightarrow bool$ that returnsTrue
iff an object is at the border of the grid; the result of fixing the right argument of thebordering
primitive toI
by calling the functionrbind
onfunction=bordering
andfixed=I
-
x4
: a function that returns the inverse of the previous function, i.e. a function that returnsTrue
iff an object does not border the grid border; the result of composing theflip
primitive (which simply negates flips a boolean) andx3
-
x5
: a single object defined as the union of objectsx2
for which functionx4
returnsTrue
, 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 combinesmerge
andfilter
) withcontainer=x2
andcondition=x4
-
O
: the output grid, created by coloring all pixels of the objectx5
yellow; the result of calling thefill
primitive onI
withcolor=FOUR
(yellow) andpatch=x5