Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
44
Task/Amb/PureBasic/amb.basic
Normal file
44
Task/Amb/PureBasic/amb.basic
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
Procedure Words_Ok(String1.s, String2.s)
|
||||
If Mid(String1,Len(String1),1)=Mid(String2,1,1)
|
||||
ProcedureReturn #True
|
||||
EndIf
|
||||
ProcedureReturn #False
|
||||
EndProcedure
|
||||
|
||||
Procedure.s Amb(Array A.s(1), Array B.s(1), Array C.s(1), Array D.s(1))
|
||||
Protected a, b, c, d
|
||||
For a=0 To ArraySize(A())
|
||||
For b=0 To ArraySize(B())
|
||||
For c=0 To ArraySize(C())
|
||||
For d=0 To ArraySize(D())
|
||||
If Words_Ok(A(a),B(b)) And Words_Ok(B(b),C(c)) And Words_Ok(C(c),D(d))
|
||||
ProcedureReturn A(a)+" "+B(b)+" "+C(c)+" "+D(d)
|
||||
EndIf
|
||||
Next
|
||||
Next
|
||||
Next
|
||||
Next
|
||||
ProcedureReturn "" ; Empty string, e.g. fail
|
||||
EndProcedure
|
||||
|
||||
If OpenConsole()
|
||||
Define Text.s
|
||||
Dim Set1.s(2)
|
||||
Dim Set2.s(2)
|
||||
Dim Set3.s(2)
|
||||
Dim Set4.s(1)
|
||||
|
||||
Set1(0)="the": set1(1)="that": set1(2)="a"
|
||||
Set2(0)="frog": set2(1)="elephant": set2(2)="thing"
|
||||
Set3(0)="walked": set3(1)="treaded": set3(2)="grows"
|
||||
Set4(0)="slowly": set4(1)="quickly"
|
||||
|
||||
text=Amb(set1(),set2(),Set3(),set4())
|
||||
If Text<>""
|
||||
PrintN("Correct sentence would be,"+#CRLF$+Text)
|
||||
Else
|
||||
PrintN("Failed to fine a correct sentence.")
|
||||
EndIf
|
||||
PrintN(#CRLF$+#CRLF$+"Press ENTER to exit."): Input()
|
||||
CloseConsole()
|
||||
EndIf
|
||||
Loading…
Add table
Add a link
Reference in a new issue