randomize timer()
sync on
sync rate 0
sync
 
dim vow$(5) as string
dim con$(6,6) as string
dim name$(100)
 
for t=1 to 5
 read a$
 vow$(t)=a$
next t
 
for t=1 to 6
 for x=1 to 6
  read a$
  con$(t,x)=a$
 next x
next t
 
for n=1 to 100
 ` n=name number
 
l=rnd(5)+4
 ` l=name length
 
cv=1
if rnd(3)=2 then cv=-1
 ` cv=consonant/vowel : 1=c, -1=v
 
  ` here is where actual name creation happens:
a$=""
for t=1 to l
 
select cv
 
case -1
a$=a$+vow$(rnd(4)+1)
endcase
 
case 1
 
 repeat
 
a=(t>1 and t<l)
x=rnd(18+a)+1
 ` x is the random determiner 1-20
y=0
z=0
 ` y is which consonant group, z is how many valid members it has.
 
if x<10
 y=1
 z=5
 exit
endif
 
if x>9 and x<15
 y=2
 z=5
 exit
endif
 
if x>14 and x<18
 y=3
 z=5
 exit
endif
 
if x=18
 y=4
 z=4
 exit
endif
 
if x=19
 y=5
 z=6
 exit
endif
 
if x=20
 y=6
 z=5
 exit
endif
 
until z>0
 
a$=a$+con$(y,rnd(z-1)+1)
 
endcase
 
endselect
 
 ` this way, we go from vowel to consonant, no matter what we are on currently
cv=-cv
 
` there's a 25% chance a word will end in a double vowel.
if t+1=l
 if cv=1
  if rnd(3)=0
   cv=-1
  endif
 endif
endif
 
next t
 
name$(n)=a$
 
next n
 
 
for t=1 to 20
 for x=0 to 4
  text x*100,t*20,name$(t+x*20)
 next x
next t
 
text 0,440,"if you don't want this saved as a file, hit [ESC]. otherwise, hit any key."
sync
wait key
 
open to write 1,"namegen"+str$(int(timer()/98765))+".txt"
 for n=1 to 100
  write string 1,name$(n)
 next n
close file 1
 
 
data "a","e","i","o","u"
data "r","s","t","l","n","-"
data "b","c","d","m","y","-"
data "f","g","h","k","p","-"
data "st","th","ph","sh","-","-"
data "qu","x","z","j","w","v"
data "nn","pp","ss","rr","gg","-"