home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.Form frmPrime
- AutoRedraw = -1 'True
- BackColor = &H00000000&
- BorderStyle = 0 'None
- Caption = "Form1"
- ClientHeight = 4935
- ClientLeft = 0
- ClientTop = 0
- ClientWidth = 7335
- DrawWidth = 30
- BeginProperty Font
- Name = "Times New Roman"
- Size = 15.75
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- MouseIcon = "PRIMER.frx":0000
- MousePointer = 99 'Custom
- ScaleHeight = 329
- ScaleMode = 3 'Pixel
- ScaleWidth = 489
- ShowInTaskbar = 0 'False
- StartUpPosition = 2 'CenterScreen
- WindowState = 2 'Maximized
- Attribute VB_Name = "frmPrime"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Option Explicit
- Dim Primes As New Collection
- Private Sub Form_Load()
- Dim i&, s$
- Show
- MIDN
- ForeColor = Int(Rnd * 255 * 255 * 255)
- s$ = "Prime Maker 1.0. Press mouse button to exit."
- PrintText s$
- For i& = 1 To 50000
- DoEvents
- Next i&
- Prime (10000000)
- End Sub
- Sub PrintText(Text As String, Optional X As Long, Optional Y As Long)
- If X = 0 Then X = ScaleWidth / 2 - TextWidth(Text) / 2
- If Y = 0 Then Y = ScaleHeight / 2 - TextHeight(Text) / 2
- CurrentX = X
- CurrentY = Y
- Print Text
- End Sub
- Private Sub Prime(i#)
- Dim X#, Y#, Prime As Boolean
- Dim XCng As Integer, YCng As Integer
- Dim XMov As Integer, YMov As Integer
- Dim Count As Long, SaveX As Double
- XCng = 1: YCng = 1
- XMov = 1: YMov = 1
- Do
- For X# = 2 To i#
- Prime = True
- For Y# = 1 To Primes.Count
- If Primes(Y#) > Sqr(X#) Then Exit For
- If X# / Primes(Y#) = X# \ Primes(Y#) Then Prime = False: Exit For
- DoEvents
- Next Y#
- SaveX = X
- If Prime = True Then
- If Count < 500 Then Count = Count + 1
- Primes.Add X#
- Select Case Count
- Case 100
- PrintText "You are getting sleepy!"
- Case 125
- PrintText "Prime numbers realy aren't that interesting."
- Case 150: X = -1000000
- Case 151: X = 0
- Case 152: X = 1
- Case 153: X = 4
- Case 154: X = 666
- Case 155: X = 8453180
- Case 156: X = 3.14159265358979
- Case 157
- X = 911
- PrintText "There seems to be a little problem."
- Case 158: Err.Raise 51
- End Select
- XMov = XMov + Rnd * 5 * XCng - 5
- YMov = YMov + Rnd * 5 * YCng - 5
- If Abs(XMov) > 15 Then XCng = -XCng: XMov = 10
- If Abs(YMov) > 15 Then YCng = -YCng: YMov = 10
- ForeColor = RGB(Int(Rnd * 155) + 100, Int(Rnd * 155) + 100, Int(Rnd * 155) + 100)
- PrintText CStr(X), Int(Rnd * (ScaleWidth - TextWidth(Str(X#)))), Int(Rnd * (ScaleHeight - TextHeight(Str(X#))))
- Picture = Image
- PaintPicture Picture, 1, 1, , , XMov, YMov, , , vbSrcErase& Or vbSrcCopy&
- Line (0, 0)-(ScaleWidth, ScaleHeight), 0, B
- DoEvents
- End If
- X = SaveX
- Next X#
- Loop
- End Sub
- Sub MIDN()
- Dim i%, j%, k&
- i% = Val(Format(Time, "NN"))
- j% = Val(Format(Time, "SS"))
- For k& = 1 To Abs(j% - i%)
- Randomize
- Next k&
- End Sub
- Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
- End
- End Sub
- Private Sub Form_Click()
- End
- End Sub
- '''''''''''''''''''''''''
- ' 1 999 999 888 '
- ' 1 1 9 9 9 9 8 8 '
- ' 1 9999 9999 888 '
- ' 1 9 9 8 8 '
- ' 11111 9 9 888 '
- '''''''''''''''''''''''''
- ' Feucht Production '
- '''''''''''''''''''''''''
- ' 1999 code included
-