var ns1 = new Array(109)
var n1 = new Array(109)
var vs1 = new Array(105)
var vs2 = new Array(50)
var v1 = new Array(105)
var v2 = new Array(50)
var a1 = new Array(88)
var q2 = new Array(76)
var g2 = new Array(90)

var wordStatus = ""
var exactWord = new Array(17) // holds each word at each position
var exactType = new Array(17) // hold each word type at each position
var singPlur = new Array(17) // if noun or verb, hold whether singular or plural

ns1[0]="pigs",n1[0]="pig"
ns1[1]="cats",n1[1]="George"
ns1[2]="bats",n1[2]="bat"
ns1[3]="Roves",n1[3]="Rove"
ns1[4]="rats",n1[4]="rat"
ns1[5]="dogs",n1[5]="dog"
ns1[6]="logs",n1[6]="log"
ns1[7]="drinks",n1[7]="drink"
ns1[8]="walls",n1[8]="wall"
ns1[9]="souls",n1[9]="soul"
ns1[10]="wars",n1[10]="war"
ns1[11]="oils",n1[11]="oil"
ns1[12]="bones",n1[12]="bone"
ns1[13]="mice",n1[13]="mouse"
ns1[14]="butts",n1[14]="butt"
ns1[15]="babes",n1[15]="child"
ns1[16]="hearts",n1[16]="heart"
ns1[17]="hands",n1[17]="Bush"
ns1[18]="moms",n1[18]="Dick"
ns1[19]="goals",n1[19]="John"
ns1[20]="Pops",n1[20]="Pop"
ns1[21]="votes",n1[21]="dad"
ns1[22]="thrones",n1[22]="throne"
ns1[23]="farts",n1[23]="bleep"
ns1[24]="sheeps",n1[24]="sheep"
ns1[25]="fish",n1[25]="fish"
ns1[26]="goats",n1[26]="dish"
ns1[27]="cows",n1[27]="wish"
ns1[28]="beers",n1[28]="beer"
ns1[29]="plows",n1[29]="plow"
ns1[30]="sows",n1[30]="sow"
ns1[31]="hopes",n1[31]="hope"
ns1[32]="wives",n1[32]="wife"
ns1[33]="wars",n1[33]="war"
ns1[34]='men',n1[34]='man'
ns1[35]='chicks',n1[35]='chick'
ns1[36]='skirts',n1[36]='skirt'
ns1[37]='duhs',n1[37]='duh'
ns1[38]='chores',n1[38]='chore'
ns1[39]='doors',n1[39]='door'
ns1[40]='floors',n1[40]='floor'
ns1[41]='guns',n1[41]='barf'
ns1[42]='scores',n1[42]='score'
ns1[43]='shores',n1[43]='shore'
ns1[44]='moms',n1[44]='mom'
ns1[45]='Jebs',n1[45]='Jeb'
ns1[46]='jokes',n1[46]='Pres.'
ns1[47]='nerds',n1[47]='nerd'
ns1[48]='guns',n1[48]='gun'
ns1[49]='sports',n1[49]='sport'
ns1[50]='ducks',n1[50]='duck'
ns1[51]='bugs',n1[51]='moose'
ns1[52]='trees',n1[52]='tree'
ns1[53]='birds',n1[53]='bird'
ns1[54]='turds',n1[54]='turd'
ns1[55]='brews',n1[55]='brew'
ns1[56]='drugs',n1[56]='drug'
ns1[57]='dips',n1[57]='dip'
ns1[58]='goons',n1[58]='goon'
ns1[59]='moons',n1[59]='moon'
ns1[60]='spoons',n1[60]='spoon'
ns1[61]='prunes',n1[61]='prune'
ns1[62]='tunes',n1[62]='tune'
ns1[63]='prudes',n1[63]='prude'
ns1[64]='nudes',n1[64]='nude'
ns1[65]='dudes',n1[65]='dude'
ns1[66]='hogs',n1[66]='hog'
ns1[67]='hogs',n1[67]='horse'
ns1[68]='bags',n1[68]='bag'
ns1[69]='flags',n1[69]='flag'
ns1[70]='cars',n1[70]='car'
ns1[71]='heads',n1[71]='head'
ns1[72]='spoons',n1[72]='spoon'
ns1[73]='ducks',n1[73]='duck'
ns1[74]='forks',n1[74]='fork'
ns1[75]='knives',n1[75]='knife'
ns1[76]='ships',n1[76]='ship'
ns1[77]='suns',n1[77]='sun'
ns1[78]='moons',n1[78]='moon'
ns1[79]='stars',n1[79]='star'
ns1[80]='Earths',n1[80]='Earth'
ns1[81]='mice',n1[81]='house'
ns1[82]='doors',n1[82]='door'
ns1[83]='pens',n1[83]='pen'
ns1[84]='lambs',n1[84]='lamb'
ns1[85]='crows',n1[85]='crow'
ns1[86]='seals',n1[86]='seal'
ns1[87]='loons',n1[87]='loon'
ns1[88]='boats',n1[88]='boat'
ns1[89]='wigs',n1[89]='horse'
ns1[90]='boats',n1[90]='boss'
ns1[91]='veeps',n1[91]='veep'
ns1[92]='whips',n1[92]='whip'
ns1[93]='chiefs',n1[93]='chief'
ns1[94]='snakes',n1[94]='snake'
ns1[95]='eels',n1[95]='eel'
ns1[96]='asps',n1[96]='asp'
ns1[97]='butts',n1[97]='butt'
ns1[98]='punks',n1[98]='punk'
ns1[99]='oafs',n1[99]='oaf'
ns1[100]='oaks',n1[100]='oak'
ns1[101]='oafs',n1[101]='dust'
ns1[102]='pups',n1[102]='pup'
ns1[103]='runts',n1[103]='runt'
ns1[104]='cats',n1[104]='cat'
ns1[105]='mice',n1[105]='mouse'
ns1[106]='flies',n1[106]='fly'
ns1[107]='bees',n1[107]='bee'
ns1[108]='fish',n1[108]='fish'




