20
\$\begingroup\$

I was wondering if there are any esoteric or golfing languages which specifically target text output and ASCII art?

For example, 05AB1E at least started by targeting base conversions. Are there any golfing languages targeting text output and text output art?

If so, do they have tip pages here, and are they in common use?

Note: I'm not looking for languages that are able to output ASCII art, but rather ones intentionally designed to be able to complete challenges in a relatively short and concise way.

\$\endgroup\$
  • 1
    \$\begingroup\$ Since you mentioned it, in my experience 05AB1E is very good at ascii art challenges. \$\endgroup\$ – DJMcMayhem Sep 20 '16 at 22:38
  • 1
    \$\begingroup\$ I'd like to see a ASCII-art language called "ASC and II shall receive." (Seriously though, if one doesn't already exit, there's quite a bit of potential there.) \$\endgroup\$ – Hactar Sep 20 '16 at 22:42
  • \$\begingroup\$ I've designed a language called Crayon which is made specifically for creating ASCII art, but unfortunately I haven't had the time to implement it yet. \$\endgroup\$ – ETHproductions Sep 20 '16 at 23:50
  • \$\begingroup\$ @ASCII-only and I have been working on an ASCII-art language. It's still in the design phase, but we'd love your (or anyone's) input. Join us in chat if you're interested. \$\endgroup\$ – DLosc Sep 21 '16 at 2:38
  • \$\begingroup\$ Well here I was thinking my idea was unique... I asked this question because I wanted to write a CharMatrix based language. No one's mentioned one of the features I wanted though, so I might go ahead and do it anyway. All the answers and comments have been great by the way, thanks everybody \$\endgroup\$ – Socratic Phoenix Sep 21 '16 at 10:35
15
\$\begingroup\$

Well, as a matter of fact, there is! One such language is one I have been working on for a while called V.

Under the hood, V is just vim, but all of the keystrokes are run automatically, and the contents of the vim buffer are printed to STDOUT when the program is over. This just makes running it more convenient.

Some history on the language. When I started using the vim text editor for code-golf, I discovered that it's actually pretty good at it, but has some annoying features that make it more difficult to compete it. For example, you can set up a "while loop" of sorts by doing

qq<foobar>@qq@q

which will repeat <foobar> until an error happens. This has 7 bytes of boilerplate code. In V, this is shortened to ò<foobar>ò.

Some of the things that make V great for ASCII-art:

  • It is 2d by nature. One feature is that is has a "cursor" position, where most of the commands do something based on where the cursor is in the text. The other commands move the location of the cursor. For example, x deletes a single character, but Wx moves forward a word and then deletes a character. Since most other languages are not intentionally 2 dimensional, this offers a nice edge when the challenge is about positioning text in 2D space

  • It is entirely string based. You can use some mathy operations, but these are usually the longer way to achieve things.

  • It uses regex compression to quickly change text.

  • All of it's internal memory, which is just a 2d array of characters, is implicitly printed when the program ends. Additionally, all inputs is implicitly added into it's internal memory, which is nice when most of the challenge is about changing the input in a certain way.

So I really enjoy using this language, and if you are looking for a specifically language, I highly recommend it. However, I would also give a few disclaimers.

  • It is very confusing to learn. It's also very powerful, but because it's based on a very popular text editor that is 30 years old, there are lot's of obscure features that could very easily confuse new users.

  • Even though it is better at handling numbers than vim, it's number support is still not great. Personally, I think this makes it more fun to work in (kind of like using retina for tasks regex was never intended for). :D

  • It is still a WIP. There are some bugs, and some things I haven't gotten around to adding yet.

  • It doesn't have very many users. (Current number of users: 1).

If you are interested in learning more, here are some good resources:

  • A chat room where I would be happy to answer any questions you have, and help explain how it works to you.

  • A tips thread for golfing in vim, but most of the tips carry over.

  • A meta post describing V in some more detail.

\$\endgroup\$
8
\$\begingroup\$

I recently made a new programming language, called Turtlèd, which operates on a grid of characters with a turtle, which moves around the grid, writes to the grid, and has control flow with the grid. The grid is implicitly printed at the end. By this fact that it does not have to write spaces, and that it can write the text spatially, rather than left to right, up to down, it probably makes it meet the definition given, being good at ascii art.

Currently, there are not any docs, so you probably will not be able to use it, unless you want to read my interpreter, which is probably not something you want to do. I think there may also be bugs in the interpreter, but the spec is not developed enough to say if it is a bug. Turtlèd will probably be finished soon, with docs and all, though

\$\endgroup\$
3
\$\begingroup\$

Intro to ASCII-Golfing for 05AB1E (Base Conversion [Simple])

While 05AB1E isn't intended for ASCII-Art directly, I've won 2 challenges with it. The best thing about 05AB1E is that, even with the simple base conversion there's often tricks you can use to extend and even halve your byte-count. Often in ASCII challenges there are repitition tricks you can utilize to only draw half the pattern then flip and concatenate. If it's a four way pattern you can do things like zip and bifurcate to only draw a corner of the pattern. There's plenty of data-structure manipulation techniques to use in conjunction with this simple base compression idea.


Here's a quick crash-course on a base conversion tactic:

In 05AB1E I enumerate all of the characters used in the ASCII-art, for instance:

--===___===--

Would result in:

-
=
_

I then assign them numbers starting with 1 then 0 then 2:

- is 1.
= is 0.
_ is 2.

I replace the characters in the original string with the numbers:

1122200022211

I convert to decimal using the lowest possible base (3):

879412

(How to do this using 05AB1E)

I then convert it to base 214:

Jh]

