0

haiku generator. A program that pulls randomly from an array of one and two syllable and put them into a new haiku poem following the syllable from 5-7-5

Using Microsoft Small Basic.

  • I tried this ....Name[1]= "An old silent pond" Name[2]= "A frog jumps into the pond" Name[3]= "splash! Silence again" Name[4]= "Autumn moonlight" Name[5]= "Hunter Beauchamp" Name[6]= "a worm digs silently" Name[7]= "into the chestnut" Name[8]= "Lightning flash" Name[9]= "what I thought were faces" Name[10]= "are plumes of pampas grass" – user6233180 Dec 05 '16 at 19:48
  • tot=10 TextWindow.WriteLine("array:") For a = 1 To 10 i = Math.GetRandomNumber(tot) TextWindow.WriteLine(a+": "+name[i]) If a < 10 then remainder = Math.Remainder(a, 2) If (remainder =0) Then TextWindow.Write(Text.GetCharacter(10)+"array:"+Text.GetCharacter(10)) EndIf EndIf If tot > i Then For b = i To tot-1 name[b]=Name[b+1] EndFor EndIf tot=tot-1 endfor – user6233180 Dec 05 '16 at 19:49
  • Could you please put it into code form? – Matthew Dec 06 '16 at 14:46
  • Stack Overflow isn’t a website to have your homework completed for you. – Martin Bean Dec 06 '16 at 16:25
  • Unforshuntly I don't know how to put it into code... soryy Matthew I'm new here. – user6233180 Dec 07 '16 at 16:06
  • Mr. Martin Bean I add my solution I just asked about the problem. – user6233180 Dec 07 '16 at 16:08

1 Answers1

0

The idea behind the solution, i i may, is to make a 3 dimension array.

array["syllables"][1][1] = "red"
array["syllables"][1][2] = "Cat"
array["syllables"][1][3] = "The"

array["syllables"][2][1] = "reading"

and keep going with as many words as you like. then create 3 while loops the first, while the number of syllables in not greater than 5 keep adding words, using the 2nd array dimension as an adder. so get random number that is not greater than the number of syllables possible for the rule. Once you have a random word. add that syllable to a number holder and make the while loop number you are at < total syllables.

in the second not greater than 7 and 3rd not greater than 5.

Hope that helps.

Matthew
  • 157
  • 1
  • 9