[Source] cFrogContest.cls [BETA]
Here is my class wich is a quick and easy way to do contest:
http://t2.gstatic.com/images?q=tbn:A...mEcV0xtR_E&t=1
An Example:
vb Code:
Option Explicit
Private C As New cFrogContest
Function VerySlow(a As Long, b As Long) As Double
VerySlow = 2
Dim x As Long
For x = 0 To 15
DoEvents
Next
End Function
Function Slow(a As Long, b As Long) As Double
Slow = 2
Dim x As Long
For x = 0 To 10
DoEvents
Next
End Function
Function Quick(a As Long, b As Long) As Long
Quick = 2
Dim x As Long
For x = 0 To 5
DoEvents
Next
End Function
Function VeryQuick(a As Long, b As Long) As Long
VeryQuick = 3
End Function
Private Sub Form_Load()
With C
.ContestName = "Test1"
.SaveDirectory = "c:\"
.Explanation = "It's only test"
.Arguments 20, 300
.Functions "VerySlow,VeryQuick,Slow,Quick"
.ReplaceFile = True
.Result = 2
.NumberOfLoops = 100
.TestIt
.ShowTest
End With
End Sub
Private Sub Form_Click()
Unload Me
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set C = Nothing
End Sub
Returns:
Code:
================================================================================
º Contest Name : Test
º Arguments : 20, 300
º Explanation : -
º Date : 02-06-2011 <-> 16:58:44
================================================================================
Results [not compiled] :
--------------------------------------------------------------------------------
1.- VeryQuick ------> 0,6934159 msec
2.- Quick ------> 2,6165497 msec
3.- Slow ------> 7,1359347 msec
4.- VerySlow ------> 7,9149945 msec
================================================================================
º The following functions return incorrect results :
--------------------------------------------------------------------------------
1.- VeryQuick
================================================================================
>>> Test made by cFrogContest.cls <-> Visit foro.elhacker.net <<<
================================================================================
I hope you like it, and i would appreciate coment to improve it, or any tip to learn something for the next time.
Specially my way to compare if it returns correct results
See you! :D
Re: [Source] cFrogContest.cls [BETA]
Ummm, what is this, what does it do? More description would be helpful to include why "we would want to use it?" Also, downloading just a class isn't enough information. What is "TLI.TLIApplication"?
And without knowing what this does, I see you use a BubbleSort. If the goal is speed; you probably want to use a faster sorting algorithm unless you expect your arrays to always be relatively small.
Re: [Source] cFrogContest.cls [BETA]
Hi LaVolpe, I answer you:
Is a class to measure the speed of various functions.
For example, imagine that there is a competition to do as quickly as possible a function to calculate prime numbers. We would use this class to measure time and know who is faster, in a comfortable and easy way.
In addition, it shows the erroneous calls and functions that do not return correct results.
(Here is my main question, what is the best way to compare if 2 varibales are the same? Look my function "IsWrongResult")
I use BubbleSort because I have to sort arrays of 10 elements at most. So the difference is not significant.
About TLI.TLIApplication:
I use this objecto to replace CallByName function, you can see an example here:
http://www.devx.com/tips/Tip/15422
I hope I explained well friend! :P
Thanks! ;)