Learning to program with Alice

Meet Alice! Alice is an incredibly fun program that has been made freely available as a public service by Carnegie Melon University.

The great part about Alice is that you'll start learning the basics of computer programming without even knowing it! Just have fun exploring and creating your own virtual world!

Getting Started

You can freely download the Alice program from http://alice.org/, but it's quite large (over 100Mb) so if you're in a class then you may want to check whether someone else has already downloaded it!

Once it's downloaded, unzip the file into a location on your computer (such as the C:\Temp). Now if you look inside the Alice folder that's been created for you (ie. C:\Temp\Alice) you'll see a file called Alice.exe - just double-click on it to get started!

Tutorial 1: Ice skater

When Alice loads up, click on the big "Start the Tutorial" button and you'll be taken step-by-step through a fun activity... just watch that skater dance!

Activity 1: After finishing the first tutorial, see if you can get your ice-skater to skate out a square!

Tutorial 2: Crushing the phone

You might want to take a break or go on directly to the second tutorial.

Activity 2: When you finish the second tutorial, come back to tutorial 1 (the Ice Skater), and have a go at adding a new method for the skater called Do Square. Whenever your skater's Do Square method is called, she should do exactly that!

Now might be a good time to think a bit about what you've learned so far. If you keep a blog for your own thoughts/learning/fun, why not take 5mins now to summarise what you've learned so far, then ask someone you know to comment on your blog with some feedback!

Tutorial 3: A sing-a-long

After completing tutorial 3, you're ready to create your first computer game! Can you believe it?!

Activity 3: Come back again to tutorial 1 (the Ice Skater), and try adding some events so that when you press the arrow keys your skater skates in that direction. You could even add the spacebar as a jump button!

Hint: You might need to create two new methods: Turn Left and Turn Right.

Make sure you save your Ice Skater example world in your own folder as we'll build on this later.

Tutorial 4: Creating your own Beach scene

The fourth tutorial will show you how you can create your own scenes, using all the great 3D models that come for free with Alice!

Activity 4: When you finish this tutorial, you'll be ready to start your own project! Start creating your own world and having a look at all the different available objects!

Activity 5: Learning about Variables

Opening up your own Ice Skater example world again:

We're going to get our ice skater to remember how many times she's jumped during her performance! But to do this, we'll first need to create a variable. Just think of a variable as a container where you can store things.

Next we need to make sure that whenever our Ice Skater jumps, she adds 1 to our variable howmanyjumps:

Try running your world again... notice any difference?

That's right, it doesn't seem any different yet! Even though our new bit of code is working, we haven't done anything to help us see what's going on! To do so, we'll need to use an if statement!

Activity 6: Using IF-Statements in ALICE

If-statements are one of the most useful tools of computer programmers, as they allow your programs to make decisions!

We're going to modify our IceSkaters Jump method so that if she's jumped twice already, the next time we press the space bar she'll just say "I'm too tired to jump anymore!".

Here's the steps:

Now, we want to do something special when our IceSkater has jumped twice, ie. when our howmanyjumps variable is equal to 2. To make this happen:

At this point, you'll notice that your If statement says:

 If howmanyjumps == 2 then 
    Do Nothing, 
 Else 
    Do Nothing 

We can now choose what we will do when she's jumped twice, and what she'll do otherwise:

Now test your program! You should find that your IceSkater will jump twice, but after that will tell you she's too tired.

Practice: To practice creating variables and using IF statements, we're going to modify our program so that our IceSkater gets dizzy if she spins too much! Here's some tips to get started:

Test to make sure it works and get someone else to take a look at your work!

Activity 7: Using While-loops in ALICE

To be completed.

A design project

Now the fun begins... Let your imagination run wild and create your own interactive world!

Your situation is this: A recruiter at KidzWorks - a company that designs interactive computer experiences for toddlers - has heard some good reports about your creative abilities with computers (through your facilitator of course!). Her name is Janet and she's keen to see your creative flair in action. Janet's asked you to build a small interactive environment for 3-5 year olds. Here's what Janet's written:

Hi! Thanks for taking up this challenge! I hope it will be a rewarding experience for you too! Basically, we're keen to create small interactive worlds that young kids can play with - similar to the singing penguins that you should have already seen when you were learning Alice, but something of your own! Feel free to be creative, but be careful not to make your project too complicated... You might choose an activity that helps with counting or spelling or another idea of your own!

1. Deciding on your activity

The first decision you'll need make is how your users (remember, they're 3-5 years old!) will interact with your world. Most of our environments simply involve the user clicking on different objects - but don't let that restrict you! The objects can make sounds when clicked on, or change colour, or disappear... that's up to you. You may want to run your idea past your classmates or facilitator to get additional ideas too.

2. Designing your world

You'll then need to create your world, importing and arranging the 3D objects that will decorate your world! Note, you can grab lots of pre-designed objects from the Alice Gallery online

3. Creating your interaction

Once your world is ready you can begin adding interaction through mouse or keyboard events. You can have objects that change or make noises when your users click on them, or you might allow your users to control the movement of an object using the keyboard or mouse.

4. Creating your introduction

It's useful for your users to see what your world is about when it first starts - just like the brief song of the singing penguins in the third tutorial that helps you to see that the penguins each sing a note! Design and create a brief animated introduction (10-30secs) for your own world that is played whenever your world first starts. This intro should help your users see how they can interact with your world.

Checklist

Once your world is finished, you should find that you have:

In addition, you should have also

If you were really tricky, you may have also

I hope you enjoy creating your first interactive world, and if we like what we see, we might have a development position becoming available at Kidzworks shortly!

- Janet.

This article is issued from Wikiversity - version of the Monday, February 29, 2016. The text is available under the Creative Commons Attribution/Share Alike but additional terms may apply for the media files.