Escolha o seu famoso cientista da computação favorito ou pioneiro da ciência da computação que nasceu em 1942 ou anterior (como 1943 marca o início da criação do 'primeiro' computador ). Eles devem ter uma página da Wikipedia ou outro site que liste seu ano de nascimento e diga como suas realizações se relacionam à ciência da computação. Você pode escolher o mesmo que outra pessoa, mas a escolha de alguém novo é incentivada.
Pegue um nome pelo qual eles são comumente conhecidos. Esse provavelmente será o nome e o sobrenome, mas pode incluir abreviações ou nomes do meio, se isso for mais comum. Por exemplo, para Tony Hoare ambos Tony Hoare
e C. A. R. Hoare
seria aceitável.
Todos os caracteres no nome devem ser ASCII imprimíveis . Se o nome contiver caracteres que não são ASCII imprimíveis, tudo bem se você escolher algo aproximado. por exemplo, em Kurt Godel
vez deKurt Gödel
.
Pegue o conjunto de caracteres únicos no nome (por exemplo C. ARHoare
) e mude-os para a escala ASCII imprimível até o ano de nascimento do seu cientista, passando ~
do espaço para o espaço. (Basicamente, adicione o módulo 95 do ano de nascimento.) Isso fornecerá a você (provavelmente) um novo conjunto de caracteres ASCII imprimíveis.
Por exemplo, o CAR Hoare nasceu em 1934, mudando todo personagem em C. ARHoare
1934 (34 mod 95) ePBctj2$5(
.
Este snippet de pilha fará toda a mudança para você:
function go() {var name = document.getElementById("name").value;var year = parseInt(document.getElementById("year").value);var unique = {};for (var i = 0; i < name.length; i++) { unique[name.charAt(i)] = true; } var result = ''; for (var char in unique) { result += String.fromCharCode((char.charCodeAt(0) - 32 + year) % 95 + 32); } document.getElementById("result").value = result; }
Name: <input type="text" id="name" value="C. A. R. Hoare"><br>
Birth Year: <input type="text" id="year" value="1934"><br>
<button type="button" onclick="go()">Ok</button><br>
Result: <input type="text" id="result" readonly>
Desafio
Usando este conjunto e apenas este conjunto (sem tabulações, sem novas linhas) de caracteres ASCII imprimíveis deslocados, escreva um programa que imprima Hello, [name]!
para stdout ou alternativa mais próxima, onde [name]
é o mesmo nome exato que você escolheu acima e deslocou para obter os caracteres do programa. Você pode usar vários caracteres do conjunto ou não usar alguns. Por exemplo, o programa teórico PetBee($25
imprimeHello, C. A. R. Hoare!
.
Pontuação
Sua pontuação é o tamanho do seu código em bytes vezes o número de caracteres únicos no nome que você escolher. A menor dor ganha.
fonte
Rear Admiral Grace Murray Hopper, United States Navy, (Retired), Doctor of Philosophy
. Nascido em 1906. Tudo bem?Rear Admiral Grace Murray Hopper
. Lembre-se de que o tamanho do seu código é multiplicado pelo número de caracteres únicos no nome, portanto, um nome mais longo não é necessariamente melhor.Respostas:
Insônia,
1039998 * 8 = 784George Boole , 1815
Todos os 5 programas abaixo têm o mesmo comprimento (98) e a mesma saída.
Impressões
Hello, George Boole!
Insônia, 103 * 6 = 618 (provavelmente ideal e único)
Se
G Boole
( George Boole , 1815) for aceitável ...Impressões
Hello, G Boole!
Insônia,
9492898583 * 10 = 830Kurt Godel, 1906.
Impressões
Hello, Kurt Godel!
Eu escrevi um programa para procurar a solução. Minha segunda versão do programa deve estar mais próxima do ideal do que minha primeira versão.
Conforme o nitpick de @Martin Büttner (
100928885 caracteres, mesmo conjunto de caracteres):Impressões
Hello, Kurt Goedel!
Intérprete
fonte
Gödel
using only the Latin alphabet isGoedel
. ;)CJam,
230117115114113110107106 bytes * 13 = 1378Test it here.
I chose
Edsger Dijkstra
, born 1930, which gives mec#2&$1>b()* 3
(whom I really just chose because he was the first one I found whose name yielded useful characters for CJam; I've checked a dozen names since and none looked as promising).The code basically just builds the ASCII codes using
1
,2
,3
,*
,#
(exponentiation) and(
,)
(decrement, increment) and converts them to a character withc
. To save some characters I can sometimes copy an earlier character with$
(0$
copies the top stack element,1$
copies the second-to-top stack element and so on).Here is the breakdown of the code into characters (this is also runnable):
fonte
Marbelous, 83 bytes * 10 = 830
I've chosen
R Kowalski, 1941
which allows me to use:{It9A+6=53
This one is a bit more complex than the old answer (below) since many marbles go through multiple devices, all in all most marble just have a few things added to them before being printed though. Because I didn't have subtraction or low numerals, the lower ascii codes had to be formed by adding by merging two high value marbles, since this results in addition modulo. (I've used
=3
as a deflector since it pushes every marble not equal to 3 to the right and looks like a cute cat)output:
Hello, R Kowalski!
old answer:
Marbelous, 113 * 17 = 1921
Marbelous does okay here, since ever marble that falls off the board gets printed, because of its 2D nature though, it needs a few numerals + some arithmetic to not let the borad get too huge.
I've chosen
Philip D. Estridge, 1937
who yieldsu./26EiSj9:8*-+
as the available character set. The characters actually used are.+-245689E
The board is pretty simple, the first 3 rows are literals, ever group of two is a hexadecimal value, the fourth row are arithmetic operations to form the ascii codes that could not be written explicitly because of the limited character sets.
output:
Hello, Philip Donald Estridge!
You can try it out here!
I'll now look for a possible better candidate, since it looks like marbelous might actually be competitive here.
fonte
G Boole
with 105 characters * 6 - I think there should be a limit on how much the name can be shortened.Using this set and only this set (no tabs, no newlines) of shifted printable ASCII characters
Brainfuck,1846*12 = 22152
Just to have a language other than CJam. Requires original spec Brainfuck with byte datatype, that overflows at 256.
Only uses 2 characters:
+
to increment the current cell, and.
to output the current cell.Output
Credit goes to Coredump for revealing the following in his answer:
fonte
"Hello, Niklaus Emil Wirth!" (Befunge-98, 222×14=3108)
From Wikipedia:
With a shift of 34,
Niklaus Emil Wirth
(18 characters, 14 unique) ends up asp,./$86Bg0,/By,57+
.Code (try it out here):
Breakdown:
The last line places a HALT character (
@
) at the beginning of the line. When the control wraps around back to this point, the program will stop. This shouldn't actually be necessary, because the@
character at (5,0) is still there and nothing should be output before it is reached. However, the only online Befunge interpreter that will run this monstrosity won't work properly without it.It is actually possible to make a working solution with just
Niklaus Wirth
(12 unique chars,p,./$86By,57+
), but the code is much, much longer.(Tagged as Befunge-98 because Befunge-93 is limited to a width of 80 characters.)
fonte
CJam, 323 bytes * 10 = 3230
Output:
CJam, 662 bytes * 10 = 6620
8700Not to win but just because it looks possible. It used only
2e(c
.Output:
Generator
The trivial answer
222(((((((((((c
(generated byq{i222_@-'(*'c}%
) has 3420 bytes.fonte
e_
outside number literals.2
? Or by using the other (useful) charactersB
,5
and$
? (E.g. you can get second to fourth space and the second and third period with2$
, as well as theA
with2$((
.)CJam, 16 *
307288 =49124608Displays:
This is my first answer using CJam, so surely this can better golfed (any hint is welcome).
Here is some utility code I used. Since I computed the character set for some other names, this may be useful for someone who better knows CJam (or maybe for another language).
fonte
Brainf_ck - 723 * 12 = 8676
I did a crawl from Wikipedia's List of computer scientists and collected the birthyears and longest names of all the people listed there. I wrote a program to run over all these and find any I could possibly do in a common language. Sadly, I was unable to find any names that could support
echo;
,alert()
,console.log()
(I can hope),print
, ormain
.I mainly wanted to share my raw crawl data in case anyone wanted to similarly search for other languages (note: may be inaccurate and incomplete): Crawl Data.
EDIT: New crawl paste with about 40 new names from List of computing people and List of pioneers in computer science.
EDIT: Manually cleaned up the list.
I did find that Jean David Ichbiah (1940), chief designer of Ada, provides
+-.
(the shortest of three people to do so). I generated this BF code for him.Alexander Keewatin Dewdney provided the most usable BF characters (
+.<>
), but came in slightly above my answer. No one I found provided.[]
.fonte
Ruby 1.8 - 250 × 18 = 4500
Characters available:
Output:
Anatolii Karatsuba, born 1937, is most well known for his contributions to the field of analytic number theory (a field I personally enjoy), including the Karatsuba Algorithm, a method for fast multiplication of arbitrary precision operands.
This is the first and only name I tried.
fonte
GolfScript (125 * 14 = 1750)
Online demo
Douglas Engelbart (1925 - 2013) is perhaps most famous for the "Mother of All Demos". His name and year of birth give characters
!&(),-./9]^z{~
, of which this solution uses&()-./9]^~
The basic structure of the code is
build list of numbers](-
which puts a lot of numbers in an array with the empty string that starts on the stack, then pulls out that string and uses it with the type promotion of-
to turn the array of numbers into a string.Since there's no access to elements below the top of the stack I wrote a C# program to find short snippets that take a given integer on the top of the stack and add the next integer required. This created one small problem, when the snippet for
69
(E
) ended with-
and the snippet for110
(n
) started with9
: it cost one char to use a longer snippet for110
.fonte
CaneCode,
458410 * 16 =73286560Corresponding BF:
Outputs:
CaneCode is just a direct symbol substitution of Brainfuck, where
12348
correspond to+-><.
respectively. I spent about 2 hours trying to look for a short name which gave+-.
for normal Brainfuck, with no success.Jack Elton Bresenham, inventor of Bresenham's line algorithm and born 1937, gives the following characters:
Unfortunately, while
5
([
) is available, the lack of6
(]
) means that the code still had to increment up the 100-ish area (for lowercase chars) the slow way.fonte
><> (Fish), 163 * 15 = 2445
Outputs:
Ivar Hjalmar Jacobson, born 1939, was found thanks to BMac's crawl data. He provides the chars
><>, like Befunge, is a 2D stack-based language. The useful ><> commands are:
*+24567
for arithmetic (note that47
pushes a4
and a7
on the stack, not47
))
for greater than (useful for getting1
):
for duplicating the top of the stacko
for output;
for program terminationp
is also good for reflection, but I was unable to think of a good use for it.>
is another ><> command, directing program flow rightwards, but since the program already executes in that direction it was not needed.fonte