Add tasks for all the new languages

This commit is contained in:
Tina Müller 2016-12-05 23:44:36 +01:00
parent 9dc3c2bb62
commit bba7bfd280
13208 changed files with 134745 additions and 0 deletions

37
Task/Menu/Ursa/menu.ursa Normal file
View file

@ -0,0 +1,37 @@
def _menu (string<> items)
for (decl int i) (< i (size items)) (inc i)
out " " i ") " items<i> endl console
end for
end _menu
def _ok (string reply, int itemcount)
try
decl int n
set n (int reply)
return (and (or (> n 0) (= n 0)) (< n itemcount))
catch
return false
end try
end _ok
def selector (string<> items, string prompt)
# Prompt to select an item from the items
if (= (size items) 0)
return ""
end if
decl int itemcount reply
set reply -1
set itemcount (size items)
while (not (_ok reply itemcount))
_menu items
out prompt console
set reply (in int console)
end while
return items<(int reply)>
end selector
decl string<> items
append "fee fie" "huff and puff" "mirror mirror" "tick tock" items
decl string item
set item (selector items "Which is from the three pigs: ")
out "You chose: " item endl console