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

View file

@ -0,0 +1,58 @@
' version 21-10-2016
' compile with: fbc -s console
' compile with: fbc -s console -exx (for bondry check on the array's)
' not very well suited for large numbers and large array's
' positive numbers only
Sub sandman(sleepy() As ULong)
Dim As Long lb = LBound(sleepy)
Dim As Long ub = UBound(sleepy)
Dim As Long i, count = ub
Dim As Double wakeup(lb To ub)
Dim As Double t = Timer
For i = lb To ub
wakeup(i) = sleepy(i) +1 + t
Next
Do
t = Timer
For i = lb To ub
If wakeup(i) <= t Then
Print Using "####";sleepy(i);
wakeup(i) = 1e9 ' mark it as used
count = count -1
End If
Next
Sleep (1 - (Timer - t)) * 300, 1 ' reduce CPU load
Loop Until count < lb
End Sub
' ------=< MAIN >=------
Dim As ULong i, arr(10)
Dim As ULong lb = LBound(arr)
Dim As ULong ub = UBound(arr)
Randomize Timer
For i = lb To ub -1 ' leave last one zero
arr(i) = Int(Rnd * 10) +1
Next
Print "unsorted ";
For i = lb To ub
Print Using "####";arr(i);
Next
Print : Print
Print " sorted ";
sandman(arr())
Print : Print
' empty keyboard buffer
While InKey <> "" : Wend
Print : Print "hit any key to end program"
Sleep
End