set display mode 1024,768,32
randomize timer()
 
data "e","u","i","o","a"
data "q","w","r","t","y","p","s","d","f","g","h","j","k","l","z","x","c","v","b","n","m"
data "Br","Tr","St","Dr","Sr","Th","Ph","Zr","Wr","Gl","Ch","Pr","Q","W","R","T","Y","P","S","D","F","G","H","J","K","L","Z","X","C","V","B","N","M"
data "nt","d","s","rt","p","k","b","g","m","st","ps","ts","ns","ms","nd","fs"
data "1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20"
 
`read vowels
dim vowel$(5)
for n=1 to 5
read vowel$(n)
next n
 
`read consonants
dim consonant$(21)
for n=1 to 21
read consonant$(n)
next n
 
`read beginnings of names
dim begin$(33)
for n=1 to 33
read begin$(n)
next n
 
`read ends of names
dim end$(16)
for n=1 to 16
read end$(n)
next n
 
`read number of word
dim numberwrd$(20)
for n=1 to 20
read numberwrd$(n)
next n
 
numberofwords=20
dim word$(numberofwords)
 
do
for repeatword=1 to numberofwords
rndbegin=rnd(11)+1
rndend=rnd(15)+1
  `start word with a consonant
  begin=1
  endc=0
  consonant=-1
  vowel=1
 
  `randomize word length
  numberofletters=3+rnd(5)
  if numberofletters=3 or 5 or 7
  if rnd(1)=0
  inc numberofletters
  else
  dec numberofletters
  endif
  endif
  dim letter$(numberofletters)
 
  for repeatletter=1 to numberofletters
 
    `select random consonant
    if consonant=1
      letter$(repeatletter)=consonant$(rnd(20)+1)
      if letter$(repeatletter)="q" then letter$(repeatletter)="qu"
      if letter$(repeatletter)="c"
      if rnd(1)=0 then letter$(repeatletter)="ck"
      endif
    endif
 
    `select random consonant
    if vowel=1
      letter$(repeatletter)=vowel$(rnd(4)+1)
      if letter$(repeatletter)="o"
      if rnd(1)=0 then letter$(repeatletter)="oo"
      endif
    endif
 
`alternate between consonant and vowel
consonant=consonant*-1
if rnd(5)<>1
vowel=vowel*-1
endif
  next repeatletter
  `build the word from the chosen letters
  word$(repeatword)=""
  word$(repeatword)=word$(repeatword)+begin$(rndbegin)
  for buildword=1 to numberofletters
    word$(repeatword)=word$(repeatword)+letter$(buildword)
  next buildword
  word$(repeatword)=numberwrd$(repeatword)+"-"+word$(repeatword)+end$(rndend)
  center text screen width()/2,10+repeatword*12,word$(repeatword)
next repeatword
print "Press space to regenerate"
print "Press 's' to save a word to file"
 
repeat
 
`save words to file
if inkey$()="s"
  print "Type name of file"
  Input "",filename$
  filename$="c:\"+filename$+".txt"
  if file exist (filename$) then delete file filename$
  open to write 1,filename$
  print "Type number of names you would like to save"
  Input "",numbername
  print "Type the numbers of the words you want to save"
  for x=1 to numbername
    Input "Word #"+str$(x)+"--",number
    write string 1,word$(number)
  next x
  print "Saved as '"+filename$+"'"
  close file 1
  wait 1000
endif
 
 
until spacekey()=1
wait 200
cls
loop