[AccessD] OT: Friday Puzzles

Gustav Brock Gustav at cactus.dk
Fri Apr 23 10:38:29 CDT 2010


Hi Drew

What is this? You always bark about how busy you are. 
Can't wait for Friday beer!?

/gustav


>>> DWUTKA at marlow.com 23-04-2010 17:26:38 >>>
LOL, nah, I'll stick with 'code boy'

Private Sub Command1_Click()
Dim Victims As Collection
Dim vt As Victim
Dim i As Long
Dim strTemp As String
Dim strPaste As String
Set Victims = New Collection
For i = 1 To 1000
    Set vt = New Victim
    vt.OriginalPosition = i
    Victims.Add vt, "ID:" & i
    Set vt = Nothing
Next i
Do Until Victims.Count <= 1
    For i = 1 To Victims.Count Step 2
        Set vt = Victims(i)
        vt.Shot = True
        Set vt = Nothing
    Next i
    'Remove shot victims
    strTemp = ""
    For Each vt In Victims
        If vt.Shot Then
            Victims.Remove "ID:" & vt.OriginalPosition
        Else
            strTemp = strTemp & vt.OriginalPosition & ","
        End If
    Next
    Me.List1.AddItem Left(strTemp, Len(strTemp) - 1)
    strPaste = strPaste & Left(strTemp, Len(strTemp) - 1) & vbCrLf
Loop
Clipboard.Clear
Clipboard.SetText strPaste
End Sub

Drew





More information about the AccessD mailing list