My Scratch Stuff

Scratch Lab #4

This is our fourth scratch lab. In this lab we started off with another partner project, and then proceeded to do three of five assignments. Once again I was able to do all five.

Pair Programming

In this pair programming assignment, we had to create a rocket that goes up or down depending on it's current speed, controlled by a speed up and a speed down button. In order to achieve this we had to use our newfound knowledge of variables.

Pair Programming assignment #4

Problem #1: Quick Costume Change

In this problem, we expanded on our knowledge of animations in scratch and combined it with variables in order to create a controllable speed for the rate of costume changes.

Quick Costume Change

Problem #2: A.I.

This problem made us create a mimic of an A.I. that asks questions and uses the answers in a conversation. This program was the first one to require heavy use of variables.

A.I.

Problem #3: Distance Formula

Due to the math related nature of this problem, it was pretty intimidating at first. However, it ended up being pretty simple. All the program does is use the built in math operator blocks in scratch to recreate the distance formula.

Distance Formula

Problem #4: Pump up the volume

In this problem, I decided to use variables to achieve my goal rather than use the built in volume function. It ended up being less compact than if I had decided to use the volume function however.

Pump up the volume

Problem #5: Metric Coverter

This problem took me a while to come up with the logistics of it. At first I tried to define all of the units at once, but then I realized that I only needed to convert the smallest unit, which could then convert into larger units if needed.

Metric Converter

Questions for Scratch Lab 4

Question #1: Are variables in computer programming the same as variables in math class? Why or why not?

Variables in programming are not the same as in math. Variables in programming are used to store values and values are entered into them. They are always known and never found or solved for like it is in math.

Question #2

When creating a variable, what are the two types of scope a variable can have? That is, what can it affect. (Think about your options as you make a variable)

A variable can either apply to all sprites or only one sprite.

Question #3:

How many values can a variable store at one time?

A variable can only store one variable at a time.

Question #4: What will the following code snippet do?

What will the following code snippet do? Explain why it doesn’t work as intended.

The code will switch value 1 to value 2 and value 2 to value 1. The intent is to switch the values but variables can only store one value, so the program will always come out with both numbers being equal to value 2.

Question #5

Given the following code snippet, explain what is happening.

There are three variables, value 1, value 2, and a temporary value. It sets value 1 to temp in order to save it, then it switches value 1 to value 2, then it switches value 2 with temp. The end result is that value 1 and value 2 are truly switched.