YAPC::EU 2018 Glasgow Update!
This commit is contained in:
parent
22f33d4004
commit
4e2d22a71d
1170 changed files with 15042 additions and 3047 deletions
32
Task/Amb/Ring/amb.ring
Normal file
32
Task/Amb/Ring/amb.ring
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
# Project : Amb
|
||||
|
||||
set1 = ["the","that","a"]
|
||||
set2 = ["frog","elephant","thing"]
|
||||
set3 = ["walked","treaded","grows"]
|
||||
set4 = ["slowly","quickly"]
|
||||
text = amb(set1,set2,set3,set4)
|
||||
if text != ""
|
||||
see "Correct sentence would be: " + nl + text + nl
|
||||
else
|
||||
see "Failed to fine a correct sentence."
|
||||
ok
|
||||
|
||||
func wordsok(string1, string2)
|
||||
if substr(string1,len(string1),1) = substr(string2,1,1)
|
||||
return true
|
||||
ok
|
||||
return false
|
||||
|
||||
func amb(a,b,c,d)
|
||||
for a2 = 1 to len(a)
|
||||
for b2 =1 to len(b)
|
||||
for c2 = 1 to len(c)
|
||||
for d2 = 1 to len(d)
|
||||
if wordsok(a[a2],b[b2]) and wordsok(b[b2],c[c2]) and wordsok(c[c2],d[d2])
|
||||
return a[a2]+" "+b[b2]+" "+c[c2]+" "+d[d2]
|
||||
ok
|
||||
next
|
||||
next
|
||||
next
|
||||
next
|
||||
return ""
|
||||
Loading…
Add table
Add a link
Reference in a new issue