Editors Note...
In 1997, millions of little digital computers costing less than $20 were purchased
by children around the world. These virtual pets wets were connected to key
chains and know as Giga-Pets, Nano-pets, Tamagotchis and variations on the
terms digital, personal, virtual or pet. Kids fell in love with controlling
and caring for these pets. The predictable response of most schools was to
ban them. (There seems to be a causal relationship between things kids love
and things school bans. Remember what a terrible threat POGS or baseball cards
posed to contemporary education?)
Thoughtful educators realized that these digital pets provided children with
a personal connection to systems thinking, senses, emotions, artificial life,
computer science, cybernetics, probability, elapsed time, human development
and other complex concepts. While most schools were prohibiting these pets, Logo
teachers around the world were independently developing Logo-based activities
which used digital pets as a powerful motivational force for learning. Adam
Smith, an Australian educator and software developer (www.schoolkit.com) devised
a simple set of starter procedures for creating a digital pet. The project
introduces buttons and text boxes. Students with little MicroWorlds programming
experience may successfully create a digital pet and add their own personality
traits to their creature.
Download a
demo copy of MicroWorlds Pro at www.microworlds.com
Ive added a few extension ideas to what Adam created.
What is a Personal Pet?
Your Personal Pet can be anything you would like it to be, a dog, a horse
or
something imaginary. (You may simulate all sorts of natural systems this way.
Recent Logo Exchange Teacher Feature, Josie Hopkins students made Tamaseedis
- virtual plants to care for.)
Say 'Hi' to Stroops, my
Personal Pet!
Caring for Your Personal Pet
Like all pets, Stroops has needs and feelings. When you adopt your pet,
it will get hungry, so you will need to feed it. To keep it happy, you will
need to hug it regularly.
Once you have adopted a pet you may like to add more characteristics. For example,
you might like to have your pet become lonely unless you play games with it.
Adopting Your Personal Pet
To adopt a Personal Pet you need to 'bring it to life' by writing a MicroWorlds
program.
As you work on your pet, be sure to save your project regularly.
Draw a New Pet
Use the Shapes Center to change the shape of your turtle into a picture
of a Personal Pet. You may want to draw your own shape, or use one of the shapes
provided. When you are done creating your new shape, put that shape on the
turtle. Your screen should now look something like this:
Add Text Boxes
Put 3 text boxes on the screen so that you can see what the pet is thinking
and feeling. Name the text box objects:
hunger
This text box will display a number to show how hungry your pet is.
happiness
This text box will display a number to show how happy your pet is.
message
The pet may use this text box to display messages.
Your screen should now look something like this:
Add Buttons
Put three buttons on the screen so that you can interact with the pet.
Each button should be set to ONCE. Name the button objects:
live
This button will start the Personal Pet program.
feed
Click on this button to feed the Personal Pet so that it is not hungry.
hug
Click on this button to hug the Personal Pet to make it happy.
Your screen should now look something like this:
Enter the Procedures
Now it is time to program the Personal Pet. On the Procedures Page enter
the procedures written below.
MicroWorlds text boxes may be used as visual variables. They display their
values constantly and may changed and operated upon under program control.
A text box, HUNGER, has a corresponding one-input command, SETHUNGER,
designed to change its contents.
We will use the SETUP procedure to set starting values. For example, the Personal
Pet begins with a Hunger level of 20.
to setup
message, ct
sethunger 20
end
In HOUR we will put everything we want to happen each time a pet hour passes.
For example, each hour the Personal Pet becomes a little hungrier.
to hour
message, ct
sethunger hunger + 1
if hunger > 40 [announce [I died from hunger!] stopall]
end
When you click on the FEED button, the Personal Pet becomes less hungry.
to feed
if hunger > 4 [sethunger hunger - 5]
end
The LIVE procedure watches the time, making sure the HOUR procedure is run
each pet hour.
Question: Why do pet hours go by so quickly?
Answer: For the purposes of debugging, testing and program design you
dont want to wait three days to determine if your program works correctly.
Therefore, well speed up time. Once your program works to
your satisfaction, you might wish to change the hour to take longer than the
6 seconds specified in the LIVE procedure.
to live
setup
forever [if timer > 60 [resett HOUR]]
end
Test the Procedures
Now go back to the main MicroWorlds page to test the Personal Pet. Try
the following:
- Click on the LIVE button. The Hunger level of your
pet should go up slowly.
- Click on the FEED button. With food the Hunger
level should go down.
- Dont feed the pet. Eventually it should die
from hunger.
Read through the program a few times, making sure you understand
how it works.
Add to the Procedures
With the basic program working, it is time to extend the program. Go to the
Procedures Page and add to the procedures in the ways detailed below.
Lets add Happiness to the pet. In the SETUP procedure, add the line shown
here in italics.
to setup
message, ct
sethunger 20
sethappiness 10
end
The values set in SETUP were chosen arbitrarily based on their ability to make
the simulation run well. The number (40) used to check the hunger of the pet
in the HOUR procedure may be is also arbitrary. If you dont like the
way the virtual pet behaves, feel free to adjust the values set in SETUP or
HOUR.
Each HOUR, without hugs, the pet gets lonely and a little less happy. Add the
line in italics.
to hour
message, ct
sethunger hunger + 1
if hunger > 40 [announce [ I died from hunger!] stopall]
sethappiness happiness - 1
end
Notice that we represent getting unhappy by subtracting 1 from the happiness
variable. We need to be able to hug the Personal Pet to keep it happy. Add
this procedure.
to hug
sethappiness happiness + 5
end
Check and Extend
Now go back to the main page to test the Personal Pet. When you are sure
it is working properly, you could add another characteristic such as education
or fitness. You may also add a sound to the live, feed or hug buttons to provide
aural feedback for your actions. Alarm sounds might be added to alert the user
to unhappiness or starvation.
Since the HOUR procedure checks the condition of the pet, you should put new
conditionals there. Checking for an unhappy little critter might look something
like this. The new lines are in italics.
to hour
message, ct
sethunger hunger + 1
sethappiness happiness - 1
if hunger > 40 [announce [Your pet died of starvation!] stop]
if happiness < 1 [announce [Your pet died from lonliness!] stopall]
if happiness < 5 [announce [Nobody loves me!] stop]
if happiness < 7 [announce [Im bored!] stop]
end
Add to the Procedures
In life, all sorts of unforseen crises or blessings may surprise us. Sometimes,
things might happen which will affect your Personal Pet. Add this procedure:
to event
run pick
[
[ announce [Its my birthday. Lots of fun.] sethappiness happiness + 20]
[ announce [I fell over and hurt myself.] sethappiness happiness - 10]
]
end
The EVENT procedure picks a list of instructions randomly from a larger list
and then runs that instruction.
We need an EVENT to happen randomly. In the HOUR procedure add the line in
italics. This change makes the EVENT procedure run based on a probability of
1 out of 12 times.
to hour
message, ct
sethunger hunger + 1
sethappiness happiness - 1
if 1 = random 12 [event]
if hunger > 40 [announce [Your pet died of starvation!] stop]
if happiness < 1 [announce [Your pet died from lonliness!] stopall]
if happiness < 5 [announce [Nobody loves me!] stop]
if happiness < 7 [announce [Im bored!] stop]
end
Check and Extend
Now its time to test the procedures again. Occasionally, your pet
should announce a special event.
When you are sure the program is working properly, you might want to add some
more events of your own into the EVENT procedure. Perhaps your pet can get
ill or learn.
An Active Pet!
You now have a basic Personal Pet. There are a number of ways you can
make your pet more interesting and active. If you are looking for ideas,
think about all of the things a real pet does.
Link Characteristics and Events
Add more characteristics and more events and link them together. For
example, you could make it rain occasionally. If the pet is not inside some
shelter, it could get cold and unhappy, or even sick.
Animation
Add animation to show such things as your pet eating its food or going for
a walk.
Grow-up
Design different shapes representing your pet as a baby, child, teenager and
adult. Keep track of the number of years (some combination of elapsed pet
hours). At a particular age, use SETSH to change the appearance of the
pet. This will give the appearance of growing-up! You can even use some variation
of SETSIZE SIZE + 1 in the intervening years to cause the pet to grow while
aging.
Games
Invent a game that you can play with your pet.
Send Your Virtual Pets Out to Stud!
Please share the virtual pets created by you and your students with Logo
Exchange. We will publish cool programs and screen shots in future issues. Logo
Exchange would be happy to publish some of these pets on our web server
too. Send projects and screen shots to logoexchange@stager.org.
About the author
Adam Smith is well known as a veteran classroom teacher, administrator and
Logo user across Australia. He recently created the Windows-based software
package, Schoolkit, an expanding library of creative activities designed
to help teachers and students use open-ended software tools like MicroWorlds
and Microsoft Office. A special free sample version of Schoolkit is
available to Logo Exchange readers at http://www.stager.org/schoolkit.
Adam may be reached at http://www.schoolkit.com/.
MicroWorlds is a registered trademark of Logo
Computer Systems, Inc.
|