Do you have any code-golf tips for writing in SOGL, a golfing language created by dzaima?
Your tips should be at least somewhat specific to SOGL.
Please post one tip per answer.
2 Answers 2
Use the compression creator
Here is a new, buggy but mostly working online JavaScript compression creator. There, in each line enter a part of the string on each line which closest matches one of:
- custom dictionary string - this will find the different characters used in the part, store them and store a number in the base of the amount of characters. This is effective for strings like
niooaaoasoioaiaaaoiineeaeiwhere there aren't a lot of different characters. It also works well for just a single character repeated. This has a limit of 98+(different characters used), and the compressor (currently) doesn't auto-split those. - boxstrings - strings with only the characters
/\|_-and\n. Practically the same as custom dictionary strings, but more efficient. Note that this is chooses whether to use/and\with the same bit, so then custom strings will be used. This has a limit the same as custom dictionary strings. - english - this has two word dictionaries, one of length 256 and another of ±65500. This only contains lowercase words and automatically adds spaces between words. To get something like
spacefacedo two parts ofspaceandface. Each english part has a max of 4 words. If a 4-word part is followed by more english, it adds a space between. Trough the compressor will automatically split the input for you.
Note: the dictionary contains only lowercase versions of strings (exceptI,I've, and a couple others), so you must correctly case if after usage (using the characters(- uppercase 1st letter,)- sentence-case,ū- every words 1st letter). - ascii - Plain ascii - each part is 1-18 long (trough 1 and 2 are done differently) and auto-splits for you. Approx. 87% compression ratio.
Other stuff:
- It's always useful to try different combinations and see which is smaller. At the end, it gives you the original and ending byte count and compression ratio. This might be automated sometime in the future.
For example,
-_-_\_/_-is shorter than-_-_\_/_-and as different parts
An example input would be
row
,
row
,
row your boat
,¶"
, which outputs "π3⁄4⌡īk#S)G67λ7&[¶6āΡn‘, after which I can put uppercase 1st letter and remove the starting quote and get π3⁄4⌡īk#S)G67λ7&[¶6āΡn‘( for Row, row, row your boat,\n"
-
2\$\begingroup\$ I recognise
niooaaoasoioaiaaaoiineeaeiwas that my magic string from The Alphabet song? \$\endgroup\$Jonathan Allan– Jonathan Allan2017年04月23日 22:10:35 +00:00Commented Apr 23, 2017 at 22:10 -
\$\begingroup\$ Yep :D (message requires 15 characters) \$\endgroup\$dzaima– dzaima2017年04月23日 22:11:45 +00:00Commented Apr 23, 2017 at 22:11
-
\$\begingroup\$ Can you put this on OpenProcessing ty \$\endgroup\$ASCII-only– ASCII-only2017年08月24日 21:10:27 +00:00Commented Aug 24, 2017 at 21:10
-
\$\begingroup\$ @ASCII-only there you go. Not on OpenProcessing because it'd have taken me more time to get it there (and even more to update it) and ugly but It took me 4 hours to get it to work with processing.js so I'm happy \$\endgroup\$dzaima– dzaima2017年08月25日 07:54:51 +00:00Commented Aug 25, 2017 at 7:54
Remove unnecessary quotes and brackets
You can remove quotes if the string they're encasing is either at the beggining of the program, or right after another string. For example, "hello""world" can be shortened to hello"world". This works for all types of quotes, mixed or not.
Similarly this works with brackets. No need to write } after {, ?, nor any of []F∫‽⌠. You can also ommit a starting { if there exists and ending }
tipsquestions are actually on topic here (see all the others under the tag). \$\endgroup\$