vs1[0]="votes",v1[0]="vote"
vs1[1]="runs",v1[1]="run"
vs1[2]="humps",v1[2]="hump"
vs1[3]="calls",v1[3]="call"
vs1[4]="whines",v1[4]="whine"
vs1[5]="poops",v1[5]="poop"
vs1[6]="fights",v1[6]="fight"
vs1[7]="pays",v1[7]="pay"
vs1[8]="grunts",v1[8]="grunt"
vs1[9]="leads",v1[9]="lead"
vs1[10]="leaks",v1[10]="leak"
vs1[11]="sees",v1[11]="see"
vs1[12]="runs",v1[12]="run"
vs1[13]="eats",v1[13]="eat"
vs1[14]="blabs",v1[14]="blab"
vs1[15]="slips",v1[15]="slip"
vs1[16]="sinks",v1[16]="sink"
vs1[17]="jabs",v1[17]="jab"
vs1[18]="dives",v1[18]="dive"
vs1[19]="scores",v1[19]="score"
vs1[20]="peeks",v1[20]="peek"
vs1[21]="runs",v1[21]="run"
vs1[22]="points",v1[22]="fix"
vs1[23]="turns",v1[23]="munch"
vs1[24]="stands",v1[24]="tax"
vs1[25]="speaks",v1[25]="speak"
vs1[26]="lies",v1[26]="lie"
vs1[27]="talks",v1[27]="talk"
vs1[28]="bends",v1[28]="change"
vs1[29]="seeks",v1[29]="search"
vs1[30]='spends',v1[30]='spend'
vs1[31]='pumps',v1[31]='pump'
vs1[32]='farts',v1[32]='fart'
vs1[33]='dies',v1[33]='die'
vs1[34]='wins',v1[34]='wage'
vs1[35]='flies',v1[35]='win'
vs1[36]='squeaks',v1[36]='squeak'
vs1[37]='falls',v1[37]='mount'
vs1[38]='drinks',v1[38]='drink'
vs1[39]='eats',v1[39]='grow'
vs1[40]='grinds',v1[40]='belch'
vs1[41]='bows',v1[41]='bow'
vs1[42]='serves',v1[42]='serve'
vs1[43]='brags',v1[43]='brag'
vs1[44]='chows',v1[44]='chow'
vs1[45]='sings',v1[45]='sing'
vs1[46]='prays',v1[46]='pray'
vs1[47]='cheers',v1[47]='cheer'
vs1[48]='burps',v1[48]='burp'
vs1[49]='talks',v1[49]='talk'

