Output the ŋarâþ crîþ alphabet song without using (m)any letters Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) The PPCG Site design is on its way - help us make it awesome! Sandbox for Proposed ChallengesChallenge: take ciphered text and decipher, also print out if it was offset to the left or rightAlphanumeric balanceFinding prime numbers without using “prime characters”A Kingdom Hearts VGM challengeShoot the ASCII MoonCreate an Alphabet SongOutput a text that doesn't output any of the characters used in the instructions to output the textI'm thinking of a number (Cop's Thread)Compressing the Atomic Ionization EnergiesOutput your Score!
How does a Death Domain cleric's Touch of Death feature work with Touch-range spells delivered by familiars?
What does the "x" in "x86" represent?
Sorting numerically
Why aren't air breathing engines used as small first stages
Storing hydrofluoric acid before the invention of plastics
Why does Python start at index -1 when indexing a list from the end?
Single word antonym of "flightless"
What is the longest distance a 13th-level monk can jump while attacking on the same turn?
What is the musical term for a note that continously plays through a melody?
Is above average number of years spent on PhD considered a red flag in future academia or industry positions?
Why did the IBM 650 use bi-quinary?
Did Xerox really develop the first LAN?
do i need a schengen visa for a direct flight to amsterdam?
Is it ethical to give a final exam after the professor has quit before teaching the remaining chapters of the course?
Can inflation occur in a positive-sum game currency system such as the Stack Exchange reputation system?
Is it true that "carbohydrates are of no use for the basal metabolic need"?
Why is "Captain Marvel" translated as male in Portugal?
What would be the ideal power source for a cybernetic eye?
Diagram with tikz
Dating a Former Employee
Problem drawing boxes with arrows in tikZ
How widely used is the term Treppenwitz? Is it something that most Germans know?
Super Attribute Position on Product Page Magento 1
Determinant is linear as a function of each of the rows of the matrix.
Output the ŋarâþ crîþ alphabet song without using (m)any letters
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
The PPCG Site design is on its way - help us make it awesome!
Sandbox for Proposed ChallengesChallenge: take ciphered text and decipher, also print out if it was offset to the left or rightAlphanumeric balanceFinding prime numbers without using “prime characters”A Kingdom Hearts VGM challengeShoot the ASCII MoonCreate an Alphabet SongOutput a text that doesn't output any of the characters used in the instructions to output the textI'm thinking of a number (Cop's Thread)Compressing the Atomic Ionization EnergiesOutput your Score!
$begingroup$
Your goal is to write a program that takes no input and outputs the following text:
ca e na ŋa va o sa;
þa ša ra la ła.
ma a pa fa ga ta ča;
în ja i da ða.
ar ħo ên ôn ân uħo;
carþ taŋ neŋ es nem.
elo cenvos.
But there's a catch: for each letter (any character whose general category in Unicode starts with L
) in your source, you get a penalty of 20 characters! (For reference, the text to be printed has 81 letters.)
The Perl 6 code below has 145 bytes and 84 letters, so it gets a score of 1,845:
say "ca e na ŋa va o sa;
þa ša ra la ła.
ma a pa fa ga ta ča;
în ja i da ða.
ar ħo ên ôn ân uħo;
carþ taŋ neŋ es nem.
elo cenvos."
The code below has 152 bytes and 70 letters, so it gets a score of 1,552:
$_="C e N ŋa V o S;
Þ Š R L Ł.
M a P F G T Č;
în J i D Ð.
ar ħo ên ôn ân uħo;
Crþ Tŋ neŋ es nem.
elo cenvos.";s:g/<:Lu>/$/.lc~'a'/;.say
Standard loopholes are forbidden.
Originally, I thought of forbidding letters altogether, but I don't think there are many languages that make this possible. You're more than welcome to try.
(ŋarâþ crîþ [ˈŋaɹa̰θ kɹḭθ] is one of my conlangs. I wanted to capitalise its name here, but I get the ugly big eng here. Oh well, the language doesn't use capital letters in its romanisation anyway.)
code-challenge kolmogorov-complexity restricted-source
$endgroup$
add a comment |
$begingroup$
Your goal is to write a program that takes no input and outputs the following text:
ca e na ŋa va o sa;
þa ša ra la ła.
ma a pa fa ga ta ča;
în ja i da ða.
ar ħo ên ôn ân uħo;
carþ taŋ neŋ es nem.
elo cenvos.
But there's a catch: for each letter (any character whose general category in Unicode starts with L
) in your source, you get a penalty of 20 characters! (For reference, the text to be printed has 81 letters.)
The Perl 6 code below has 145 bytes and 84 letters, so it gets a score of 1,845:
say "ca e na ŋa va o sa;
þa ša ra la ła.
ma a pa fa ga ta ča;
în ja i da ða.
ar ħo ên ôn ân uħo;
carþ taŋ neŋ es nem.
elo cenvos."
The code below has 152 bytes and 70 letters, so it gets a score of 1,552:
$_="C e N ŋa V o S;
Þ Š R L Ł.
M a P F G T Č;
în J i D Ð.
ar ħo ên ôn ân uħo;
Crþ Tŋ neŋ es nem.
elo cenvos.";s:g/<:Lu>/$/.lc~'a'/;.say
Standard loopholes are forbidden.
Originally, I thought of forbidding letters altogether, but I don't think there are many languages that make this possible. You're more than welcome to try.
(ŋarâþ crîþ [ˈŋaɹa̰θ kɹḭθ] is one of my conlangs. I wanted to capitalise its name here, but I get the ugly big eng here. Oh well, the language doesn't use capital letters in its romanisation anyway.)
code-challenge kolmogorov-complexity restricted-source
$endgroup$
5
$begingroup$
kolmogorov-complexity, restricted-source, and special scoring are all sorts of things that benefit greatly from careful consideration in the sandbox. Currently, it seems like the best approach to this challenge would be to just write out all of the codepoints in decimal then turn them into text with a builtin, with some shortcut to encode all of thea
s--or not, depending on how many letters it would take, because 20 characters is a really big penalty (although when everything else is scored by bytes, it's not quite well defined...)!
$endgroup$
– Unrelated String
10 hours ago
1
$begingroup$
And considering the invocation of Unicode, some explicit rules governing special codepages as used by most golflangs are probably called for (alongside maybe a link to a script to validate scoring).
$endgroup$
– Unrelated String
9 hours ago
add a comment |
$begingroup$
Your goal is to write a program that takes no input and outputs the following text:
ca e na ŋa va o sa;
þa ša ra la ła.
ma a pa fa ga ta ča;
în ja i da ða.
ar ħo ên ôn ân uħo;
carþ taŋ neŋ es nem.
elo cenvos.
But there's a catch: for each letter (any character whose general category in Unicode starts with L
) in your source, you get a penalty of 20 characters! (For reference, the text to be printed has 81 letters.)
The Perl 6 code below has 145 bytes and 84 letters, so it gets a score of 1,845:
say "ca e na ŋa va o sa;
þa ša ra la ła.
ma a pa fa ga ta ča;
în ja i da ða.
ar ħo ên ôn ân uħo;
carþ taŋ neŋ es nem.
elo cenvos."
The code below has 152 bytes and 70 letters, so it gets a score of 1,552:
$_="C e N ŋa V o S;
Þ Š R L Ł.
M a P F G T Č;
în J i D Ð.
ar ħo ên ôn ân uħo;
Crþ Tŋ neŋ es nem.
elo cenvos.";s:g/<:Lu>/$/.lc~'a'/;.say
Standard loopholes are forbidden.
Originally, I thought of forbidding letters altogether, but I don't think there are many languages that make this possible. You're more than welcome to try.
(ŋarâþ crîþ [ˈŋaɹa̰θ kɹḭθ] is one of my conlangs. I wanted to capitalise its name here, but I get the ugly big eng here. Oh well, the language doesn't use capital letters in its romanisation anyway.)
code-challenge kolmogorov-complexity restricted-source
$endgroup$
Your goal is to write a program that takes no input and outputs the following text:
ca e na ŋa va o sa;
þa ša ra la ła.
ma a pa fa ga ta ča;
în ja i da ða.
ar ħo ên ôn ân uħo;
carþ taŋ neŋ es nem.
elo cenvos.
But there's a catch: for each letter (any character whose general category in Unicode starts with L
) in your source, you get a penalty of 20 characters! (For reference, the text to be printed has 81 letters.)
The Perl 6 code below has 145 bytes and 84 letters, so it gets a score of 1,845:
say "ca e na ŋa va o sa;
þa ša ra la ła.
ma a pa fa ga ta ča;
în ja i da ða.
ar ħo ên ôn ân uħo;
carþ taŋ neŋ es nem.
elo cenvos."
The code below has 152 bytes and 70 letters, so it gets a score of 1,552:
$_="C e N ŋa V o S;
Þ Š R L Ł.
M a P F G T Č;
în J i D Ð.
ar ħo ên ôn ân uħo;
Crþ Tŋ neŋ es nem.
elo cenvos.";s:g/<:Lu>/$/.lc~'a'/;.say
Standard loopholes are forbidden.
Originally, I thought of forbidding letters altogether, but I don't think there are many languages that make this possible. You're more than welcome to try.
(ŋarâþ crîþ [ˈŋaɹa̰θ kɹḭθ] is one of my conlangs. I wanted to capitalise its name here, but I get the ugly big eng here. Oh well, the language doesn't use capital letters in its romanisation anyway.)
code-challenge kolmogorov-complexity restricted-source
code-challenge kolmogorov-complexity restricted-source
edited 6 hours ago
Rɪᴋᴇʀ
6,12543069
6,12543069
asked 11 hours ago
bb94bb94
1,137711
1,137711
5
$begingroup$
kolmogorov-complexity, restricted-source, and special scoring are all sorts of things that benefit greatly from careful consideration in the sandbox. Currently, it seems like the best approach to this challenge would be to just write out all of the codepoints in decimal then turn them into text with a builtin, with some shortcut to encode all of thea
s--or not, depending on how many letters it would take, because 20 characters is a really big penalty (although when everything else is scored by bytes, it's not quite well defined...)!
$endgroup$
– Unrelated String
10 hours ago
1
$begingroup$
And considering the invocation of Unicode, some explicit rules governing special codepages as used by most golflangs are probably called for (alongside maybe a link to a script to validate scoring).
$endgroup$
– Unrelated String
9 hours ago
add a comment |
5
$begingroup$
kolmogorov-complexity, restricted-source, and special scoring are all sorts of things that benefit greatly from careful consideration in the sandbox. Currently, it seems like the best approach to this challenge would be to just write out all of the codepoints in decimal then turn them into text with a builtin, with some shortcut to encode all of thea
s--or not, depending on how many letters it would take, because 20 characters is a really big penalty (although when everything else is scored by bytes, it's not quite well defined...)!
$endgroup$
– Unrelated String
10 hours ago
1
$begingroup$
And considering the invocation of Unicode, some explicit rules governing special codepages as used by most golflangs are probably called for (alongside maybe a link to a script to validate scoring).
$endgroup$
– Unrelated String
9 hours ago
5
5
$begingroup$
kolmogorov-complexity, restricted-source, and special scoring are all sorts of things that benefit greatly from careful consideration in the sandbox. Currently, it seems like the best approach to this challenge would be to just write out all of the codepoints in decimal then turn them into text with a builtin, with some shortcut to encode all of the
a
s--or not, depending on how many letters it would take, because 20 characters is a really big penalty (although when everything else is scored by bytes, it's not quite well defined...)!$endgroup$
– Unrelated String
10 hours ago
$begingroup$
kolmogorov-complexity, restricted-source, and special scoring are all sorts of things that benefit greatly from careful consideration in the sandbox. Currently, it seems like the best approach to this challenge would be to just write out all of the codepoints in decimal then turn them into text with a builtin, with some shortcut to encode all of the
a
s--or not, depending on how many letters it would take, because 20 characters is a really big penalty (although when everything else is scored by bytes, it's not quite well defined...)!$endgroup$
– Unrelated String
10 hours ago
1
1
$begingroup$
And considering the invocation of Unicode, some explicit rules governing special codepages as used by most golflangs are probably called for (alongside maybe a link to a script to validate scoring).
$endgroup$
– Unrelated String
9 hours ago
$begingroup$
And considering the invocation of Unicode, some explicit rules governing special codepages as used by most golflangs are probably called for (alongside maybe a link to a script to validate scoring).
$endgroup$
– Unrelated String
9 hours ago
add a comment |
8 Answers
8
active
oldest
votes
$begingroup$
Haskell, 0 letters, 423 bytes = score 423
(['10'..]!!)<$>[89,87,22,91,22,100,87,22,321,87,22,108,87,22,101,22,105,87,49,0,244,87,22,343,87,22,104,87,22,98,87,22,312,87,36,0,99,87,22,87,22,102,87,22,92,87,22,93,87,22,106,87,22,259,87,49,0,228,100,22,96,87,22,95,22,90,87,22,230,87,36,0,87,104,22,285,101,22,224,100,22,234,100,22,216,100,22,107,285,101,49,0,89,87,104,244,22,106,87,321,22,100,91,321,22,91,105,22,100,91,99,36,0,91,98,101,22,89,91,100,108,101,105,36]
Try it online!
$endgroup$
add a comment |
$begingroup$
PowerShell, scores 601 546
-join(67,65,0,69,0,78,65,0,299,65,0,86,65,0,79,0,83,65,27,-22,222,65,0,321,65,0,82,65,0,76,65,0,290,65,14,-22,77,65,0,65,0,80,65,0,70,65,0,71,65,0,84,65,0,237,65,27,-22,206,78,0,74,65,0,73,0,68,65,0,208,65,14,-22,65,82,0,263,79,0,202,78,0,212,78,0,194,78,0,85,263,79,27,-22,67,65,82,222,0,84,65,299,0,78,69,299,0,69,83,0,78,69,77,14,-22,69,76,79,0,67,69,78,86,79,83,14|%[char]($_+32))
Try it online!
Naive approach; I just took the code points and converted them to decimal, subtracted 32, then this code treats them as a char
before -join
ing it back together into a single string.
$endgroup$
$begingroup$
901, ouch
$endgroup$
– ASCII-only
6 hours ago
$begingroup$
686 :/
$endgroup$
– ASCII-only
6 hours ago
add a comment |
$begingroup$
Jelly, 274 260 bytes + 2 letters = 314 300
“19ב+49;7747,7884Ọ“19937801,1169680277365253“38“68112“;107¤+1+“@36841915390646457101051137247389928597014417227222832154722739623607566349606250000571655631221597252888655305356086227145497408221809227156852666405895387397931203673256733239614440865652”;";/V
(Uses "+,/0123456789;@V¤×Ọ‘“”
of which V
and Ọ
are Unicode letters and are used once each)
Try it online!
$endgroup$
add a comment |
$begingroup$
Jelly, 321 bytes + 2 letters = score 361
3343781777797791350694255572961968519437585132057650209974147122192542459108221624793330048943528237823681411832154316740173721249435700067706302064570847610741421342406380917446310820012503592770000532190167243585300911078873144513786923305473352724133578818457026824110152529235136461572588027747840738399150398304b354Ọ
Try it online!
This is hideous and someone can definitely do better.
Verify score.
$endgroup$
1
$begingroup$
actually less bad than it seems
$endgroup$
– ASCII-only
6 hours ago
add a comment |
$begingroup$
Jelly, 249 bytes (UTF-8) plus 2 letters; score = 289
“@@@ࣙ@@@[*ࢌ@࣯@@@࣐*@@@@@@࢛[*ࡼ@@@@ࡾ*@ࢵ@ࡸ@ࢂ@ࡰ@ࢵ[*ࢌ@ࣙ@ࣙ@@*@”O_>999×1902$$$_32Ọ
Try it online!
I couldn’t get this to work with TIO’s Jelly option, so the TIO link uses Python 3 to call Jelly. I think this is because of all the UTF-8 characters not in Jelly’s codepage.
Verify score!
$endgroup$
$begingroup$
So should this bePython 3 with jelly
? (in which case the header & footer count).
$endgroup$
– Jonathan Allan
7 hours ago
$begingroup$
...or does it run with-eu
/-fu
? (in which case it should beJelly with flags -eu
or ...).
$endgroup$
– Jonathan Allan
7 hours ago
add a comment |
$begingroup$
7, 410 characters, 154 bytes in 7's encoding, 0 letters = score 154
55104010504200144434451510201304004220120504005434473340353241135014335450302052254241052253052244241052335452241114014241310052340435303052335442302052335500302052335430302052313340435303135014243241310335514052312241341351052302245341351525755102440304030434030421030442030424030455733413512410523142410523030523112411350143355142410523414252410523102410523002410523413342411145257551220304010420030455741403
Try it online!
In a challenge that dislikes using letters, what better language to use than one consisting only of digits?
This is a full program that exits via crashing, so there's extraneous output to stderr, but stdout is correct.
Explanation
A 7 program, on its first iteration, simply pushes a number of elements to the stack (because out of the 12 commands that exist in 7, only 8 of them can be represented in a source program, and those 8 are specialised for writing code to push particular data structures to the stack). This program does not use the 6
command (which is the simplest way to create nested structures, but otherwise tends not to appear literally in a source program), so it's only the 7
commands that determine the structure; 7
pushes a new empty element to the top of stack (whereas the 0
…5
commands just append to the top of stack). We can thus add whitespace to the program to show its structure:
551040105042001444344515102013040042201205040054344 7
33403532411350143354503020522542410522530522442410523354522411140142413100523
40435303052335442302052335500302052335430302052313340435303135014243241310335
514052312241341351052302245341351525 7
55102440304030434030421030442030424030455 7
33413512410523142410523030523112411350143355142410523414252410523102410523002
41052341334241114525 7
551220304010420030455 7
41403
The elements near the end of the program are pushed last, so are on top of the stack at the start of the second iteration. On this iteration, and all future iterations, the 7 interpreter automatically makes a copy of the top of the stack and interprets it as a program. The literal 41403
pushes the (non-literal, live code) 47463
(7 has 12 commands but only 8 of them have names; as such, I use bold to show the code, and non-bold to show the literal that generates that code, meaning that, e.g. 4
is the command that appends 4
to the top stack element). So the program that runs on the second iteration is 47463
. Here's what that does:
47463
4 Swap top two stack elements, add an empty element in between
7 Add an empty stack element to the top of stack
4 Swap top two stack elements, add an empty element in between
6 Work out which commands would generate the top stack element;
append that to the element below (and pop the old top of stack)
3 Output the top stack element, pop the element below
This is easier to understand if we look at what happens to the stack:
- … d c b a
47463
(code to run:47463
) - … d c b
47463
empty a (code to run:7463
) - … d c b
47463
empty a empty (code to run:463
) - … d c b
47463
empty empty empty a (code to run:63
) - … d c b
47463
empty empty "a" (code to run:3
) - … d c b
47463
empty (code to run: empty)
In other words, we take the top of stack a, work out what code is most likely to have produced it, and output that code. The 7 interpreter automatically pops empty elements from the top of stack at the end of an iteration, so we end up with the 47463
back on top of the stack, just as in the original program. It should be easy to see what happens next: we end up churning through every stack element one after another, outputting them all, until the stack underflows and the program crashes. So we've basically created a simple output loop that looks at the program's source code to determine what to output (we're not outputting the data structures that were pushes to the stack by our 0
…5
commands, we're instead recreating what commands were used by looking at what structures were created, and outputting those). Thus, the first piece of data output is 551220304010420030455
(the source code that generates the second-from-top stack element), the second is 3341351…114525
(the source code that generates the third-from-top stack element), and so on.
Obviously, though, these pieces of source code aren't being output unencoded. 7 contains several different domain-specific languages for encoding output; once a domain-specific language is chosen, it remains in use until explicitly cleared, but if none of the languages have been chosen yet, the first digit of the code being output determines which of the languages to use. In this program, only two languages are used: 551
and 3
.
551
is pretty simple: it's basically the old Baudot/teletype code used to transmit letters over teletypes, as a 5-bit character set, but modified to make all the letters lowercase. So the first chunk of code to be output decodes like this:
551 22 03 04 01 04 20 03 04 55
c a SP e SP n a SP reset output format
As can be seen, we're fitting each character into two octal digits, which is a pretty decent compression ratio. Pairs of digits in the 0-5 range give us 36 possibilities, as opposed to the 32 possibilities that Baudot needs, so the remaining four are used for special commands; in this case, the 55
at the end clears the remembered output format, letting us use a different format for the next piece of output we produce.
3
is conceptually even simpler, but with a twist. The basic idea is to take groups of three digits (again, in the 0-5 range, as those are the digits for which we can guarantee that we can recreate the original source code from its output), interpret them as a three-digit number in base 6, and just output it as a byte in binary (thus letting us output the multibyte characters in the desired output simply by outputting multiple bytes). The twist, though, comes from the fact that there are only 216 three-digit numbers (with possible leading zeroes) in base 6, but 256 possible bytes. 7 gets round this by linking numbers from 332₆ = 128₁₀ upwards to two different bytes; 332
can output either byte 128 or 192, 333
either byte 129 or 193, and so on, up to 515
which outputs either byte 191 or 255.
How does the program know which of the two possibilities to output? It's possible to use triplets of digits from 520
upwards to control this explicitly, but in this program we don't have to: 7's default is to pick all the ambiguous bytes in such a way that the output is valid UTF-8! It turns out that there's always at most one way to do this, so as long as it's UTF-8 we want (and we do in this case), we can just leave it ambiguous and the program works anyway.
The end of each of the 3…
sections is 525
, which resets the output format, letting us go back to 551
for the next section.
$endgroup$
add a comment |
$begingroup$
Python 3, 397 bytes + 19 letters = 777 score
print(''.join(chr(i+32)for i in[67,65,0,69,0,78,65,0,299,65,0,86,65,0,79,0,83,65,27,-22,222,65,0,321,65,0,82,65,0,76,65,0,290,65,14,-22,77,65,0,65,0,80,65,0,70,65,0,71,65,0,84,65,0,237,65,27,-22,206,78,0,74,65,0,73,0,68,65,0,208,65,14,-22,65,82,0,263,79,0,202,78,0,212,78,0,194,78,0,85,263,79,27,-22,67,65,82,222,0,84,65,299,0,78,69,299,0,69,83,0,78,69,77,14,-22,69,76,79,0,67,69,78,86,79,83,14]))
Try it online!
Port of AdmBorkBork's answer.
$endgroup$
add a comment |
$begingroup$
Retina, 141 characters, 160 bytes, 15 letters = score 460
K`%# ' 1# !# 9# 2 6#;¶þ# š# 5# /# ł#.¶0# # 3# (# )# 7# č#;¶î1 ,# + &# ð#.¶#5 ħ2 ê1 ô1 â1 8ħ2;¶%#5þ 7#! 1'! '6 1'0.¶'/2 %'1926.
T`!--/-9`ŋ`-{
Try it online!
$endgroup$
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "200"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f183248%2foutput-the-%25c5%258bar%25c3%25a2%25c3%25be-cr%25c3%25ae%25c3%25be-alphabet-song-without-using-many-letters%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
8 Answers
8
active
oldest
votes
8 Answers
8
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
Haskell, 0 letters, 423 bytes = score 423
(['10'..]!!)<$>[89,87,22,91,22,100,87,22,321,87,22,108,87,22,101,22,105,87,49,0,244,87,22,343,87,22,104,87,22,98,87,22,312,87,36,0,99,87,22,87,22,102,87,22,92,87,22,93,87,22,106,87,22,259,87,49,0,228,100,22,96,87,22,95,22,90,87,22,230,87,36,0,87,104,22,285,101,22,224,100,22,234,100,22,216,100,22,107,285,101,49,0,89,87,104,244,22,106,87,321,22,100,91,321,22,91,105,22,100,91,99,36,0,91,98,101,22,89,91,100,108,101,105,36]
Try it online!
$endgroup$
add a comment |
$begingroup$
Haskell, 0 letters, 423 bytes = score 423
(['10'..]!!)<$>[89,87,22,91,22,100,87,22,321,87,22,108,87,22,101,22,105,87,49,0,244,87,22,343,87,22,104,87,22,98,87,22,312,87,36,0,99,87,22,87,22,102,87,22,92,87,22,93,87,22,106,87,22,259,87,49,0,228,100,22,96,87,22,95,22,90,87,22,230,87,36,0,87,104,22,285,101,22,224,100,22,234,100,22,216,100,22,107,285,101,49,0,89,87,104,244,22,106,87,321,22,100,91,321,22,91,105,22,100,91,99,36,0,91,98,101,22,89,91,100,108,101,105,36]
Try it online!
$endgroup$
add a comment |
$begingroup$
Haskell, 0 letters, 423 bytes = score 423
(['10'..]!!)<$>[89,87,22,91,22,100,87,22,321,87,22,108,87,22,101,22,105,87,49,0,244,87,22,343,87,22,104,87,22,98,87,22,312,87,36,0,99,87,22,87,22,102,87,22,92,87,22,93,87,22,106,87,22,259,87,49,0,228,100,22,96,87,22,95,22,90,87,22,230,87,36,0,87,104,22,285,101,22,224,100,22,234,100,22,216,100,22,107,285,101,49,0,89,87,104,244,22,106,87,321,22,100,91,321,22,91,105,22,100,91,99,36,0,91,98,101,22,89,91,100,108,101,105,36]
Try it online!
$endgroup$
Haskell, 0 letters, 423 bytes = score 423
(['10'..]!!)<$>[89,87,22,91,22,100,87,22,321,87,22,108,87,22,101,22,105,87,49,0,244,87,22,343,87,22,104,87,22,98,87,22,312,87,36,0,99,87,22,87,22,102,87,22,92,87,22,93,87,22,106,87,22,259,87,49,0,228,100,22,96,87,22,95,22,90,87,22,230,87,36,0,87,104,22,285,101,22,224,100,22,234,100,22,216,100,22,107,285,101,49,0,89,87,104,244,22,106,87,321,22,100,91,321,22,91,105,22,100,91,99,36,0,91,98,101,22,89,91,100,108,101,105,36]
Try it online!
answered 9 hours ago
niminimi
32.7k32489
32.7k32489
add a comment |
add a comment |
$begingroup$
PowerShell, scores 601 546
-join(67,65,0,69,0,78,65,0,299,65,0,86,65,0,79,0,83,65,27,-22,222,65,0,321,65,0,82,65,0,76,65,0,290,65,14,-22,77,65,0,65,0,80,65,0,70,65,0,71,65,0,84,65,0,237,65,27,-22,206,78,0,74,65,0,73,0,68,65,0,208,65,14,-22,65,82,0,263,79,0,202,78,0,212,78,0,194,78,0,85,263,79,27,-22,67,65,82,222,0,84,65,299,0,78,69,299,0,69,83,0,78,69,77,14,-22,69,76,79,0,67,69,78,86,79,83,14|%[char]($_+32))
Try it online!
Naive approach; I just took the code points and converted them to decimal, subtracted 32, then this code treats them as a char
before -join
ing it back together into a single string.
$endgroup$
$begingroup$
901, ouch
$endgroup$
– ASCII-only
6 hours ago
$begingroup$
686 :/
$endgroup$
– ASCII-only
6 hours ago
add a comment |
$begingroup$
PowerShell, scores 601 546
-join(67,65,0,69,0,78,65,0,299,65,0,86,65,0,79,0,83,65,27,-22,222,65,0,321,65,0,82,65,0,76,65,0,290,65,14,-22,77,65,0,65,0,80,65,0,70,65,0,71,65,0,84,65,0,237,65,27,-22,206,78,0,74,65,0,73,0,68,65,0,208,65,14,-22,65,82,0,263,79,0,202,78,0,212,78,0,194,78,0,85,263,79,27,-22,67,65,82,222,0,84,65,299,0,78,69,299,0,69,83,0,78,69,77,14,-22,69,76,79,0,67,69,78,86,79,83,14|%[char]($_+32))
Try it online!
Naive approach; I just took the code points and converted them to decimal, subtracted 32, then this code treats them as a char
before -join
ing it back together into a single string.
$endgroup$
$begingroup$
901, ouch
$endgroup$
– ASCII-only
6 hours ago
$begingroup$
686 :/
$endgroup$
– ASCII-only
6 hours ago
add a comment |
$begingroup$
PowerShell, scores 601 546
-join(67,65,0,69,0,78,65,0,299,65,0,86,65,0,79,0,83,65,27,-22,222,65,0,321,65,0,82,65,0,76,65,0,290,65,14,-22,77,65,0,65,0,80,65,0,70,65,0,71,65,0,84,65,0,237,65,27,-22,206,78,0,74,65,0,73,0,68,65,0,208,65,14,-22,65,82,0,263,79,0,202,78,0,212,78,0,194,78,0,85,263,79,27,-22,67,65,82,222,0,84,65,299,0,78,69,299,0,69,83,0,78,69,77,14,-22,69,76,79,0,67,69,78,86,79,83,14|%[char]($_+32))
Try it online!
Naive approach; I just took the code points and converted them to decimal, subtracted 32, then this code treats them as a char
before -join
ing it back together into a single string.
$endgroup$
PowerShell, scores 601 546
-join(67,65,0,69,0,78,65,0,299,65,0,86,65,0,79,0,83,65,27,-22,222,65,0,321,65,0,82,65,0,76,65,0,290,65,14,-22,77,65,0,65,0,80,65,0,70,65,0,71,65,0,84,65,0,237,65,27,-22,206,78,0,74,65,0,73,0,68,65,0,208,65,14,-22,65,82,0,263,79,0,202,78,0,212,78,0,194,78,0,85,263,79,27,-22,67,65,82,222,0,84,65,299,0,78,69,299,0,69,83,0,78,69,77,14,-22,69,76,79,0,67,69,78,86,79,83,14|%[char]($_+32))
Try it online!
Naive approach; I just took the code points and converted them to decimal, subtracted 32, then this code treats them as a char
before -join
ing it back together into a single string.
answered 10 hours ago
AdmBorkBorkAdmBorkBork
28k468241
28k468241
$begingroup$
901, ouch
$endgroup$
– ASCII-only
6 hours ago
$begingroup$
686 :/
$endgroup$
– ASCII-only
6 hours ago
add a comment |
$begingroup$
901, ouch
$endgroup$
– ASCII-only
6 hours ago
$begingroup$
686 :/
$endgroup$
– ASCII-only
6 hours ago
$begingroup$
901, ouch
$endgroup$
– ASCII-only
6 hours ago
$begingroup$
901, ouch
$endgroup$
– ASCII-only
6 hours ago
$begingroup$
686 :/
$endgroup$
– ASCII-only
6 hours ago
$begingroup$
686 :/
$endgroup$
– ASCII-only
6 hours ago
add a comment |
$begingroup$
Jelly, 274 260 bytes + 2 letters = 314 300
“19ב+49;7747,7884Ọ“19937801,1169680277365253“38“68112“;107¤+1+“@36841915390646457101051137247389928597014417227222832154722739623607566349606250000571655631221597252888655305356086227145497408221809227156852666405895387397931203673256733239614440865652”;";/V
(Uses "+,/0123456789;@V¤×Ọ‘“”
of which V
and Ọ
are Unicode letters and are used once each)
Try it online!
$endgroup$
add a comment |
$begingroup$
Jelly, 274 260 bytes + 2 letters = 314 300
“19ב+49;7747,7884Ọ“19937801,1169680277365253“38“68112“;107¤+1+“@36841915390646457101051137247389928597014417227222832154722739623607566349606250000571655631221597252888655305356086227145497408221809227156852666405895387397931203673256733239614440865652”;";/V
(Uses "+,/0123456789;@V¤×Ọ‘“”
of which V
and Ọ
are Unicode letters and are used once each)
Try it online!
$endgroup$
add a comment |
$begingroup$
Jelly, 274 260 bytes + 2 letters = 314 300
“19ב+49;7747,7884Ọ“19937801,1169680277365253“38“68112“;107¤+1+“@36841915390646457101051137247389928597014417227222832154722739623607566349606250000571655631221597252888655305356086227145497408221809227156852666405895387397931203673256733239614440865652”;";/V
(Uses "+,/0123456789;@V¤×Ọ‘“”
of which V
and Ọ
are Unicode letters and are used once each)
Try it online!
$endgroup$
Jelly, 274 260 bytes + 2 letters = 314 300
“19ב+49;7747,7884Ọ“19937801,1169680277365253“38“68112“;107¤+1+“@36841915390646457101051137247389928597014417227222832154722739623607566349606250000571655631221597252888655305356086227145497408221809227156852666405895387397931203673256733239614440865652”;";/V
(Uses "+,/0123456789;@V¤×Ọ‘“”
of which V
and Ọ
are Unicode letters and are used once each)
Try it online!
edited 6 hours ago
answered 8 hours ago
Jonathan AllanJonathan Allan
54.4k537174
54.4k537174
add a comment |
add a comment |
$begingroup$
Jelly, 321 bytes + 2 letters = score 361
3343781777797791350694255572961968519437585132057650209974147122192542459108221624793330048943528237823681411832154316740173721249435700067706302064570847610741421342406380917446310820012503592770000532190167243585300911078873144513786923305473352724133578818457026824110152529235136461572588027747840738399150398304b354Ọ
Try it online!
This is hideous and someone can definitely do better.
Verify score.
$endgroup$
1
$begingroup$
actually less bad than it seems
$endgroup$
– ASCII-only
6 hours ago
add a comment |
$begingroup$
Jelly, 321 bytes + 2 letters = score 361
3343781777797791350694255572961968519437585132057650209974147122192542459108221624793330048943528237823681411832154316740173721249435700067706302064570847610741421342406380917446310820012503592770000532190167243585300911078873144513786923305473352724133578818457026824110152529235136461572588027747840738399150398304b354Ọ
Try it online!
This is hideous and someone can definitely do better.
Verify score.
$endgroup$
1
$begingroup$
actually less bad than it seems
$endgroup$
– ASCII-only
6 hours ago
add a comment |
$begingroup$
Jelly, 321 bytes + 2 letters = score 361
3343781777797791350694255572961968519437585132057650209974147122192542459108221624793330048943528237823681411832154316740173721249435700067706302064570847610741421342406380917446310820012503592770000532190167243585300911078873144513786923305473352724133578818457026824110152529235136461572588027747840738399150398304b354Ọ
Try it online!
This is hideous and someone can definitely do better.
Verify score.
$endgroup$
Jelly, 321 bytes + 2 letters = score 361
3343781777797791350694255572961968519437585132057650209974147122192542459108221624793330048943528237823681411832154316740173721249435700067706302064570847610741421342406380917446310820012503592770000532190167243585300911078873144513786923305473352724133578818457026824110152529235136461572588027747840738399150398304b354Ọ
Try it online!
This is hideous and someone can definitely do better.
Verify score.
answered 10 hours ago
HyperNeutrinoHyperNeutrino
19k437148
19k437148
1
$begingroup$
actually less bad than it seems
$endgroup$
– ASCII-only
6 hours ago
add a comment |
1
$begingroup$
actually less bad than it seems
$endgroup$
– ASCII-only
6 hours ago
1
1
$begingroup$
actually less bad than it seems
$endgroup$
– ASCII-only
6 hours ago
$begingroup$
actually less bad than it seems
$endgroup$
– ASCII-only
6 hours ago
add a comment |
$begingroup$
Jelly, 249 bytes (UTF-8) plus 2 letters; score = 289
“@@@ࣙ@@@[*ࢌ@࣯@@@࣐*@@@@@@࢛[*ࡼ@@@@ࡾ*@ࢵ@ࡸ@ࢂ@ࡰ@ࢵ[*ࢌ@ࣙ@ࣙ@@*@”O_>999×1902$$$_32Ọ
Try it online!
I couldn’t get this to work with TIO’s Jelly option, so the TIO link uses Python 3 to call Jelly. I think this is because of all the UTF-8 characters not in Jelly’s codepage.
Verify score!
$endgroup$
$begingroup$
So should this bePython 3 with jelly
? (in which case the header & footer count).
$endgroup$
– Jonathan Allan
7 hours ago
$begingroup$
...or does it run with-eu
/-fu
? (in which case it should beJelly with flags -eu
or ...).
$endgroup$
– Jonathan Allan
7 hours ago
add a comment |
$begingroup$
Jelly, 249 bytes (UTF-8) plus 2 letters; score = 289
“@@@ࣙ@@@[*ࢌ@࣯@@@࣐*@@@@@@࢛[*ࡼ@@@@ࡾ*@ࢵ@ࡸ@ࢂ@ࡰ@ࢵ[*ࢌ@ࣙ@ࣙ@@*@”O_>999×1902$$$_32Ọ
Try it online!
I couldn’t get this to work with TIO’s Jelly option, so the TIO link uses Python 3 to call Jelly. I think this is because of all the UTF-8 characters not in Jelly’s codepage.
Verify score!
$endgroup$
$begingroup$
So should this bePython 3 with jelly
? (in which case the header & footer count).
$endgroup$
– Jonathan Allan
7 hours ago
$begingroup$
...or does it run with-eu
/-fu
? (in which case it should beJelly with flags -eu
or ...).
$endgroup$
– Jonathan Allan
7 hours ago
add a comment |
$begingroup$
Jelly, 249 bytes (UTF-8) plus 2 letters; score = 289
“@@@ࣙ@@@[*ࢌ@࣯@@@࣐*@@@@@@࢛[*ࡼ@@@@ࡾ*@ࢵ@ࡸ@ࢂ@ࡰ@ࢵ[*ࢌ@ࣙ@ࣙ@@*@”O_>999×1902$$$_32Ọ
Try it online!
I couldn’t get this to work with TIO’s Jelly option, so the TIO link uses Python 3 to call Jelly. I think this is because of all the UTF-8 characters not in Jelly’s codepage.
Verify score!
$endgroup$
Jelly, 249 bytes (UTF-8) plus 2 letters; score = 289
“@@@ࣙ@@@[*ࢌ@࣯@@@࣐*@@@@@@࢛[*ࡼ@@@@ࡾ*@ࢵ@ࡸ@ࢂ@ࡰ@ࢵ[*ࢌ@ࣙ@ࣙ@@*@”O_>999×1902$$$_32Ọ
Try it online!
I couldn’t get this to work with TIO’s Jelly option, so the TIO link uses Python 3 to call Jelly. I think this is because of all the UTF-8 characters not in Jelly’s codepage.
Verify score!
edited 7 hours ago
answered 7 hours ago
Nick KennedyNick Kennedy
1,68649
1,68649
$begingroup$
So should this bePython 3 with jelly
? (in which case the header & footer count).
$endgroup$
– Jonathan Allan
7 hours ago
$begingroup$
...or does it run with-eu
/-fu
? (in which case it should beJelly with flags -eu
or ...).
$endgroup$
– Jonathan Allan
7 hours ago
add a comment |
$begingroup$
So should this bePython 3 with jelly
? (in which case the header & footer count).
$endgroup$
– Jonathan Allan
7 hours ago
$begingroup$
...or does it run with-eu
/-fu
? (in which case it should beJelly with flags -eu
or ...).
$endgroup$
– Jonathan Allan
7 hours ago
$begingroup$
So should this be
Python 3 with jelly
? (in which case the header & footer count).$endgroup$
– Jonathan Allan
7 hours ago
$begingroup$
So should this be
Python 3 with jelly
? (in which case the header & footer count).$endgroup$
– Jonathan Allan
7 hours ago
$begingroup$
...or does it run with
-eu
/ -fu
? (in which case it should be Jelly with flags -eu
or ...).$endgroup$
– Jonathan Allan
7 hours ago
$begingroup$
...or does it run with
-eu
/ -fu
? (in which case it should be Jelly with flags -eu
or ...).$endgroup$
– Jonathan Allan
7 hours ago
add a comment |
$begingroup$
7, 410 characters, 154 bytes in 7's encoding, 0 letters = score 154
55104010504200144434451510201304004220120504005434473340353241135014335450302052254241052253052244241052335452241114014241310052340435303052335442302052335500302052335430302052313340435303135014243241310335514052312241341351052302245341351525755102440304030434030421030442030424030455733413512410523142410523030523112411350143355142410523414252410523102410523002410523413342411145257551220304010420030455741403
Try it online!
In a challenge that dislikes using letters, what better language to use than one consisting only of digits?
This is a full program that exits via crashing, so there's extraneous output to stderr, but stdout is correct.
Explanation
A 7 program, on its first iteration, simply pushes a number of elements to the stack (because out of the 12 commands that exist in 7, only 8 of them can be represented in a source program, and those 8 are specialised for writing code to push particular data structures to the stack). This program does not use the 6
command (which is the simplest way to create nested structures, but otherwise tends not to appear literally in a source program), so it's only the 7
commands that determine the structure; 7
pushes a new empty element to the top of stack (whereas the 0
…5
commands just append to the top of stack). We can thus add whitespace to the program to show its structure:
551040105042001444344515102013040042201205040054344 7
33403532411350143354503020522542410522530522442410523354522411140142413100523
40435303052335442302052335500302052335430302052313340435303135014243241310335
514052312241341351052302245341351525 7
55102440304030434030421030442030424030455 7
33413512410523142410523030523112411350143355142410523414252410523102410523002
41052341334241114525 7
551220304010420030455 7
41403
The elements near the end of the program are pushed last, so are on top of the stack at the start of the second iteration. On this iteration, and all future iterations, the 7 interpreter automatically makes a copy of the top of the stack and interprets it as a program. The literal 41403
pushes the (non-literal, live code) 47463
(7 has 12 commands but only 8 of them have names; as such, I use bold to show the code, and non-bold to show the literal that generates that code, meaning that, e.g. 4
is the command that appends 4
to the top stack element). So the program that runs on the second iteration is 47463
. Here's what that does:
47463
4 Swap top two stack elements, add an empty element in between
7 Add an empty stack element to the top of stack
4 Swap top two stack elements, add an empty element in between
6 Work out which commands would generate the top stack element;
append that to the element below (and pop the old top of stack)
3 Output the top stack element, pop the element below
This is easier to understand if we look at what happens to the stack:
- … d c b a
47463
(code to run:47463
) - … d c b
47463
empty a (code to run:7463
) - … d c b
47463
empty a empty (code to run:463
) - … d c b
47463
empty empty empty a (code to run:63
) - … d c b
47463
empty empty "a" (code to run:3
) - … d c b
47463
empty (code to run: empty)
In other words, we take the top of stack a, work out what code is most likely to have produced it, and output that code. The 7 interpreter automatically pops empty elements from the top of stack at the end of an iteration, so we end up with the 47463
back on top of the stack, just as in the original program. It should be easy to see what happens next: we end up churning through every stack element one after another, outputting them all, until the stack underflows and the program crashes. So we've basically created a simple output loop that looks at the program's source code to determine what to output (we're not outputting the data structures that were pushes to the stack by our 0
…5
commands, we're instead recreating what commands were used by looking at what structures were created, and outputting those). Thus, the first piece of data output is 551220304010420030455
(the source code that generates the second-from-top stack element), the second is 3341351…114525
(the source code that generates the third-from-top stack element), and so on.
Obviously, though, these pieces of source code aren't being output unencoded. 7 contains several different domain-specific languages for encoding output; once a domain-specific language is chosen, it remains in use until explicitly cleared, but if none of the languages have been chosen yet, the first digit of the code being output determines which of the languages to use. In this program, only two languages are used: 551
and 3
.
551
is pretty simple: it's basically the old Baudot/teletype code used to transmit letters over teletypes, as a 5-bit character set, but modified to make all the letters lowercase. So the first chunk of code to be output decodes like this:
551 22 03 04 01 04 20 03 04 55
c a SP e SP n a SP reset output format
As can be seen, we're fitting each character into two octal digits, which is a pretty decent compression ratio. Pairs of digits in the 0-5 range give us 36 possibilities, as opposed to the 32 possibilities that Baudot needs, so the remaining four are used for special commands; in this case, the 55
at the end clears the remembered output format, letting us use a different format for the next piece of output we produce.
3
is conceptually even simpler, but with a twist. The basic idea is to take groups of three digits (again, in the 0-5 range, as those are the digits for which we can guarantee that we can recreate the original source code from its output), interpret them as a three-digit number in base 6, and just output it as a byte in binary (thus letting us output the multibyte characters in the desired output simply by outputting multiple bytes). The twist, though, comes from the fact that there are only 216 three-digit numbers (with possible leading zeroes) in base 6, but 256 possible bytes. 7 gets round this by linking numbers from 332₆ = 128₁₀ upwards to two different bytes; 332
can output either byte 128 or 192, 333
either byte 129 or 193, and so on, up to 515
which outputs either byte 191 or 255.
How does the program know which of the two possibilities to output? It's possible to use triplets of digits from 520
upwards to control this explicitly, but in this program we don't have to: 7's default is to pick all the ambiguous bytes in such a way that the output is valid UTF-8! It turns out that there's always at most one way to do this, so as long as it's UTF-8 we want (and we do in this case), we can just leave it ambiguous and the program works anyway.
The end of each of the 3…
sections is 525
, which resets the output format, letting us go back to 551
for the next section.
$endgroup$
add a comment |
$begingroup$
7, 410 characters, 154 bytes in 7's encoding, 0 letters = score 154
55104010504200144434451510201304004220120504005434473340353241135014335450302052254241052253052244241052335452241114014241310052340435303052335442302052335500302052335430302052313340435303135014243241310335514052312241341351052302245341351525755102440304030434030421030442030424030455733413512410523142410523030523112411350143355142410523414252410523102410523002410523413342411145257551220304010420030455741403
Try it online!
In a challenge that dislikes using letters, what better language to use than one consisting only of digits?
This is a full program that exits via crashing, so there's extraneous output to stderr, but stdout is correct.
Explanation
A 7 program, on its first iteration, simply pushes a number of elements to the stack (because out of the 12 commands that exist in 7, only 8 of them can be represented in a source program, and those 8 are specialised for writing code to push particular data structures to the stack). This program does not use the 6
command (which is the simplest way to create nested structures, but otherwise tends not to appear literally in a source program), so it's only the 7
commands that determine the structure; 7
pushes a new empty element to the top of stack (whereas the 0
…5
commands just append to the top of stack). We can thus add whitespace to the program to show its structure:
551040105042001444344515102013040042201205040054344 7
33403532411350143354503020522542410522530522442410523354522411140142413100523
40435303052335442302052335500302052335430302052313340435303135014243241310335
514052312241341351052302245341351525 7
55102440304030434030421030442030424030455 7
33413512410523142410523030523112411350143355142410523414252410523102410523002
41052341334241114525 7
551220304010420030455 7
41403
The elements near the end of the program are pushed last, so are on top of the stack at the start of the second iteration. On this iteration, and all future iterations, the 7 interpreter automatically makes a copy of the top of the stack and interprets it as a program. The literal 41403
pushes the (non-literal, live code) 47463
(7 has 12 commands but only 8 of them have names; as such, I use bold to show the code, and non-bold to show the literal that generates that code, meaning that, e.g. 4
is the command that appends 4
to the top stack element). So the program that runs on the second iteration is 47463
. Here's what that does:
47463
4 Swap top two stack elements, add an empty element in between
7 Add an empty stack element to the top of stack
4 Swap top two stack elements, add an empty element in between
6 Work out which commands would generate the top stack element;
append that to the element below (and pop the old top of stack)
3 Output the top stack element, pop the element below
This is easier to understand if we look at what happens to the stack:
- … d c b a
47463
(code to run:47463
) - … d c b
47463
empty a (code to run:7463
) - … d c b
47463
empty a empty (code to run:463
) - … d c b
47463
empty empty empty a (code to run:63
) - … d c b
47463
empty empty "a" (code to run:3
) - … d c b
47463
empty (code to run: empty)
In other words, we take the top of stack a, work out what code is most likely to have produced it, and output that code. The 7 interpreter automatically pops empty elements from the top of stack at the end of an iteration, so we end up with the 47463
back on top of the stack, just as in the original program. It should be easy to see what happens next: we end up churning through every stack element one after another, outputting them all, until the stack underflows and the program crashes. So we've basically created a simple output loop that looks at the program's source code to determine what to output (we're not outputting the data structures that were pushes to the stack by our 0
…5
commands, we're instead recreating what commands were used by looking at what structures were created, and outputting those). Thus, the first piece of data output is 551220304010420030455
(the source code that generates the second-from-top stack element), the second is 3341351…114525
(the source code that generates the third-from-top stack element), and so on.
Obviously, though, these pieces of source code aren't being output unencoded. 7 contains several different domain-specific languages for encoding output; once a domain-specific language is chosen, it remains in use until explicitly cleared, but if none of the languages have been chosen yet, the first digit of the code being output determines which of the languages to use. In this program, only two languages are used: 551
and 3
.
551
is pretty simple: it's basically the old Baudot/teletype code used to transmit letters over teletypes, as a 5-bit character set, but modified to make all the letters lowercase. So the first chunk of code to be output decodes like this:
551 22 03 04 01 04 20 03 04 55
c a SP e SP n a SP reset output format
As can be seen, we're fitting each character into two octal digits, which is a pretty decent compression ratio. Pairs of digits in the 0-5 range give us 36 possibilities, as opposed to the 32 possibilities that Baudot needs, so the remaining four are used for special commands; in this case, the 55
at the end clears the remembered output format, letting us use a different format for the next piece of output we produce.
3
is conceptually even simpler, but with a twist. The basic idea is to take groups of three digits (again, in the 0-5 range, as those are the digits for which we can guarantee that we can recreate the original source code from its output), interpret them as a three-digit number in base 6, and just output it as a byte in binary (thus letting us output the multibyte characters in the desired output simply by outputting multiple bytes). The twist, though, comes from the fact that there are only 216 three-digit numbers (with possible leading zeroes) in base 6, but 256 possible bytes. 7 gets round this by linking numbers from 332₆ = 128₁₀ upwards to two different bytes; 332
can output either byte 128 or 192, 333
either byte 129 or 193, and so on, up to 515
which outputs either byte 191 or 255.
How does the program know which of the two possibilities to output? It's possible to use triplets of digits from 520
upwards to control this explicitly, but in this program we don't have to: 7's default is to pick all the ambiguous bytes in such a way that the output is valid UTF-8! It turns out that there's always at most one way to do this, so as long as it's UTF-8 we want (and we do in this case), we can just leave it ambiguous and the program works anyway.
The end of each of the 3…
sections is 525
, which resets the output format, letting us go back to 551
for the next section.
$endgroup$
add a comment |
$begingroup$
7, 410 characters, 154 bytes in 7's encoding, 0 letters = score 154
55104010504200144434451510201304004220120504005434473340353241135014335450302052254241052253052244241052335452241114014241310052340435303052335442302052335500302052335430302052313340435303135014243241310335514052312241341351052302245341351525755102440304030434030421030442030424030455733413512410523142410523030523112411350143355142410523414252410523102410523002410523413342411145257551220304010420030455741403
Try it online!
In a challenge that dislikes using letters, what better language to use than one consisting only of digits?
This is a full program that exits via crashing, so there's extraneous output to stderr, but stdout is correct.
Explanation
A 7 program, on its first iteration, simply pushes a number of elements to the stack (because out of the 12 commands that exist in 7, only 8 of them can be represented in a source program, and those 8 are specialised for writing code to push particular data structures to the stack). This program does not use the 6
command (which is the simplest way to create nested structures, but otherwise tends not to appear literally in a source program), so it's only the 7
commands that determine the structure; 7
pushes a new empty element to the top of stack (whereas the 0
…5
commands just append to the top of stack). We can thus add whitespace to the program to show its structure:
551040105042001444344515102013040042201205040054344 7
33403532411350143354503020522542410522530522442410523354522411140142413100523
40435303052335442302052335500302052335430302052313340435303135014243241310335
514052312241341351052302245341351525 7
55102440304030434030421030442030424030455 7
33413512410523142410523030523112411350143355142410523414252410523102410523002
41052341334241114525 7
551220304010420030455 7
41403
The elements near the end of the program are pushed last, so are on top of the stack at the start of the second iteration. On this iteration, and all future iterations, the 7 interpreter automatically makes a copy of the top of the stack and interprets it as a program. The literal 41403
pushes the (non-literal, live code) 47463
(7 has 12 commands but only 8 of them have names; as such, I use bold to show the code, and non-bold to show the literal that generates that code, meaning that, e.g. 4
is the command that appends 4
to the top stack element). So the program that runs on the second iteration is 47463
. Here's what that does:
47463
4 Swap top two stack elements, add an empty element in between
7 Add an empty stack element to the top of stack
4 Swap top two stack elements, add an empty element in between
6 Work out which commands would generate the top stack element;
append that to the element below (and pop the old top of stack)
3 Output the top stack element, pop the element below
This is easier to understand if we look at what happens to the stack:
- … d c b a
47463
(code to run:47463
) - … d c b
47463
empty a (code to run:7463
) - … d c b
47463
empty a empty (code to run:463
) - … d c b
47463
empty empty empty a (code to run:63
) - … d c b
47463
empty empty "a" (code to run:3
) - … d c b
47463
empty (code to run: empty)
In other words, we take the top of stack a, work out what code is most likely to have produced it, and output that code. The 7 interpreter automatically pops empty elements from the top of stack at the end of an iteration, so we end up with the 47463
back on top of the stack, just as in the original program. It should be easy to see what happens next: we end up churning through every stack element one after another, outputting them all, until the stack underflows and the program crashes. So we've basically created a simple output loop that looks at the program's source code to determine what to output (we're not outputting the data structures that were pushes to the stack by our 0
…5
commands, we're instead recreating what commands were used by looking at what structures were created, and outputting those). Thus, the first piece of data output is 551220304010420030455
(the source code that generates the second-from-top stack element), the second is 3341351…114525
(the source code that generates the third-from-top stack element), and so on.
Obviously, though, these pieces of source code aren't being output unencoded. 7 contains several different domain-specific languages for encoding output; once a domain-specific language is chosen, it remains in use until explicitly cleared, but if none of the languages have been chosen yet, the first digit of the code being output determines which of the languages to use. In this program, only two languages are used: 551
and 3
.
551
is pretty simple: it's basically the old Baudot/teletype code used to transmit letters over teletypes, as a 5-bit character set, but modified to make all the letters lowercase. So the first chunk of code to be output decodes like this:
551 22 03 04 01 04 20 03 04 55
c a SP e SP n a SP reset output format
As can be seen, we're fitting each character into two octal digits, which is a pretty decent compression ratio. Pairs of digits in the 0-5 range give us 36 possibilities, as opposed to the 32 possibilities that Baudot needs, so the remaining four are used for special commands; in this case, the 55
at the end clears the remembered output format, letting us use a different format for the next piece of output we produce.
3
is conceptually even simpler, but with a twist. The basic idea is to take groups of three digits (again, in the 0-5 range, as those are the digits for which we can guarantee that we can recreate the original source code from its output), interpret them as a three-digit number in base 6, and just output it as a byte in binary (thus letting us output the multibyte characters in the desired output simply by outputting multiple bytes). The twist, though, comes from the fact that there are only 216 three-digit numbers (with possible leading zeroes) in base 6, but 256 possible bytes. 7 gets round this by linking numbers from 332₆ = 128₁₀ upwards to two different bytes; 332
can output either byte 128 or 192, 333
either byte 129 or 193, and so on, up to 515
which outputs either byte 191 or 255.
How does the program know which of the two possibilities to output? It's possible to use triplets of digits from 520
upwards to control this explicitly, but in this program we don't have to: 7's default is to pick all the ambiguous bytes in such a way that the output is valid UTF-8! It turns out that there's always at most one way to do this, so as long as it's UTF-8 we want (and we do in this case), we can just leave it ambiguous and the program works anyway.
The end of each of the 3…
sections is 525
, which resets the output format, letting us go back to 551
for the next section.
$endgroup$
7, 410 characters, 154 bytes in 7's encoding, 0 letters = score 154
55104010504200144434451510201304004220120504005434473340353241135014335450302052254241052253052244241052335452241114014241310052340435303052335442302052335500302052335430302052313340435303135014243241310335514052312241341351052302245341351525755102440304030434030421030442030424030455733413512410523142410523030523112411350143355142410523414252410523102410523002410523413342411145257551220304010420030455741403
Try it online!
In a challenge that dislikes using letters, what better language to use than one consisting only of digits?
This is a full program that exits via crashing, so there's extraneous output to stderr, but stdout is correct.
Explanation
A 7 program, on its first iteration, simply pushes a number of elements to the stack (because out of the 12 commands that exist in 7, only 8 of them can be represented in a source program, and those 8 are specialised for writing code to push particular data structures to the stack). This program does not use the 6
command (which is the simplest way to create nested structures, but otherwise tends not to appear literally in a source program), so it's only the 7
commands that determine the structure; 7
pushes a new empty element to the top of stack (whereas the 0
…5
commands just append to the top of stack). We can thus add whitespace to the program to show its structure:
551040105042001444344515102013040042201205040054344 7
33403532411350143354503020522542410522530522442410523354522411140142413100523
40435303052335442302052335500302052335430302052313340435303135014243241310335
514052312241341351052302245341351525 7
55102440304030434030421030442030424030455 7
33413512410523142410523030523112411350143355142410523414252410523102410523002
41052341334241114525 7
551220304010420030455 7
41403
The elements near the end of the program are pushed last, so are on top of the stack at the start of the second iteration. On this iteration, and all future iterations, the 7 interpreter automatically makes a copy of the top of the stack and interprets it as a program. The literal 41403
pushes the (non-literal, live code) 47463
(7 has 12 commands but only 8 of them have names; as such, I use bold to show the code, and non-bold to show the literal that generates that code, meaning that, e.g. 4
is the command that appends 4
to the top stack element). So the program that runs on the second iteration is 47463
. Here's what that does:
47463
4 Swap top two stack elements, add an empty element in between
7 Add an empty stack element to the top of stack
4 Swap top two stack elements, add an empty element in between
6 Work out which commands would generate the top stack element;
append that to the element below (and pop the old top of stack)
3 Output the top stack element, pop the element below
This is easier to understand if we look at what happens to the stack:
- … d c b a
47463
(code to run:47463
) - … d c b
47463
empty a (code to run:7463
) - … d c b
47463
empty a empty (code to run:463
) - … d c b
47463
empty empty empty a (code to run:63
) - … d c b
47463
empty empty "a" (code to run:3
) - … d c b
47463
empty (code to run: empty)
In other words, we take the top of stack a, work out what code is most likely to have produced it, and output that code. The 7 interpreter automatically pops empty elements from the top of stack at the end of an iteration, so we end up with the 47463
back on top of the stack, just as in the original program. It should be easy to see what happens next: we end up churning through every stack element one after another, outputting them all, until the stack underflows and the program crashes. So we've basically created a simple output loop that looks at the program's source code to determine what to output (we're not outputting the data structures that were pushes to the stack by our 0
…5
commands, we're instead recreating what commands were used by looking at what structures were created, and outputting those). Thus, the first piece of data output is 551220304010420030455
(the source code that generates the second-from-top stack element), the second is 3341351…114525
(the source code that generates the third-from-top stack element), and so on.
Obviously, though, these pieces of source code aren't being output unencoded. 7 contains several different domain-specific languages for encoding output; once a domain-specific language is chosen, it remains in use until explicitly cleared, but if none of the languages have been chosen yet, the first digit of the code being output determines which of the languages to use. In this program, only two languages are used: 551
and 3
.
551
is pretty simple: it's basically the old Baudot/teletype code used to transmit letters over teletypes, as a 5-bit character set, but modified to make all the letters lowercase. So the first chunk of code to be output decodes like this:
551 22 03 04 01 04 20 03 04 55
c a SP e SP n a SP reset output format
As can be seen, we're fitting each character into two octal digits, which is a pretty decent compression ratio. Pairs of digits in the 0-5 range give us 36 possibilities, as opposed to the 32 possibilities that Baudot needs, so the remaining four are used for special commands; in this case, the 55
at the end clears the remembered output format, letting us use a different format for the next piece of output we produce.
3
is conceptually even simpler, but with a twist. The basic idea is to take groups of three digits (again, in the 0-5 range, as those are the digits for which we can guarantee that we can recreate the original source code from its output), interpret them as a three-digit number in base 6, and just output it as a byte in binary (thus letting us output the multibyte characters in the desired output simply by outputting multiple bytes). The twist, though, comes from the fact that there are only 216 three-digit numbers (with possible leading zeroes) in base 6, but 256 possible bytes. 7 gets round this by linking numbers from 332₆ = 128₁₀ upwards to two different bytes; 332
can output either byte 128 or 192, 333
either byte 129 or 193, and so on, up to 515
which outputs either byte 191 or 255.
How does the program know which of the two possibilities to output? It's possible to use triplets of digits from 520
upwards to control this explicitly, but in this program we don't have to: 7's default is to pick all the ambiguous bytes in such a way that the output is valid UTF-8! It turns out that there's always at most one way to do this, so as long as it's UTF-8 we want (and we do in this case), we can just leave it ambiguous and the program works anyway.
The end of each of the 3…
sections is 525
, which resets the output format, letting us go back to 551
for the next section.
answered 4 hours ago
community wiki
ais523
add a comment |
add a comment |
$begingroup$
Python 3, 397 bytes + 19 letters = 777 score
print(''.join(chr(i+32)for i in[67,65,0,69,0,78,65,0,299,65,0,86,65,0,79,0,83,65,27,-22,222,65,0,321,65,0,82,65,0,76,65,0,290,65,14,-22,77,65,0,65,0,80,65,0,70,65,0,71,65,0,84,65,0,237,65,27,-22,206,78,0,74,65,0,73,0,68,65,0,208,65,14,-22,65,82,0,263,79,0,202,78,0,212,78,0,194,78,0,85,263,79,27,-22,67,65,82,222,0,84,65,299,0,78,69,299,0,69,83,0,78,69,77,14,-22,69,76,79,0,67,69,78,86,79,83,14]))
Try it online!
Port of AdmBorkBork's answer.
$endgroup$
add a comment |
$begingroup$
Python 3, 397 bytes + 19 letters = 777 score
print(''.join(chr(i+32)for i in[67,65,0,69,0,78,65,0,299,65,0,86,65,0,79,0,83,65,27,-22,222,65,0,321,65,0,82,65,0,76,65,0,290,65,14,-22,77,65,0,65,0,80,65,0,70,65,0,71,65,0,84,65,0,237,65,27,-22,206,78,0,74,65,0,73,0,68,65,0,208,65,14,-22,65,82,0,263,79,0,202,78,0,212,78,0,194,78,0,85,263,79,27,-22,67,65,82,222,0,84,65,299,0,78,69,299,0,69,83,0,78,69,77,14,-22,69,76,79,0,67,69,78,86,79,83,14]))
Try it online!
Port of AdmBorkBork's answer.
$endgroup$
add a comment |
$begingroup$
Python 3, 397 bytes + 19 letters = 777 score
print(''.join(chr(i+32)for i in[67,65,0,69,0,78,65,0,299,65,0,86,65,0,79,0,83,65,27,-22,222,65,0,321,65,0,82,65,0,76,65,0,290,65,14,-22,77,65,0,65,0,80,65,0,70,65,0,71,65,0,84,65,0,237,65,27,-22,206,78,0,74,65,0,73,0,68,65,0,208,65,14,-22,65,82,0,263,79,0,202,78,0,212,78,0,194,78,0,85,263,79,27,-22,67,65,82,222,0,84,65,299,0,78,69,299,0,69,83,0,78,69,77,14,-22,69,76,79,0,67,69,78,86,79,83,14]))
Try it online!
Port of AdmBorkBork's answer.
$endgroup$
Python 3, 397 bytes + 19 letters = 777 score
print(''.join(chr(i+32)for i in[67,65,0,69,0,78,65,0,299,65,0,86,65,0,79,0,83,65,27,-22,222,65,0,321,65,0,82,65,0,76,65,0,290,65,14,-22,77,65,0,65,0,80,65,0,70,65,0,71,65,0,84,65,0,237,65,27,-22,206,78,0,74,65,0,73,0,68,65,0,208,65,14,-22,65,82,0,263,79,0,202,78,0,212,78,0,194,78,0,85,263,79,27,-22,67,65,82,222,0,84,65,299,0,78,69,299,0,69,83,0,78,69,77,14,-22,69,76,79,0,67,69,78,86,79,83,14]))
Try it online!
Port of AdmBorkBork's answer.
edited 10 hours ago
answered 10 hours ago
Artemis FowlArtemis Fowl
27111
27111
add a comment |
add a comment |
$begingroup$
Retina, 141 characters, 160 bytes, 15 letters = score 460
K`%# ' 1# !# 9# 2 6#;¶þ# š# 5# /# ł#.¶0# # 3# (# )# 7# č#;¶î1 ,# + &# ð#.¶#5 ħ2 ê1 ô1 â1 8ħ2;¶%#5þ 7#! 1'! '6 1'0.¶'/2 %'1926.
T`!--/-9`ŋ`-{
Try it online!
$endgroup$
add a comment |
$begingroup$
Retina, 141 characters, 160 bytes, 15 letters = score 460
K`%# ' 1# !# 9# 2 6#;¶þ# š# 5# /# ł#.¶0# # 3# (# )# 7# č#;¶î1 ,# + &# ð#.¶#5 ħ2 ê1 ô1 â1 8ħ2;¶%#5þ 7#! 1'! '6 1'0.¶'/2 %'1926.
T`!--/-9`ŋ`-{
Try it online!
$endgroup$
add a comment |
$begingroup$
Retina, 141 characters, 160 bytes, 15 letters = score 460
K`%# ' 1# !# 9# 2 6#;¶þ# š# 5# /# ł#.¶0# # 3# (# )# 7# č#;¶î1 ,# + &# ð#.¶#5 ħ2 ê1 ô1 â1 8ħ2;¶%#5þ 7#! 1'! '6 1'0.¶'/2 %'1926.
T`!--/-9`ŋ`-{
Try it online!
$endgroup$
Retina, 141 characters, 160 bytes, 15 letters = score 460
K`%# ' 1# !# 9# 2 6#;¶þ# š# 5# /# ł#.¶0# # 3# (# )# 7# č#;¶î1 ,# + &# ð#.¶#5 ħ2 ê1 ô1 â1 8ħ2;¶%#5þ 7#! 1'! '6 1'0.¶'/2 %'1926.
T`!--/-9`ŋ`-{
Try it online!
answered 8 hours ago
NeilNeil
82.9k745179
82.9k745179
add a comment |
add a comment |
If this is an answer to a challenge…
…Be sure to follow the challenge specification. However, please refrain from exploiting obvious loopholes. Answers abusing any of the standard loopholes are considered invalid. If you think a specification is unclear or underspecified, comment on the question instead.
…Try to optimize your score. For instance, answers to code-golf challenges should attempt to be as short as possible. You can always include a readable version of the code in addition to the competitive one.
Explanations of your answer make it more interesting to read and are very much encouraged.…Include a short header which indicates the language(s) of your code and its score, as defined by the challenge.
More generally…
…Please make sure to answer the question and provide sufficient detail.
…Avoid asking for help, clarification or responding to other answers (use comments instead).
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f183248%2foutput-the-%25c5%258bar%25c3%25a2%25c3%25be-cr%25c3%25ae%25c3%25be-alphabet-song-without-using-many-letters%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
5
$begingroup$
kolmogorov-complexity, restricted-source, and special scoring are all sorts of things that benefit greatly from careful consideration in the sandbox. Currently, it seems like the best approach to this challenge would be to just write out all of the codepoints in decimal then turn them into text with a builtin, with some shortcut to encode all of the
a
s--or not, depending on how many letters it would take, because 20 characters is a really big penalty (although when everything else is scored by bytes, it's not quite well defined...)!$endgroup$
– Unrelated String
10 hours ago
1
$begingroup$
And considering the invocation of Unicode, some explicit rules governing special codepages as used by most golflangs are probably called for (alongside maybe a link to a script to validate scoring).
$endgroup$
– Unrelated String
9 hours ago