09-01-2022, 05:16 AM
A silly little program inspired by staying up too late and leaving youtube playing while I was programming, and a video came up on the Babel Library. Here's a small piece of that:
Code: (Select All)
'babeltype
'
'an experiment at 1,000,000 virtual chimpanzees typing away, with a couple rules
'
' press any key to pause the program, and the spacebar to continue
' take a screen shot if you get a miracle sentence.
'
' press escape to quit
Dim vowel$(6), cm$(7), word$(10)
vowel$(1) = "a"
vowel$(2) = "e"
vowel$(3) = "i"
vowel$(4) = "o"
vowel$(5) = "u"
vowel$(6) = "y"
cm$(1) = "t"
cm$(2) = "n"
cm$(3) = "s"
cm$(4) = "h"
cm$(5) = "r"
cm$(6) = "d"
cm$(7) = "l"
word$(1) = "the "
word$(2) = "be "
word$(3) = "and "
word$(4) = "a "
word$(5) = "of "
word$(6) = "to "
word$(7) = "in "
word$(8) = "I "
word$(9) = "you "
word$(10) = "it "
start$ = "yes"
Do
_Limit 90
r = Int(1 + Rnd * 2)
For n = 1 To r:
If start$ = "yes" Then
Select Case Int(1 + Rnd * 90)
Case 1 To 6
Print UCase$(cm$(1 + Int(Rnd * 7)));
Case 7 To 88
Print UCase$(Chr$(97 + Int(Rnd * 26)));
Case 89, 90
W$ = word$(Int(1 + Rnd * 10))
Mid$(W$, 1, 1) = UCase$(Left$(W$, 1))
Print W$;
End Select
start$ = "no"
Else
Select Case Int(1 + Rnd * 90)
Case 1 To 6
Print cm$(1 + Int(Rnd * 7));
Case 7 To 88
Print Chr$(97 + Int(Rnd * 26));
Case 89, 90
Print word$(Int(1 + Rnd * 10));
End Select
End If
Next
r = Int(1 + Rnd * 2)
For n = 1 To r: Print vowel$(Int(1 + Rnd * 6));: Next
r = Int(1 + Rnd * 2)
For n = 1 To r
If Rnd * 6 < 2.2 Then
Print cm$(1 + Int(Rnd * 7));
Else
Print Chr$(97 + Int(Rnd * 26));
End If
Next
If Rnd * 6 < 2.5 Then
Print vowel$(Int(1 + Rnd * 6));
If Rnd * 6 < 2.5 Then
r = Int(1 + Rnd * 2)
For n = 1 To r
If Rnd * 6 < 2.2 Then
Print cm$(1 + Int(Rnd * 7));
Else
Print Chr$(97 + Int(Rnd * 26));
End If
Next
End If
End If
If Rnd * 24 < 1.5 Then
p = Int(1 + Rnd * 88)
Select Case p
Case 1 To 18
Print ",";
Case 19 To 23
Print ";";
Case 24
Print ":";
Case 25 To 75
Print ".";
start$ = "yes"
Case 76 To 83
Print "?";
start$ = "yes"
Case 84 To 88
Print "!";
start$ = "yes"
End Select
End If
Print " ";
k$ = InKey$
If k$ <> "" And k$ <> Chr$(27) Then
Do
_Limit 30
a$ = InKey$
Loop Until a$ = " "
End If
Loop Until k$ = Chr$(27)
End