Number Sort Algorithm


Results 1 to 40 of 55

Threaded View

  1. #7
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Thumbs up

    Cool.

    And I suppose if someone wanted to test the "Surprise", they might do something like this ...

    Code:
    ;Initialize your hardware first
    
    A      VAR WORD
    B      VAR WORD
    TempA  VAR WORD
    TempB  VAR WORD
    
    LCDOUT $FE,1
    
    For A = 0 to 65535
        LCDOUT $FE,2,"A=",DEC A
        For B = 0 to 65535
            TempA = A
            TempB = B
            TempA = TempA ^ TempB
            TempB = TempA ^ TempB
            TempA = TempA ^ TempB
            IF (TempA <> B) OR (TempB <> A) THEN ; Test Failed
                LCDOUT $FE,1,"Test Failed",$FE,$C0,"A=",DEC A,", B =",DEC B
                STOP
            ENDIF
        Next B
    Next A
    
    LCDOUT $FE,1,"Test Passed!"
    STOP
    Then some 40 hours later (@ 20Mhz) [that's over 4 billion combinations],
    you would no doubt see the message "Test Passed!" on the LCD.

    Only a half hour into it, but it's still passing. Kinda obvious what the result will be.

    Update: 43hrs, Test Passed! (obviously)
    <br>
    Last edited by Darrel Taylor; - 27th July 2007 at 08:26. Reason: Final result
    DT

Similar Threads

  1. Dynamic USB Serial Number (PIC18F4550)
    By awmt102 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 16th July 2009, 18:03
  2. Working with the random number generator
    By kwelna in forum mel PIC BASIC
    Replies: 9
    Last Post: - 16th January 2007, 18:50
  3. Random number results
    By bartman in forum mel PIC BASIC
    Replies: 3
    Last Post: - 9th March 2005, 18:39
  4. more random number questions
    By bartman in forum mel PIC BASIC
    Replies: 1
    Last Post: - 14th November 2004, 18:55
  5. Split number into variables
    By psmeets in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 7th January 2004, 05:15

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

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