vs1[50]='drips',v1[50]='drip'
vs1[51]='laughs',v1[51]='laugh'
vs1[52]='flops',v1[52]='flop'
vs1[53]='flops',v1[53]='pace'
vs1[54]='gasps',v1[54]='gasp'
vs1[55]='gasps',v1[55]='gaze'
vs1[56]='chokes',v1[56]='choke'
vs1[57]='swills',v1[57]='swill'
vs1[58]='kills',v1[58]='kill'
vs1[59]='peels',v1[59]='peel'
vs1[60]='writes',v1[60]='write'
vs1[61]='signs',v1[61]='sign'
vs1[62]='leers',v1[62]='leer'
vs1[63]='shakes',v1[63]='shake'
vs1[64]='peeks',v1[64]='peek'
vs1[65]='shouts',v1[65]='shout'
vs1[66]='dreams',v1[66]='dream'
vs1[67]='wails',v1[67]='wail'
vs1[68]='flees',v1[68]='flee'
vs1[69]='fights',v1[69]='fight'
vs1[70]='shouts',v1[70]='march'
vs1[71]='drills',v1[71]='drill'
vs1[72]='aims',v1[72]='aim'
vs1[73]='spits',v1[73]='spit'
vs1[74]='chews',v1[74]='chew'
vs1[75]='scrubs',v1[75]='scrub'
vs1[76]='scrubs',v1[76]='brush'
vs1[77]='blinks',v1[77]='blink'
vs1[78]='thinks',v1[78]='think'
vs1[79]='sinks',v1[79]='sink'
vs1[80]='winks',v1[80]='wink'
vs1[81]='clucks',v1[81]='cluck'
vs1[82]='barks',v1[82]='bark'
vs1[83]='clucks',v1[83]='cringe'
vs1[84]='skips',v1[84]='skip'
vs1[85]='skips',v1[85]='screech'
vs1[86]='shines',v1[86]='shine'
vs1[87]='whines',v1[87]='whine'
vs1[88]='climbs',v1[88]='climb'
vs1[89]='spells',v1[89]='spell'
vs1[90]='gripes',v1[90]='gripe'
vs1[91]='pouts',v1[91]='pout'
vs1[92]='hears',v1[92]='hear'
vs1[93]='looks',v1[93]='look'
vs1[94]='yelps',v1[94]='yelp'
vs1[95]='hops',v1[95]='hop'
vs1[96]='yelps',v1[96]='graze'
vs1[97]='plays',v1[97]='play'
vs1[98]='falls',v1[98]='fall'
vs1[99]='jumps',v1[99]='jump'
vs1[100]='fights',v1[100]='fight'
vs1[101]='sits',v1[101]='sit'
vs1[102]='trips',v1[102]='trip'
vs1[103]='moans',v1[103]='moan'
vs1[104]='sings',v1[104]='sing'



