Witam wszystkich forumowiczów. Mam taką sprawę. Kiedyś dawno temu miałem taki mały program w delphi ( około 500 bajtów ). Sam kod był ekstramalnie nieczytelny jednak po skompilowaniu generował angielski wierszyk ( który był dłuższy niż sam kod ). Czy ktoś pamięta takie coś ? Czy ma ktoś ten kod ?
0
0
Jest dużo programów generujących wierszyk "99 Bottles of Beer". Czy to ten wierszyk się generował?
1
Znalazłem po wielu latach :-)
program xmas;
{$APPTYPE CONSOLE}
function t_ (t, _ : Integer; a : PChar) : Integer;
begin
if 1<t then begin if t<3 then t_(-79,-13,a+t_(-87,1-_,t_(-86,0,a+1)+a)
); if t<_ then t_(t+1,_,a); if (t_(-94,-27+t,a)<>0) and (t=2) then if _<
13 then result:=t_(2,_+1,'%s %d %d'#13) else result:=9 else result:=16 end
else if t<0 then if t<-72 then result:=t_(_,t,'@n''+,#''/*{}w+/w#cdnr/+,'+
'{}r/*de}+,/*{*+,/w{%+,/w#q#n+,/#{l+,/n{n+,/+#n+,/#;#q#n+,/+k#;*+,/''r :'''+
'd*''3,}{w+K w''K:''+}e#'';dq#''l q#''+d''K#!/+k#;q#''r}eKK#}w''r}eKK{nl]'''+
'/#;#q#n''){)#}w''){){nl]''/+#n'';d}rw'' i;# ){nl]!/n{n#''; r{#w''r nc{nl]'+
'''/#{l,+''K {rw'' iK{;[{nl]''/w#q#n''wk nw'' iwk{KK{nl]!/w{%''l##w#'' i; '+
':{nl]''/*{q#''ld;r''}{nlwb!/*de}''c ;;{nl''-{}rw]''/+,}##''*}#nc,'',#nw]'''+
'/+kd''+e}+;#''rdq#w! nr''/ '') }+}{rl#''{n'' '')# }''+}##(!!/') else if t<
-50 then if _=Ord(a^) then begin result:=Ord(a[31]); if a[31]=#13 then WriteLn
else Write(a[31]); end else result:=t_(-65,_,a+1) else result:=t_(Ord(a^
='/')+t,_,a+1) else if 0<t then result:=t_(2,2,'%s') else result:=Ord((a^=
'/') or (t_(0,t_(-61,Ord(a^),'!ek;dc i@bK''(q)-[w]*%n+r3#l,{}:'#13'uwloc'+
'a-O;m .vpbks,fxntdCeghiry'),a+1)<>0))
end;
begin
t_ (1, 10000, '')
end.
Wynik programu:
1
Teraz wygląda chyba lepiej i zdecydowanie jaśniej:
function t_(t, _: Integer; a: PChar): Integer;
begin
if 1 < t then
begin
if t < 3 then
t_(-79, -13, a + t_(-87, 1 - _, t_(-86, 0, a + 1) + a));
if t < _ then
t_(t + 1, _, a);
if (t_(-94, -27 + t, a) <> 0) and (t = 2) then
if _ < 13 then
result := t_(2, _ + 1, '%s %d %d'#13)
else
result := 9
else
result := 16
end
else if t < 0 then
if t < -72 then
result := t_(_, t, '@n''+,#''/*{}w+/w#cdnr/+,' + '{}r/*de}+,/*{*+,/w{%+,/w#q#n+,/#{l+,/n{n+,/+#n+,/#;#q#n+,/+k#;*+,/''r :''' +
'd*''3,}{w+K w''K:''+}e#'';dq#''l q#''+d''K#!/+k#;q#''r}eKK#}w''r}eKK{nl]''' +
'/#;#q#n''){)#}w''){){nl]''/+#n'';d}rw'' i;# ){nl]!/n{n#''; r{#w''r nc{nl]' +
'''/#{l,+''K {rw'' iK{;[{nl]''/w#q#n''wk nw'' iwk{KK{nl]!/w{%''l##w#'' i; ' +
':{nl]''/*{q#''ld;r''}{nlwb!/*de}''c ;;{nl''-{}rw]''/+,}##''*}#nc,'',#nw]''' + '/+kd''+e}+;#''rdq#w! nr''/ '') }+}{rl#''{n'' '')# }''+}##(!!/')
else if t < -50 then
if _ = Ord(a^) then
begin
result := Ord(a[31]);
if a[31] = #13 then
WriteLn
else
Write(a[31]);
end
else
result := t_(-65, _, a + 1)
else
result := t_(Ord(a^ = '/') + t, _, a + 1)
else if 0 < t then
result := t_(2, 2, '%s')
else
result := Ord((a^ = '/') or (t_(0, t_(-61, Ord(a^), '!ek;dc i@bK''(q)-[w]*%n+r3#l,{}:'#13'uwloc' + 'a-O;m .vpbks,fxntdCeghiry'), a + 1) <> 0))
end;
begin
t_(1, 10000, '')
end.
0
robertz68 napisał(a):
Teraz wygląda chyba lepiej i zdecydowanie jaśniej:
Nie no, spoko teraz na pierwszy rzut oka widać, że będzie wierszyk :-)
Pamiętam, że jak to zobaczyłem pierwszy raz ( około 2000 roku ) to chciałem przepisać do PHP i poległem ...