Advertisement
ASP_Volume2 Jokes/ Humor #36835

Monkey Typist

This code is basically a random text generator that taps out random strings of characters. It is a Monkey Typist because sometimes it might just make sense! The idea is that you watch the text appear and then see if the 'Monkey' enters real words or even sentences!

AI

สรุปโดย AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

ซอร์สโค้ด
original-source
Option Explicit
Dim intOriginalRnd As Integer
Private Sub Form_Load()
Dim fntA As New StdFont
fntA.Name = "Tahoma"
fntA.Size = 8
Me.Width = 6225
txtMonkey.Font = fntA
txtMonkey.Text = ""
txtMonkey.Locked = True
tmrMonkey.Interval = 100
tmrMonkey.Enabled = True
End Sub
Private Sub Form_Resize()
tmrMonkey.Enabled = False
With frmMonkey
txtMonkey.Height = .ScaleHeight
txtMonkey.Width = .ScaleWidth
txtMonkey.Left = .ScaleLeft
txtMonkey.Top = .ScaleTop
If .WindowState = 0 Then
 .Left = (Screen.Width - .Width) / 2
 .Top = (Screen.Height - .Height) / 2
End If
End With
tmrMonkey.Enabled = True
End Sub
Private Sub tmrMonkey_Timer()
intOriginalRnd = Int(Rnd * 10)
Dim intRnd As Integer
Randomize
frmMonkey.Caption = "Monkey Typist - Click text to stop"
If intOriginalRnd < 1 Then
 intRnd = 32
ElseIf intOriginalRnd < 2 Then
 intRnd = Int(3 * Rnd + 44)
ElseIf intOriginalRnd < 6 Then
 intRnd = Int(26 * Rnd + 97)
ElseIf intOriginalRnd < 10 Then
 intRnd = Int(26 * Rnd + 65)
End If
frmMonkey.Caption = "Monkey Typist - Click text to stop - " & Chr(intRnd)
txtMonkey.Text = txtMonkey.Text & Chr(intRnd)
End Sub
Private Sub txtMonkey_Click()
If tmrMonkey.Enabled = True Then
 tmrMonkey.Enabled = False
 frmMonkey.Caption = "Monkey Typist - Click text to start"
Else
 tmrMonkey.Enabled = True
End If
End Sub
ความคิดเห็นดั้งเดิม (3)
กู้คืนจาก Wayback Machine