vs2[0]="travels",v2[0]="travel"
vs2[1]="rallies",v2[1]="rally"
vs2[2]="marries",v2[2]="marry"
vs2[3]="brightens",v2[3]="brighten"
vs2[4]="softens",v2[4]="soften"
vs2[5]="welcomes",v2[5]="welcome"
vs2[6]="respects",v2[6]="respect"
vs2[7]="admires",v2[7]="admire"
vs2[8]="opens",v2[8]="open"
vs2[9]="provides",v2[9]="provide"
vs2[10]="transforms",v2[10]="transform"
vs2[11]="creates",v2[11]="create"
vs2[12]="studies",v2[12]="study"
vs2[13]="declares",v2[13]="declare"
vs2[14]="races",v2[14]="ignore"
vs2[15]="struggles",v2[15]="struggle"
vs2[16]="descends",v2[16]="descend"
vs2[17]="listens",v2[17]="listen"
vs2[18]="worries",v2[18]="worry"
vs2[19]="declines",v2[19]="decline"
vs2[20]="succeeds",v2[20]="succeed"
vs2[21]="ferments",v2[21]="ferment"
vs2[22]="stands by",v2[22]="stand by"
vs2[23]="prepares",v2[23]="prepare"
vs2[24]="prepares",v2[24]="deserve"
vs2[25]="believes",v2[25]="believe"
vs2[26]="defends",v2[26]="believe"
vs2[27]="defends",v2[27]="increase"
vs2[28]="protects",v2[28]="decrease"
vs2[29]="revolts",v2[29]="revolt"
vs2[30]='divides',v2[30]='divide'
vs2[31]='unites',v2[31]='unite'
vs2[32]='beckons',v2[32]='endorse'
vs2[33]='lectures',v2[33]='lecture'
vs2[34]='informs',v2[34]='inform'
vs2[35]='sustains',v2[35]='sustain'
vs2[36]='lobbies',v2[36]='lobby'
vs2[37]='pretends',v2[37]='pretend'
vs2[38]='measures',v2[38]='measure'
vs2[39]='stands proud',v2[39]='stand proud'
vs2[40]='stands tall',v2[40]='stand tall'
vs2[41]='wins big',v2[41]='win big'
vs2[42]='battles',v2[42]='battle'
vs2[43]='invests',v2[43]='invest'
vs2[44]='conspires',v2[44]='conspire'
vs2[45]='reaches',v2[45]='reach down'
vs2[46]='believes',v2[46]='believe'
vs2[47]='respects',v2[47]='respect'
vs2[48]='ages',v2[48]='deafen'
vs2[49]='happens',v2[49]='happen'

a1[0]="clear"
a1[1]="low"
a1[2]="bright"
a1[3]="soft"
a1[4]="dumb"
a1[5]="pure"
a1[6]="thick"
a1[7]="free"
a1[8]="old"
a1[9]="safe"
a1[10]="rich"
a1[11]="white"
a1[12]="pure"
a1[13]="dry"
a1[14]="red"
a1[15]="deep"
a1[16]="warm"
a1[17]="clean"
a1[18]="blue"
a1[19]="clear"
a1[20]="green"
a1[21]="nice"
a1[22]="poor"
a1[23]="fresh"
a1[24]="old"
a1[25]="lush"
a1[26]="short"
a1[27]="huge"
a1[28]="cold"
a1[29]="hot"
a1[30]="clear"
a1[31]="brave"
a1[32]="white"
a1[33]="pure"
a1[34]="dry"
a1[35]="gold"
a1[36]="black"
a1[37]="tall"
a1[38]="neat"
a1[39]="proud"
a1[40]='bold'
a1[41]='cool'
a1[42]='good'
a1[43]='great'
a1[44]='new'
a1[45]='rad'
a1[46]='brave'
a1[47]='thin'
a1[48]='fat'
a1[49]='new'

a1[50]='damn'
a1[51]='dern'
a1[52]='darn'
a1[53]='lame'
a1[54]='weak'
a1[55]='sad'
a1[56]='fun'
a1[57]='small'
a1[58]='fast'
a1[59]='long'
a1[60]='tall'
a1[61]='hot'
a1[62]='sweet'
a1[63]='sour'
a1[64]='tart'
a1[65]='rich'
a1[66]='puce'
a1[67]='mauve'
a1[68]='hard'
a1[69]='vile'
a1[70]='clean'
a1[71]='clear'
a1[72]='bleak'
a1[73]='dumb'
a1[74]='drab'
a1[75]='foul'
a1[76]='fine'
a1[77]='glad'
a1[78]='last'
a1[79]='first'
a1[80]='frail'
a1[81]='green'
a1[82]='kind'
a1[83]='quaint'
a1[84]='rare'
a1[85]='tame'
a1[86]='tan'
a1[87]='tough'