(How to do this using 05AB1E)

I then wrap it in the following code:

05AB1E, 16 bytes

•Jh]•3B…102…-_=‡

Try it online!

Or try it with intermediate steps displayed.

Final explained:

•Jh]•            # Push the compressed ASCII integer.
     3B          # Convert it to base 3.
       …102      # Push the keys to the conversion.
           …-_=  # Push the values to the conversion.
               ‡ # Transliterate, replace 0, 1 and 2 with the symbols.

Now, with this specific challenge the string is so short it doesn't make sense to do. I'd probably just push half the string and Palindromize for 10 bytes "--===__"û or golf it like Adnan did in the comments using factorial, smart man •Jh]•3B5!…-=_‡. He's also (one of?) the creator (s?) of 05AB1E.


More complex example:

https://codegolf.stackexchange.com/a/106621/59376


Also, maybe try Dennis' kolmogorov-complexity language: Bubblegum; no idea how to use this.

\$\endgroup\$
  • 2
    \$\begingroup\$ Bubblegum isn't really a good lang for ASCII-art, since it cannot possibly take input (except for the two examples), which is required for most ASCII-art challenges. Cinnamon Gum might be a better option, though I don't know much about it and to my knowledge there aren't docs \$\endgroup\$ – ETHproductions Feb 10 '17 at 18:43
  • 1
    \$\begingroup\$ Not really important, but you can golf this down to: •Jh]•3B5!…-=_‡ \$\endgroup\$ – Adnan Feb 10 '17 at 19:50
  • 1
    \$\begingroup\$ @Adnan "--===__"û for 10 ;). \$\endgroup\$ – Magic Octopus Urn Feb 10 '17 at 19:57
2
\$\begingroup\$

Paintbrush

Paintbrush is a recreational programming language created by myself, Hyper Neutrino, for the purposes of being good at ASCII-Art. It doesn't compete well with Charcoal in many cases, but it can take input and do a variety of other things. It operates on a 2D grid of characters and is able to manipulate the background character, manipulate what is considered a background character at the time, shift rows and columns, move rows and columns, copy rows, columns, or the entire grid, etc.

Some examples may be found in the GitHub repository.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.