-- Manual on how it works -- Odd = words, Even = syllables property nouns : {"grass", "1", "flower", "2", "willow", "2", "leaf", "1", "mountain", "2"} -- sets nouns and syllables property verbs : {"moves", "1", "sways", "1", "is growing", "3"} -- sets verbs and syllables property adv : {"in the wind", "3", "slowly", "2", "well", "1", "in the soil", "3", "very quickly", "4", "", "0"} -- sets adverbs/prepositions and syllables property adj : {"cool", "1", "green", "1", "pretty", "2", "amazing", "3", "beautiful", "3", "lovely", "2", "colourful", "3", "turquoise", "2", "", "0"} -- sets adjectives display dialog makehaiku1() & return & makehaiku2() & return & makehaiku3() buttons {"OK"} default button 1 with icon 1 -- displays a window with the haiku using the subroutines makehaiku1(), makehaiku2(), and makehaiku3() with an "OK" button on makehaiku1() -- when makehaiku1() is used repeat set x to random number from 1 to (number of items in nouns) -- set x to a random number of an item in the nouns if (x mod 2) is 0 then -- if x is even set x to x - 1 -- subtract one to make it odd end if set y to random number from 1 to (number of items in adj) -- set y to a random number of an item in the adjectives if (y mod 2) is 0 then -- if y is even set y to y - 1 -- subtract one to make it odd end if set haiku1 to "The " & item x of nouns & " is " & item y of adj -- make the first line "The (noun) is (adjective)" if (2 + (item (x + 1) of nouns) + (item (y + 1) of adj) = 5) then -- if the first line has 5 syllables exit repeat -- exit the repeat end if end repeat return haiku1 -- give the window the first line end makehaiku1 on makehaiku2() -- when makehaiku2() is used repeat set y to random number from 1 to (number of items in verbs) -- set y to a random item number in the verbs if (y mod 2) is 0 then -- is y is even set y to y - 1 -- subtract one from y to make it odd end if set z to random number from 1 to (number of items in adv) -- set z to a random item number in the adverbs/prepositions if (z mod 2) is 0 then -- if z is even set z to z - 1 -- subtract one from y to make it odd end if set haiku2 to "It " & item y of verbs & " " & item z of adv -- make the second line "It (verb) (adv)" if (1 + (item (y + 1) of verbs) + (item (z + 1) of adv)) = 7 then -- if the second line has 7 syllables exit repeat -- exit the repeat end if end repeat return haiku2 -- give the window the second line end makehaiku2 on makehaiku3() -- when makehaiku3() is used repeat set x to random number from 1 to (number of items in adj) -- set x to a random item number in the adjectives if (x mod 2) is 0 then -- if z is even set x to x - 1 -- subract one from x to make it odd end if set haiku3 to "It is " & item x of adj -- make the third line "It is (adjective)" if (2 + (item (x + 1) of adj) = 5) then -- if the third line has 5 syllables exit repeat -- exit the repeat end if end repeat return haiku3 -- give the window the third line end makehaiku3