q2[0]="neatly"
q2[1]="quickly"
q2[2]="softly"
q2[3]="proudly"
q2[4]="nicely"
q2[5]="coolly"
q2[6]="loudly"
q2[7]="proudly"
q2[8]="gently"
q2[9]="strongly"
q2[10]="sadly"
q2[11]="gladly"
q2[12]="madly"
q2[13]="safely"
q2[14]="firmly"
q2[15]="sharply"
q2[16]="meanly"
q2[17]="cleanly"
q2[18]="dryly"
q2[19]="bravely"
q2[20]="wetly"
q2[21]="bluntly"
q2[22]="bravely"
q2[23]="strongly"
q2[24]="proudly"
q2[25]="slowly"
q2[26]="hotly"
q2[27]="richly"
q2[28]="proudly"
q2[29]="warmly"
q2[30]="richly"
q2[31]="truly"
q2[32]="fairly"
q2[33]='blindly'
q2[34]='strictly'
q2[35]='curtly'
q2[36]='sternly'
q2[37]="harshly"
q2[38]='cruelly'
q2[39]="stoop-ly"
q2[40]="luvely"
q2[41]='dumbly'
q2[42]='firmly'
q2[43]='Tex-ly'
q2[44]='oil-li-ly'
q2[45]='Bushly'
q2[46]='freely'
q2[47]='fiercely'
q2[48]='freely'
q2[49]='ugly'
q2[50]='rudely'
q2[51]='blindly'
q2[52]='poorly'
q2[53]='richly'
q2[54]='meanly'
q2[55]='sweetly'
q2[56]='badly'
q2[57]='coldly'
q2[58]='darkly'
q2[59]='drably'
q2[60]='weirdly'
q2[61]='strangely'
q2[62]='lamely'
q2[63]='sadly'
q2[64]='quickly'
q2[65]='sourly'
q2[66]='cleanly'
q2[67]='bleakly'
q2[68]='dumbly'
q2[69]='numbly'
q2[70]='gladly'
q2[71]='quaintly'
q2[72]='tamely'
q2[73]='toughly'
q2[74]='widely'
q2[75]='curtly'


g2[0]="passin´"
g2[1]="comin´"
g2[2]="givin´"
g2[3]="shoutin´"
g2[4]="facin´"
g2[5]="runnin´"
g2[6]="movin´"
g2[7]="singin´"
g2[8]="cryin´"
g2[9]="shovin´"
g2[10]="poopin´"
g2[11]="fartin´"
g2[12]="carin´"
g2[13]="drinkin´"
g2[14]="rootin´"
g2[15]="hauntin´"
g2[16]="votin´"
g2[17]="fryin´"
g2[18]="speakin´"
g2[19]="speechin´"
g2[20]="bombin´"
g2[21]="changin´"
g2[22]="leanin´"
g2[23]="sharin´"
g2[24]="gloatin´"
g2[25]="thrustin´"
g2[26]="trainin´"
g2[27]="laughin´"
g2[28]="smilin´"
g2[29]="frownin´"
g2[30]="aidin´"
g2[31]="fundin´"
g2[32]="shootin´"
g2[33]="helpin´"
g2[34]="votin´"
g2[35]="speakin´"
g2[36]="missin´"
g2[37]="helpin´"
g2[38]='spittin´'
g2[39]="barfin´"
g2[40]="cloudin´"
g2[41]="cryin´"
g2[42]='grievin´'
g2[43]="poutin´"
g2[44]="strugglin´"
g2[45]="prayin´"
g2[46]="feelin´"
g2[47]="cheerin´"
g2[48]="helpin´"
g2[49]="smoochin´"
g2[50]="talkin´"
g2[51]="walkin´"
g2[52]="feelin´"
g2[53]="seein´"
g2[54]="gropin´"
g2[55]="smellin´"
g2[56]="tellin´"
g2[57]="tattlin´"
g2[58]="prattlin´"
g2[59]="battlin´"
g2[60]="ridin´"
g2[61]="drivin´"
g2[62]="whinin´"
g2[63]="dinin´"
g2[64]="spoutin´"
g2[65]="sproutin´"
g2[66]="flauntin´"
g2[67]="divin´"
g2[68]="flyin´"
g2[69]="cryin´"
g2[70]="pourin´"
g2[71]="washin´"
g2[72]="gripin´"
g2[73]="snipin´"
g2[74]="snoopin´"
g2[75]="poopin´"
g2[76]="babblin´"
g2[77]="grumblin´"
g2[78]="tumblin´"
g2[79]="stumblin´"
g2[80]="bumblin´"
g2[81]="quibblin´"
g2[82]="fibbin´"
g2[83]="lyin´"
g2[84]="speakin´"
g2[85]="garblin´"
g2[86]="warblin´"
g2[87]="spittin´"
g2[88]="whippin´"
g2[89]="golfin´"


