25
1
Recently, I made a made a typo and I wrote unicorn instead of unicode, I did what any normal person would do and I made an esolang out of it. In this challenge you will be writing a Unicorn interpreter.
Because Unicorn programs are horrible long, you'll have to write a short interpreter to compensate for this.
Example
These are the transpiled result, not the actual interpreted result your program should output
1
alert([x=(p=prompt())/2+Math.sqrt(p*p/4-prompt()),p-x])
"Hello, World!"
Specification
- Unicorn is divided into "sections" which are space-separated
- Each section represents a character
- The number of unicorns (
) in each section is converted to it's associated character (i.e. 32 unicorns ->
chr(32)
->).
- If the section contains goats (
), the length of the amount of goats should be doubled, then converted to the associated character
- If the section contains any other characters, the program should ignore the character.
- Each section (character) should be joined to form a program
- This resulting program should be evaluated in the language you have written the program in. (e.g. JavaScript's
eval
, Python'sexec
) - Unicorns are unicode
U+1F984
; goats are unicodeU+1F410
. - If you choose a compiled language, you may output/save the compiled, compiled unicorn code
(unicorns) and
(goats) all count as one byte for this challenge.
If your language doesn't support emojis, you may identify unicorns as (u
) and goats as (g
). You may not support emojis and u
,g
If you really want to see the unicodes unicorns, here is a picture of this post
+50 bounty: to the shortest program in (the original) Unicorn while being under 6500 chars. You must use this version, it must run on Firefox, Chrome, or Safari.
17
I didn't know unicorns were that shape.
– Doorknob – 2015-12-28T22:00:13.0205@Doorknob冰 This is the era of rectangular unicorns! – TanMath – 2015-12-28T22:01:35.983
@Doorknob冰 ssshhh, don't hurt the unicorn's feelings (I'll update the post) – Downgoat – 2015-12-28T22:01:49.857
Do you know if your bonus is possible? Meaning, have you tried to do your own bonus? – TanMath – 2015-12-28T22:10:26.770
@TanMath I'm very sure it's possible. I've tried and with minimal golfing I've come close – Downgoat – 2015-12-28T22:11:09.457
Can you tell us the code points of those characters? – SuperJedi224 – 2015-12-28T22:12:30.607
@SuperJedi224 "Unicorns are unicode U+1F984; goats are unicode U+1F410." The code points depending on which encoding and number of bytes will differ. You can use this site for the bytes across different encodings
– Downgoat – 2015-12-28T22:13:39.813@Doᴡɴɢᴏᴀᴛ is it absolutely necessary for me to have the unicode character show up? It does not render for me... – TanMath – 2015-12-28T22:17:35.030
@Maltysen no, you'll need to execute it as a Pyth program – Downgoat – 2015-12-28T22:18:49.193
4
For those who can't see the unicorn and goat on this page, unicorn and goat.
– El'endia Starman – 2015-12-28T22:19:59.420Does evaluation of the resulting program have to be independent of the unicorn interpreter environment? E.g. in C the resulting program a) needs to provide a
main
function and b) gets it's own fresh global scope. – nimi – 2015-12-28T22:34:32.750@nimi hmm, didn't consider that, if you write it in a compiled language, I guess you could output/save the compiled unicorn program. If you write it in an interpreted language, it doesn't need it's own environment but it's fine if it does – Downgoat – 2015-12-28T22:35:59.310
1@insertusernamehere that depends on your language, if your language can handle Unicode characters within the code then sections may be as long as unicode supports. If your language supports ASCII only characters within the code, sections will never be longer than 127 unicorns. – Downgoat – 2015-12-28T22:39:10.347
@nimi the character – Downgoat – 2015-12-28T22:49:09.027
Could you include a few test cases? I get
a6er:[<=8=8rom8:))/2+Ma:4.sqr:8*8/-8rom8:))8-<])
for your diamond code. – Dennis – 2015-12-28T22:49:31.930@Dennis sure give me a minute (or 5) to write some up – Downgoat – 2015-12-28T22:51:12.783
@Maltysen I mean the transpiled code, not the end result. – Dennis – 2015-12-28T22:55:16.640
16I can see the goats, but not the unicorns. Are they hiding, or are the goats not letting me see the unicorns? – Rɪᴋᴇʀ – 2015-12-28T23:11:23.837
@RikerW The goats must of scared the unicorns away :( I'll add a picture of the post – Downgoat – 2015-12-28T23:12:11.107
Thanks. If I didn't believe in unicorns I would wonder why my browser shows goats but not unicorns. – Rɪᴋᴇʀ – 2015-12-28T23:41:06.137
14On my computer, this language should be called "Funny Unicode Boxes". – cat – 2015-12-29T00:40:43.093
Oh, wait, people already made jokes to that effect, never mind. – cat – 2015-12-29T00:41:08.327
1nice unicorns B) – cat – 2015-12-29T00:50:18.727
1I'm pretty sure 6500 chars is impossible unless you go for the
ug
approach which still will take a lot – ev3commander – 2015-12-29T01:38:31.3331"This resulting program should be evaluated in the language you have written the program in." So no self-hosting Unicorn interpreter, then? It'd be Unicorn all the way down... – Tim Pederick – 2015-12-29T05:22:14.610
1
In fact they are invisible pink unicorns.
– alephalpha – 2015-12-29T05:26:16.483You did ask for the length of the amount of goats, doubled, correct? – LegionMammal978 – 2015-12-29T11:05:08.647
No compiled languages? Sad. :( – Kroltan – 2015-12-29T13:15:59.820
Can we include rainbows and sparkles in the unicorn code? – ev3commander – 2015-12-29T13:46:55.023
1Does each section contain only goats or only unicorns? If not, if we have section
uugg
that's\x06
, right? – Sherlock9 – 2015-12-29T14:44:19.6672I did what any normal person would do and I made an esolang out of it. I love it haha – Ikaros – 2015-12-29T17:45:13.373
Can we use the latest version of Unicorn with the rainbows and more for the bounty? – TanMath – 2016-01-01T20:05:19.570
@TanMath no you must use the specified version – Downgoat – 2016-01-01T20:05:51.587
Can we use Unicorn => Pyth? – ev3commander – 2016-01-02T19:04:53.900
@BlockCoder1392 for the bonus? No, you must use JavaScript Unicorn – Downgoat – 2016-01-02T19:05:27.223
I thought so. I was just making sure – ev3commander – 2016-01-02T19:06:03.490
https://www.youtube.com/watch?v=T3U9hFaPl5w – 12Me21 – 2017-01-28T17:05:09.013