Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
|
|
@ -0,0 +1,17 @@
|
|||
import zlib, base64
|
||||
|
||||
const b64 = """
|
||||
eNrtVE1rwzAMvedXaKdeRn7ENrb21rHCzmrs1m49K9gOJv9+cko/HBcGg0LHcpOfnq2np0QL
|
||||
2FuKgBbICDAoeoiKwEc0hqIUgLAxfV0tQJCdhQM7qh68kheswKeBt5ROYetTemYMCC3rii//
|
||||
WMS3WkhXVyuFAaLT261JuBWwu4iDbvYp1tYzHVS68VEIObwFgaDB0KizuFs38aSdqKv3TgcJ
|
||||
uPYdn2B1opwIpeKE53qPftxRd88Y6uoVbdPzWxznrQ3ZUi3DudQ/bcELbevqM32iCIrj3IIh
|
||||
W6plOJf6L6xaajZjzqW/qAsKIvITBGs9Nm3glboZzkVP5l6Y+0bHLnedD0CttIyrpEU5Kv7N
|
||||
Mz3XkPBc/TSN3yxGiqMiipHRekycK0ZwMhM8jerGC9zuZaoTho3kMKSfJjLaF8v8wLzmXMqM
|
||||
zJvGew/jnZPzclA08yAkikegDTTUMfzwDXBcwoE="""
|
||||
|
||||
proc uncompress*(source: string, destLen: var int): string =
|
||||
result = newString(destLen)
|
||||
discard uncompress(result.cstring, addr destLen, source.cstring, source.len)
|
||||
|
||||
var length = 10_000
|
||||
echo b64.decode.uncompress length
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
sequence lines = {"Perhaps she'll die!\n"}, animals = {}
|
||||
|
||||
procedure swallow(string animal, second_line, integer permanent_second_line=TRUE)
|
||||
printf(1,"There was an old lady who swallowed a %s,\n%s\n",{animal,second_line})
|
||||
if length(animals)!=0 then
|
||||
lines = prepend(lines,sprintf("She swallowed the %s to catch the %s,\n",{animal,animals[$]}))
|
||||
end if
|
||||
printf(1,"%s\n",{join(lines,"")})
|
||||
if permanent_second_line then
|
||||
lines = prepend(lines,second_line&"\n")
|
||||
end if
|
||||
animals = append(animals,animal)
|
||||
end procedure
|
||||
|
||||
procedure swallow_all(sequence all)
|
||||
for i=1 to length(all) do
|
||||
string {animal,line2} = all[i]
|
||||
swallow(animal, sprintf("%s, %s a %s;",{line2,iff(animal="cow"?"she swallowed":"to swallow"),animal}), FALSE);
|
||||
end for
|
||||
end procedure
|
||||
|
||||
swallow("fly", "But I don't know why she swallowed the fly,");
|
||||
swallow("spider", "That wriggled and jiggled and tickled inside her;");
|
||||
swallow_all({{"bird", "Quite absurd"},{"cat", "Fancy that"},{"dog", "What a hog"},
|
||||
{"pig", "Her mouth was so big"},{"goat","She just opened her throat"},
|
||||
{"cow", "I don't know how"},{"donkey", "It was rather wonky"}})
|
||||
printf(1, "There was an old lady who swallowed a horse ...\nShe's dead, of course!")
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
var victims = [
|
||||
:fly: " I don't know why S—",
|
||||
:spider: " That wriggled and jiggled and tickled inside her.",
|
||||
:bird: " How absurd, T!",
|
||||
:cat: " Fancy that, S!",
|
||||
:dog: " What a hog, T!",
|
||||
:goat: " She just opened her throat, and in walked the goat!",
|
||||
:cow: " I don't know how S!",
|
||||
:horse: " She's dead, of course...",
|
||||
];
|
||||
|
||||
var history = ["I guess she'll die...\n"];
|
||||
|
||||
victims.each { |pair|
|
||||
var (victim, verse) = pair...;
|
||||
say "There was an old lady who swallowed a #{victim}...";
|
||||
|
||||
verse.sub!(/\bS\b/, "she swallowed the #{victim}");
|
||||
verse.sub!(/\bT\b/, "to swallow a #{victim}!");
|
||||
|
||||
say verse;
|
||||
verse ~~ /dead/ && break;
|
||||
|
||||
history[0].sub!(/^X/, "She swallowed the #{victim}");
|
||||
history.each{.say};
|
||||
history.len < 5 && history.unshift(verse);
|
||||
history.unshift("X to catch the #{victim},");
|
||||
};
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
decl string<> reason creatures comments
|
||||
append "She swallowed the " " to catch the " reason
|
||||
append "fly" "spider" "bird" "cat" "dog" "goat" "cow" "horse" creatures
|
||||
append "I don't know why she swallowed that fly.\nPerhaps she'll die\n" comments
|
||||
append "That wiggled and jiggled and tickled inside her" comments
|
||||
append "How absurd, to swallow a bird" comments
|
||||
append "Imagine that. She swallowed a cat" comments
|
||||
append "What a hog to swallow a dog" comments
|
||||
append "She just opened her throat and swallowed that goat" comments
|
||||
append "I don't know how she swallowed that cow" comments
|
||||
append "She's dead of course" comments
|
||||
|
||||
decl int max
|
||||
set max (size creatures)
|
||||
for (decl int i) (< i max) (inc i)
|
||||
out "There was an old lady who swallowed a " creatures<i> endl console
|
||||
out comments<i> endl console
|
||||
decl int j
|
||||
for (set j i) (and (> j 0) (< i (- max 1))) (dec j)
|
||||
out reason<0> creatures<j> reason<1> creatures<(int (- j 1))> endl console
|
||||
if (= j 1)
|
||||
out comments<(int (- j 1))> endl console
|
||||
end if
|
||||
end for
|
||||
end for
|
||||
in string console
|
||||
Loading…
Add table
Add a link
Reference in a new issue