Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
35
Task/Amb/Yabasic/amb.basic
Normal file
35
Task/Amb/Yabasic/amb.basic
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
sub wordsOK(string1$, string2$)
|
||||
return right$(string1$, 1) == left$(string2$, 1)
|
||||
End sub
|
||||
|
||||
sub Amb$(A$(), B$(), C$(), D$())
|
||||
local a2, b2, c2, d2
|
||||
|
||||
For a2 = 1 To arraysize(A$(), 1)
|
||||
For b2 = 1 To arraysize(B$(), 1)
|
||||
For c2 = 1 To arraysize(C$(), 1)
|
||||
For d2 = 1 To arraysize(D$(), 1)
|
||||
If wordsOK(A$(a2), B$(b2)) And wordsOK(B$(b2), C$(c2)) And wordsOK(C$(c2), D$(d2)) Then
|
||||
Return A$(a2) + " " + B$(b2) + " " + C$(c2) + " " + D$(d2)
|
||||
End If
|
||||
Next
|
||||
Next
|
||||
Next
|
||||
Next
|
||||
Return ""
|
||||
End sub
|
||||
|
||||
Dim set1$(1), set2$(1), set3$(1), set4$(1)
|
||||
|
||||
void = token("the that a", set1$())
|
||||
void = token("frog elephant thing", set2$())
|
||||
void = token("walked treaded grows", set3$())
|
||||
void = token("slowly quickly", set4$())
|
||||
|
||||
result$ = Amb$(set1$(), set2$(), set3$(), set4$())
|
||||
|
||||
If result$ <> "" Then
|
||||
Print "Correct sentence would be: ", result$
|
||||
Else
|
||||
Print "Failed to fine a correct sentence."
|
||||
End If
|
||||
Loading…
Add table
Add a link
Reference in a new issue