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
29
Task/Semordnilap/Lasso/semordnilap.lasso
Normal file
29
Task/Semordnilap/Lasso/semordnilap.lasso
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
local(
|
||||
words = string(include_url('http://www.puzzlers.org/pub/wordlists/unixdict.txt')) -> split('\n'),
|
||||
semordnilaps = array,
|
||||
found_size,
|
||||
example,
|
||||
haveexamples = false,
|
||||
examples = array
|
||||
)
|
||||
|
||||
#words -> removeall('')
|
||||
|
||||
with word in #words do {
|
||||
local(reversed = string(#word) -> reverse&)
|
||||
if(not(#word == #reversed) and not(#semordnilaps >> #word) and not(#semordnilaps >> #reversed) and #words >> #reversed) => {
|
||||
#semordnilaps -> insert(#word = #reversed)
|
||||
}
|
||||
}
|
||||
|
||||
#found_size = #semordnilaps -> size
|
||||
|
||||
while(not(#haveexamples)) => {
|
||||
#example = #semordnilaps -> get(integer_random(#found_size, 1))
|
||||
not(#examples >> #example -> name) ? #examples -> insert(#example)
|
||||
#examples -> size >= 5 ? #haveexamples = true
|
||||
}
|
||||
'Total found: '
|
||||
#found_size
|
||||
'<br />'
|
||||
#examples
|
||||
Loading…
Add table
Add a link
Reference in a new issue