code-golf / code-golf

A game designed to let you show off your code-fu by solving problems in the least number of characters.
https://code.golf
MIT License
1.14k stars 103 forks source link

Add Piet Lang #648

Open Bubbler-4 opened 2 years ago

Bubbler-4 commented 2 years ago

Piet is a classic esolang where the source code is an image file. It has a unique routing semantics, minimalistic but reasonable set of commands, and a lot of metagolfing potential.

Some of the obstacles for adding this language to code.golf include:

I want to mainly discuss about encoding of source code before actually working on adding it.

Bubbler-4 commented 2 years ago

For anyone who hasn't tried Piet before, you can play with it in my online interpreter.

MichalMarsalek commented 2 weeks ago

How about chars score = number of codels, bytes score = size of a PNG encoding the image?

Who says that the encoding used for measuring the byte score must always be UTF8? That makes sense for languages whose source is naturally represented as text, but that's not the case for Piet. Just as UTF8 is de facto standard for lossless text encoding, PNG is de facto standard for lossless image encoding.

Regarding the UI, I have no idea how hard it would be to implement an image editor/if there are easy to use js libraries, but imo it wouldn't be a big deal if the "editor" was just a read-only view of the image and you could update it by copy pasting.

Bubbler-4 commented 2 weeks ago

I'd like to keep submission to some text format because

MichalMarsalek commented 2 weeks ago

Whatever the format, the chars score should be the number of codels. We could enforce a text format where byte=codel (the one you linked + error when lines do not all have equal length), but since we do have 2 scoring methods on the site, I'd say just leave it raw for the byte scoring (endlines cause extra byte, but black codels at the end of line save bytes).