'Haiku v6 generator nomainwin UpperLeftX = 32 UpperLeftY = 32 WindowWidth = 400 WindowHeight = 480 texteditor #w.t, 10, 10, 380, 460 open "Random Haiku Generator, Johnf (tenochtitlanuk)" for window as #w print #w, "trapclose [quit]" print #w.t, "!font Times_New_Roman 12" numArticles = 4 numAd =30 numNouns =30 numVerbs =18 numPrepos =18 dim article$( numArticles) dim adject$( numAd) dim noun$( numNouns) dim verb$( numVerbs) dim prepos$( numPrepos) for i =1 to numArticles read i$: article$( i) =i$ next i data "a", "the", "an", "the" for i =1 to numAd read i$: adject$( i) =i$ next i data "hurried", "hidden", "bitter", "careless", "silent", "empty" data "valued", "sudden", "wintry", "stylish", "top-down", "broken" data "little", "morning", "looping", "halfbaked", "turgid", "tricky" data "happy", "lesser", "open", "recent", "problem", "Basic" data "outright","opaque", "evil", "inane", "idiot", "arcane" for i =1 to numNouns read i$: noun$( i) =i$ next i data "step", "frame", "base", "field", "data", "rate" data "charge", "slope", "shape", "shade", "hue", "cell" data "zero", "byte", "bit", "chain", "link", "night" data "sound", "peak", "shape", "curve", "wave", "concept" data "program", "PC", "human", "God", "troll", "root" for i =1 to numVerbs read i$: verb$( i) =i$ next i data "drifts", "crashed", "passed", "runs", "rose", "floats" data "creeps", "runs", "fails", "ends", "sighs", "loops" data "crawls", "raced", "halts", "goes", "quits", "loves" for i =1 to numPrepos read i$: prepos$( i) =i$ next i data "within", "beyond", "throughout", "but now", "but then", "although" data "ahead", "in line", "at speed", "with love", "for ever", "for now" data "thereby","alack", "my love", "perchance", "ere long", "'til when" while 1 =1 x =int( 1 +4 *rnd( 1)) x=1 select case x case 1 gosub [type1] case 2 gosub [type2] case 3 gosub [type3] case 4 gosub [type4] end select print #w.t, haiku$ gosub [checkArticles] gosub [checkCapitals] print #w.t, haiku$ #w.t "____________________________________________________" scan for delay =1 to 50000 ' next delay wend wait [type1] haiku$ =chr$( 10) +" "_ +article$( int( 1 +rnd( 1)*numArticles)) +" "_ +adject$( int( 1 +rnd( 1)*numAd)) +" "_ +noun$( int( 1 +rnd( 1)*numNouns)) +" . . . " +chr$( 13) +" "_ +article$( int( 1 +rnd( 1)*numArticles)) +" "_ +noun$( int( 1 +rnd( 1)*numNouns)) +" "_ +verb$( int( 1 +rnd( 1)*numVerbs)) +" "_ +prepos$( int( 1 +rnd( 1)*numPrepos)) +" "_ +article$( int( 1 +rnd( 1)*numArticles)) +" "_ +noun$( int( 1 +rnd( 1)*numNouns)) +"." +chr$( 13) +" "_ +adject$( int( 1 +rnd( 1)*numAd)) +" "_ +noun$( int( 1 +rnd( 1)*numNouns)) +"." +chr$(13) return [type2] haiku$ =chr$( 10) +" "_ +noun$( int( 1 +rnd( 1)*numNouns)) +" "_ +prepos$( int( 1 +rnd( 1)*numPrepos)) +" "_ +article$( int( 1 +rnd( 1)*numArticles)) +" "_ +noun$( int( 1 +rnd( 1)*numNouns)) +";" +chr$( 13) +" "_ +article$( int( 1 +rnd( 1)*numArticles)) +" "_ +adject$( int( 1 +rnd( 1)*numAd)) +" "_ +noun$( int( 1 +rnd( 1)*numNouns)) +" "_ +prepos$( int( 1 +rnd( 1)*numPrepos)) +" "_ +article$( int( 1 +rnd( 1)*numArticles)) +" "_ +noun$( int( 1 +rnd( 1)*numNouns)) +"." +chr$( 13) +" "_ +adject$( int( 1 +rnd( 1)*numAd)) +" "_ +noun$( int( 1 +rnd( 1)*numNouns)) +"." +chr$(13) return [type3] haiku$ =chr$( 10) +" "_ +article$( int( 1 +rnd( 1)*numArticles)) +" "_ +adject$( int( 1 +rnd( 1)*numAd)) +" "_ +noun$( int( 1 +rnd( 1)*numNouns)) +";" +chr$( 13) +" "_ +prepos$( int( 1 +rnd( 1)*numPrepos)) +" "_ +article$( int( 1 +rnd( 1)*numArticles)) +" "_ +adject$( int( 1 +rnd( 1)*numAd)) +" "_ +noun$( int( 1 +rnd( 1)*numNouns)) +"." +chr$( 13) +" "_ +article$( int( 1 +rnd( 1)*numArticles)) +" "_ +noun$( int( 1 +rnd( 1)*numNouns)) +" "_ +verb$( int( 1 +rnd( 1)*numVerbs)) +"." return [type4] haiku$ =chr$( 10) +" "_ +adject$( int( 1 +rnd( 1)*numArticles)) +" "_ +noun$( int( 1 +rnd( 1)*numNouns)) +" "_ +verb$( int( 1 +rnd( 1)*numVerbs)) +";" +chr$(13) +" "_ +article$( int( 1 +rnd( 1)*numArticles)) +" "_ +adject$( int( 1 +rnd( 1)*numAd)) +" "_ +noun$( int( 1 +rnd( 1)*numNouns)) +";" +chr$( 13) +" "_ +prepos$( int( 1 +rnd( 1)*numPrepos)) +" "_ +article$( int( 1 +rnd( 1)*numArticles)) +" "_ +adject$( int( 1 +rnd( 1)*numAd)) +" "_ +noun$( int( 1 +rnd( 1)*numNouns)) +"." +chr$(13) return [checkArticles] for k =1 to len( haiku$) if ( mid$( haiku$, k, 3) =" a ") and ( instr( "aeiou", mid$( haiku$, k+3, 1)) <>0) then haiku$ =left$( haiku$, k +1) +"n" +mid$( haiku$, ( k +2)) end if if ( mid$( haiku$, k, 4) =" an ") and ( instr( "aeiou", mid$( haiku$, k+4, 1)) =0) then haiku$ =left$( haiku$, k +1) +mid$( haiku$, ( k +3)) end if next k return [checkCapitals] for k =1 to len( haiku$) if k =3 then haiku$ =left$( haiku$, 2) +upper$( mid$( haiku$, 3, 1)) +mid$( haiku$, 4) end if if mid$( haiku$, k, 1) =chr$( 13) then haiku$ =left$( haiku$, k +4) +upper$( mid$( haiku$, k +5, 1)) +mid$( haiku$, k +6) end if next k return [quit] close #w end