var wordType = 0
var wordBeat = 0
var wordPick = 0
var poemBeats = 0
var position = 1
var firstWord = true
var forceWord = false
var line1 = "true"
var line2 = "false"
var line3 = "false"
var tempWord = ""
var rndNum, pickOne
var word1 = ""
var comma = false
var line1WordCount = 0
var line2WordCount = 0
var line3WordCount = 0

// nouns = 1, adjectives = 2, verbs = 3, adverbs = 4, gerunds = 5

function chooseWord() {

// choose noun, verb, adjective, or adverb
comma = false
if (position == 1) {
rndNum = 4// noun, adjective, gerund or adverb
pickOne = Math.round(Math.random() * rndNum)
if (pickOne == 2) {
var sp = Math.round(Math.random() *2)// randomly choose singular or plural form
if (sp == 1) {
singPlur[1] = 0 // singular = 0, plural = 1
} else {
singPlur[1] = 1
}
wordType = 1// noun
} else if (pickOne == 3) {
wordType = 2// adjective
} else if (pickOne == 4) {
wordType = 5// gerund
} else if (pickOne == 1) {
wordType = 4// adverb
}
exactType[position] = wordType
}
if (position == 2) {// always preceded by noun, adjective or gerund

if (singPlur[1] == 1) {// if previous word plural, this plural too
singPlur[2] = 1
} else {
singPlur[2] = 0
}

rndNum = 2// follow with verb (noun), adjective or gerund + ,
if (exactType[1] == 1) { // word 1 is a noun
wordType = 3// follow with a verb
} else if (exactType[1] == 2) {// word 1 is an adjective
var pickOne = Math.round(Math.random() * rndNum)
if (pickOne == 1) {// adjective
wordType = 2
} else {
wordType = 1// noun
}
}else if (exactType[1] == 5) {// word 1 is a gerund, follow with noun or adverb
var pickOne = Math.round(Math.random() * rndNum)
if (pickOne == 1) {// adverb
wordType = 4
} else {
wordType = 1// noun
}
}else if (exactType[1] == 6) {// word 1 = preposition, follow with noun or adjective
var pickOne = Math.round(Math.random() * rndNum)
if (pickOne == 1) {// adjective
wordType = 2
} else {
wordType = 1// noun
}
}else if (exactType[1] == 4) {// word 1 = adverb, follow with gerund or noun/adjective + comma
var pickOne = Math.round(Math.random() * 3)
if (pickOne == 1) {// adjective
wordType = 2
//comma = true
} else if (pickOne == 2){
wordType = 1// noun
comma = true
} else {
wordType = 5// gerund
}
}
}
if (position > 2) {// all other cases

var sp = Math.round(Math.random() *2)// randomly choose singular or plural form
if (sp == 1) {
singPlur[position] = 0 // singular = 0, plural = 1
} else {
singPlur[position] = 1
}

if (exactType[(position - 1)] == 1) {// previous word was noun, follow with verb gerund or prep
if (singPlur[(position - 1)] == 1) {// assign plurality/singularity
singPlur[position] = 1
} else {
singPlur[position] = 0
}
rndNum = 2
pickOne = Math.round(Math.random() * rndNum) // randomly pick a word type
if (pickOne == 1) {// verb
wordType = 3
} else {
wordType = 5// gerund
}
}
if (exactType[(position - 1)] == 2) {// previous word was an adjective
// follow with adjective or noun

if (exactType[(position - 2)] == 2 && exactType[(position - 3)] == 2) {
wordType = 1// force noun if more than two adjectives
} else {
rndNum = 2
var pickOne = Math.round(Math.random() * rndNum)
if (pickOne == 1) {// adjective
wordType = 2
//comma = true
} else {
wordType = 1// noun
}
}
}
if (exactType[(position - 1)] == 3) {// previous word was a verb
// follow with anything but verb

if (singPlur[(position - 1)] == 1) {// assign plurality/singularity
singPlur[position] = 1
} else {
singPlur[position] = 0
}

rndNum = 5
pickOne = Math.round(Math.random() * rndNum)
if (pickOne <= 2) {// adverb 
wordType = 4
} else if (pickOne == 3) {// these need to be preceded by a comma or period.
wordType = 1// noun
if (exactType[(position - 2)] == 1) {
comma = true// if end of noun-verb pair, add a comma
}
} else if (pickOne == 4) {
wordType = 2// adjective
comma = true
} else if (pickOne == 5) {
wordType = 5// gerund
comma = true
}
}

if (exactType[(position - 1)] == 4) {// previous word was an adverb
// follow with anything but verb (for now)
rndNum = 5
pickOne = Math.round(Math.random() * rndNum)
if (pickOne == 1) {// adverb 
wordType = 4
comma = true
} else if (pickOne == 2 || pickOne == 3) {// these need to be preceded by a comma or period.
wordType = 1// noun
comma = true
} else if (pickOne == 4) {
wordType = 2// adjective
comma = true
} else if (pickOne == 5) {
wordType = 5// gerund - weighted
comma = true
}
}
if (exactType[(position - 1)] == 5) {// previous word was a gerund
// follow with anything but verb
rndNum = 5
pickOne = Math.round(Math.random() * rndNum)
if (pickOne == 1) {
wordType = 4// adverb
comma = true
} else if (pickOne == 2 || pickOne == 5) {// these need to be preceded by a comma or period.
wordType = 1// noun
} else if (pickOne == 3) {
wordType = 2// adjective
} else if (pickOne == 4) {
wordType = 5// gerund
comma = true
}
}
if (exactType[(position - 1)] == 6) {// word 1 = preposition, follow with noun or adjective
var pickOne = Math.round(Math.random() * rndNum)
if (pickOne == 1) {// adjective
wordType = 2
} else {
wordType = 1// noun
}
}
}
if (forceWord) {
var pickOne = Math.round(Math.random() * 3)
if (pickOne == 1) {
wordType = 4// adverb
} else if (pickOne == 2) {
wordType = 2// verb
} else if (pickOne == 3) {
wordType = 5// gerund
}
}
exactType[position] = wordType

// choose number of syllables, 1-4

if (wordType <= 3) {  // currently have 4-syllable entries for nouns, adjectives, verbs and adverbs
rndNum = 1
} else { // max 3 syllables for gerunds, adverbs and preps (so far)
rndNum = 2
}
wordBeat = Math.round(Math.random() * rndNum)  // up to four syllables
if (wordBeat <= 0) { wordBeat = 1 }

// choose word from array
// different quantities of words for the various types
// nouns = 1 (50), adjectives = 2 (50), verbs = 3 (50), adverbs = 4 (50), gerunds = 5 (50), preps = 6 (10)
if (wordType == 1) { 
if (wordBeat == 1) { //183 1-s
wordPick = Math.round(Math.random() * 109) - 1
} else if (wordBeat == 2) {
wordPick = Math.round(Math.random() * 50) - 1  
} else if (wordBeat == 3) {
wordPick = Math.round(Math.random() * 50) - 1   
} else {
wordPick = Math.round(Math.random() * 44) - 1
}
} 
if (wordType == 2) {
if (wordBeat == 1) { //158 1-syllable adjectives
wordPick = Math.round(Math.random() * 88) - 1
} else if (wordBeat == 2 ){
wordPick = Math.round(Math.random() * 50) - 1  //334 2-syllable adjectives
} else if (wordBeat == 3 ){
wordPick = Math.round(Math.random() * 50) - 1  //198 2-syllable adjectives
} else {
wordPick = Math.round(Math.random() * 50) - 1
}
}
if (wordType == 3) {
if (wordBeat == 1) {
wordPick = Math.round(Math.random() * 105) - 1 // 205 1-syllable verbs
} else if (wordBeat == 2) {
wordPick = Math.round(Math.random() * 50) - 1 // 150 2-syllable verbs
} else if (wordBeat == 3) {
wordPick = Math.round(Math.random() * 50) - 1 // 51 3-syllable verbs
} else {
wordPick = Math.round(Math.random() * 11) - 1
}
}
if (wordType == 4) {
if (wordBeat == 2) {
wordPick = Math.round(Math.random() * 76) - 1 // 78 1-syl adv
} else if (wordBeat == 3) {
wordPick = Math.round(Math.random() * 50) - 1 // 226 2-syl adv
} else {
wordPick = Math.round(Math.random() * 50) - 1
}
}
if (wordType == 5) {
if (wordBeat == 2) {
wordPick = Math.round(Math.random() * 90) - 1 // 108 2-syl ger
} else if (wordBeat == 3) {
wordPick = Math.round(Math.random() * 50) - 1 // 94 3-syl ger
} else {
wordPick = Math.round(Math.random() * 30) - 1
}
}
if (wordType == 6) {
wordPick = Math.round(Math.random() * 30) - 1
}
if (wordPick < 0) { wordPick = 10 }

//wordPick = Math.round(Math.random() * 30) - 1    // an array entry from 0 to 29 (so far)
//if (wordPick < 0) { wordPick = 4 }  // correct for bug? sometimes result is -1


// get the word from the array

if (wordType == 1) { // noun
if (wordBeat == 1) { 
if (singPlur[position] == 1) {// lookup singular or plural form from array
word1 = ns1[wordPick]
} else {
word1 = n1[wordPick]
}
} else if (wordBeat  == 2) {
if (singPlur[position] == 1) {
word1 = ns2[wordPick]
} else {
word1 = n2[wordPick]
}
} else if (wordBeat  == 3) {
if (singPlur[position] == 1) {
word1 = ns3[wordPick]
} else {
word1 = n3[wordPick]
}
} else if (wordBeat  == 4) {
if (singPlur[position] == 1) {
word1 = ns4[wordPick]
} else {
word1 = n4[wordPick]
}
}
} else if (wordType == 2) { // adjective
if (wordBeat == 1) {
word1 = a1[wordPick]
} else if (wordBeat  == 2) {
word1 = a2[wordPick]
} else if (wordBeat  == 3) {
word1 = a3[wordPick]
} else if (wordBeat  == 4) {
word1 = a4[wordPick]
}
} else if (wordType == 3) { // verb
if (wordBeat == 1) {
if (singPlur[position] == 1) {
word1 = v1[wordPick]
} else {
word1 = vs1[wordPick]
}
} else if (wordBeat == 2) {
if (singPlur[position] == 1) {
word1 = v2[wordPick]
} else {
word1 = vs2[wordPick]
}
} else if (wordBeat  == 3) {
if (singPlur[position] == 1) {
word1 = v3[wordPick]
} else {
word1 = vs3[wordPick]
}
} else if (wordBeat  == 4) {
if (singPlur[position] == 1) {
word1 = v4[wordPick]
} else {
word1 = vs4[wordPick]
}
}

} else if (wordType == 4) { // adverb
if (wordBeat == 1) {
word1 = "x"// skipping 1-syllable adverbs
} else if (wordBeat  == 2) {
word1 = q2[wordPick]
} else if (wordBeat  == 3) {
word1 = q3[wordPick]
}
} else if (wordType == 5) { // gerund
if (wordBeat == 1) {
word1 = "x"// skipping 1-syllable gerunds
} else if (wordBeat  == 2) {
word1 = g2[wordPick]
} else if (wordBeat  == 3) {
word1 = g3[wordPick]
}
} else if (wordType == 6) { // preposition
if (wordBeat == 1) {
word1 = preps1[wordPick]
} else if (wordBeat  == 2) {
word1 = preps2[wordPick]
} else if (wordBeat  == 3) {
word1 = "x"// skipping 3-syllable preps
}
}
return word1
}
