Results 1 to 3 of 3

Thread: [Source] cFrogContest.cls [BETA]

  1. #1

    Thread Starter
    Addicted Member *PsyKE1*'s Avatar
    Join Date
    Jun 2010
    Location
    Spain
    Posts
    243

    Thumbs up [Source] cFrogContest.cls [BETA]

    Here is my class wich is a quick and easy way to do contest:



    An Example:
    vb Code:
    1. Option Explicit
    2.  
    3. Private C As New cFrogContest
    4.  
    5. Function VerySlow(a As Long, b As Long) As Double
    6.     VerySlow = 2
    7.     Dim x As Long
    8.     For x = 0 To 15
    9.         DoEvents
    10.     Next
    11. End Function
    12.  
    13. Function Slow(a As Long, b As Long) As Double
    14.     Slow = 2
    15.     Dim x As Long
    16.     For x = 0 To 10
    17.         DoEvents
    18.     Next
    19. End Function
    20.  
    21. Function Quick(a As Long, b As Long) As Long
    22.     Quick = 2
    23.     Dim x As Long
    24.     For x = 0 To 5
    25.         DoEvents
    26.     Next
    27. End Function
    28.  
    29. Function VeryQuick(a As Long, b As Long) As Long
    30.     VeryQuick = 3
    31. End Function
    32.  
    33. Private Sub Form_Load()
    34.     With C
    35.         .ContestName = "Test1"
    36.         .SaveDirectory = "c:\"
    37.         .Explanation = "It's only test"
    38.         .Arguments 20, 300
    39.         .Functions "VerySlow,VeryQuick,Slow,Quick"
    40.         .ReplaceFile = True
    41.         .Result = 2
    42.         .NumberOfLoops = 100
    43.         .TestIt
    44.         .ShowTest
    45.     End With
    46. End Sub
    47.  
    48. Private Sub Form_Click()
    49.     Unload Me
    50. End Sub
    51.  
    52. Private Sub Form_Unload(Cancel As Integer)
    53.     Set C = Nothing
    54. End Sub

    Returns:
    Code:
    ================================================================================
    º Contest Name : Test
    º Arguments    : 20, 300
    º Explanation  : -
    &#186; 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
    ================================================================================
    &#186; 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!

  2. #2
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    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.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  3. #3

    Thread Starter
    Addicted Member *PsyKE1*'s Avatar
    Join Date
    Jun 2010
    Location
    Spain
    Posts
    243

    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!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width