back to math cats love MicroWorlds
MicroWorlds index
Recipe Machine Overview
Go to the recipe machine project!
Get the MicroWorlds Web Player
so you can use the project

screenshot of recipe machine (inactive buttons)


To use this project, you need the free MicroWorlds Web Player, but you do not need to know anything about MicroWorlds.

This project uses eight hidden textboxes (see below) to store lists of words to be added to the recipes. The machine will randomly create a recipe of 3 - 6 instructions. For each instruction in the recipe, the machine chooses and displays one word at random from each of the first seven textboxes (plus a second word from "howmuch?," "adjectives," and "nouns," and inserts a few linking words to form complete sentences. At the end of each recipe it adds one random line from the "remarks" textbox. Click on "invent a recipe" to see a new recipe. You can add your own ingredients and remarks to the machine by clicking on "add_ingredients" to go to the hidden page. The words you add will only stay in the machine during one visit to the project, but you can go back and forth between the two pages, adding more ingredients or other words, as much as you want during one visit. (If you own MicroWorlds and set up this project, all of your extra ideas will stay as long as you like!)

screenshot of the page for adding ingredients and remarks
(it won't work until you go to the actual project)

If you own MicroWorlds and would like to make your own recipe machine from scratch, here are the procedures. Create textboxes and buttons as shown. (Name your pages "make_recipes" and "add_ingredients." The textbox on the recipe machine is called "text1" -- its name is hidden.)

* * * * *

Procedures for Recipe Machine:

to recipe!
recipename, hidetext
text1, ct
repeat 3 + random 3 [pr (se textpick "verbs textpick "howmuch? textpick "amounts "of textpick "adjectives textpick "nouns "with textpick "howmuch? textpick "amounts textpick "adjectives textpick "nouns "and textpick "how_to_cook "for textpick "howmuch? textpick "time ".]
insert textpick "remarks
opaque "recipename
recipename, ct pr (se item 5 parse text1 item 6 parse text1 "surprise)
transparent "recipename
recipename, showtext
end

to startup
recipename, hidetext
text1, ct
verbs, repeat 100 [cd]
howmuch?, repeat 100 [cd]
amounts, repeat 100 [cd]
adjectives, repeat 100 [cd]
nouns, repeat 100 [cd]
how_to_cook, repeat 100 [cd]
time, repeat 100 [cd]
remarks, repeat 100 [cd]
end

to invent
end

to a
end

[The startup procedure runs automatically when the project loads. It simply makes sure that the recipe machine is empty and that the last line of each textbox is showing on the "add_ingredients" page, to make it easier to add extra items to each box.

The two procedures, "invent" and "a," do not do anything! They are included just so that we can place a button called "Invent a Recipe!" next to the machine. The "recipe!" procedure is the one which actually creates the recipe.

"Recipename" refers to an invisible textbox which appears after a recipe is created, to give it a title (using the fifth and sixth words of the recipe plus the word "surprise."]

© copyright 2001 -   Wendy Petti of Math Cats.   All Rights Reserved.