Tuesday, 20 November 2012

Using variables in Scratch: Math and Language Arts Integration

In today's grade 7 class, we looked at creating variables in Scratch and it provided some interesting challenges for the students that really got them thinking.

In the first part of the lesson, I introduced the idea of an random walk. First, it was just going in two directions. A student stood in the middle of the room and each time a classmate flipped a coin, the student would move either forwards (heads) or backwards (tails). Then, they were asked to figure out how to program this into Scratch. When the first couple of groups had worked it out, i asked them to have the sprite move in 4 directions based on a random number. Here's the solution:

a random walk in two directions

So, we looked at how, with the heads/tails random walk, the sprite has a 50% chance of heading in either direction. In the 4 direction version, they had a 25% chance of going in any particular direction. So then, I posed the question, "How would you modify this program so that your sprite can go in any direction, but has more of a tendency to move down and to the right?"

So this time, instead of generating a random number between 1 and 4, it could generate a number between 1 and 6. In this case, perhaps 1 means up, 2 means right, 3 and 4 mean down and 5 and 6 mean left. Then, I asked the kids to work out the percentages. After this, I let them play for a while, and there were some surprising results as they added their own touches, through in a little more randomness for how far the sprite would move on each turn, the colour and so on.

Next, I had the students create a simple Madlib using the same thinking process. The program would ask for a 'noun', a 'verb' and an 'ing-adjective'. One step at a time, the program will ask for user input, then that response will get put into a variable. Here is the solution:

this code is associated with the background in my example

I had another sprite speak the lines although I'm sure there are other ways to do this..

The kids already started discussing how they could use this to make all sorts of different projects such as quiz games and so on.  Conveniently, they are learning parts of speech in English class and percentages in math (totally unplanned) so hopefully, I will be able to get another teacher in on this one.

No comments:

Post a Comment