esolang

But Is It Art?

A program is a box of tiles. It succeeds when they tile a rectangle that spells its input.

ais523, 2017 · Turing complete: yes · ●●● hard · esolangs.org

Tested with 2 known programs · Test method

Run it

Expected: H

The idea

ais523 made But Is It Art? in 2017 as a constraint-solving tarpit. Nothing runs from top to bottom. The program is cut into tiles, the pieces of characters that touch side by side. A run asks one question. Can some rectangle be covered by copies of these tiles, none of them turned, so that the small letters inside, read like a page, spell the input? If so, the capitals inside spell the output.

Read the story

Letters are nybbles, a to p for 0 to 15 in the input and A to P in the output, high nybble first. Every character that is not a letter is filling. When no rectangle exists, the run may stop with an error if it can prove that, or search forever. It must prove it when every tile holds a small letter, since the input then bounds the rectangle.

The machine

PartIs
TileA connected piece of the program, used as often as needed or not at all
WitnessA rectangle cut into tiles whose small letters spell the input
a to pAn input nybble, 0 to 15
A to PAn output nybble
Any character but a letterFilling

This implementation tries rectangles from the smallest area up and prints the first solution it finds.

Example

One tile with two capitals.

One tile with two capitals. The smallest solution is the tile itself, and E I is the byte 72.

Each A of the input is eb, so each copy of the tile turns one A into EC, a B.

Expected: BB

The second program in the specification is conjectured to accept exactly the strings of A whose length is composite. This implementation accepts 4, 6, 8 and 9 of them and proves that 2, 3, 5 and 7 cannot be spelled.

2eb2 eb3 eb  eb
222 333 555 777
2   3   5

Patterns it teaches

Further

Pattern-based

Declarative paradigm

Write your own in Run Convert a program from But Is It Art?

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: but-is-it-art.

Command line

shib run but-is-it-art -e '### +   =
#   ++ =='
shib manual but-is-it-art

Source

Module
langs/wiki/ports.js
Interpreter
langs/wiki/but-is-it-art.js

Docs: Kernel instructions · The .shib format · Command line · Adding a language

Source esolangs.org (CC0) · Edit on esolangs.org