Unit 1: Introduction to Programming
Lab 1: Click Alonzo Game
1.1.4: Sprites and Costumes
The Alonzo character is named after Alonzo Church, a major contributor to early computer science. In this project, there are three objects related to Alonzo:
- One is a sprite, which is like an actor on the stage who knows how to do many different things, such as walk around the stage and speak the lines of the play.
- The other two are costumes, picture that can be "worn" by a sprite.
1.1.4
The transparency of an image is how much you can see what's behind it. For example, here is the Alonzo sprite shown with three different transparencies (which have been set using the ghost effect
block).
Lab 2: Gossip
1.2.3:
Lists,
Strings, and
Concatenation
AAP-1.C.1 first sentence
-
What does "ordered" mean?
It doesn't mean that the items have to appear in alphabetical
or numeric order. It just means that
is a different list from
.
A list is an ordered sequence of items. You've seen this example:
AAP-2.D.1, AAP-2.D.2
- The items of this list are strings. A string is a sequence of characters (letters, digits, punctuation, etc.). A substring is just a piece of some existing string. For example, "Hanna," "anna", and "nnah" are each substrings of the string "Hannah." (The empty string as well as the original string are both also substrings.)
- To concatenate strings means to make a bigger string by connecting two or more smaller strings. In Snap!, the block lets you concatenate strings.
1.2.3
The process of testing, finding problems, and fixing them is called debugging.
1.2.4:
Procedures,
Reporters, and
Commands
AAP-3.A.1, AAP-3.A.2
A procedure is a named sequence of instructions that may take inputs and may report a value. Some languages call procedures methods or functions. Here are two types of procedures you have seen in Snap!:
-
Reporters have an oval shape. They report a value.
-
Commands have a jigsaw puzzle shape. They tell the computer to do something without reporting a value.
1.2.5:
Expressions and
Values
AAP-2.B.3, AAP-2.B.4
- An expression is a either a constant value (such as "4" or "winter") or a call to a reporter block including its inputs (such as , , or ).
- Expressions are evaluated to produce a single value (a value can be a number, a string, a sprite, a costume, a script, a list—anything). For example, will be evaluated to 17.
Lab 3: Modern Art with Polygons
1.3.1: Algorithm and
Pseudocode
AAP-2.A.1, AAP-2.A.2, AAP-2.A.3
An algorithm is a sequence of steps that are usually performed by a computer. The algorithm doesn't have to be written in any particular programming language or even in a programming language at all; you can write your algorithm in English or any other human language. Some people call an algorithm written in human language pseudocode. Once you know the steps that the computer will take, you can code your algorithm in the programming language of your choice.
What's the purpose of "pseudocode"? Why write an algorithm vaguely in English when you could write it precisely in Snap!? If you were programming in a punctuation-heavy language, designing your program in pseudocode would help you focus on the important ideas instead of on details like quotation marks and semicolons. But pseudocode isn't as necessary with a language like Snap!, and pseudocode can make it easy for you to fall into wishful thinking about what the computer is capable of (such as writing "Pick tomorrow's winning lottery numbers" or "Here's the melody; write the harmony").
1.3.3: What's an input?
Parameter vs.
Argument
AAP-3.A.3
-
A parameter (or formal parameter) is the input name, such as number of branches. The input name is set in the block definition. It never changes.
-
An argument (or actual argument) is the input value, such as 6 for a hexagonal pinwheel. The input value is given each time the block is run; it can be a different value each time.
We use the word "input" both for parameters (input names) and for arguments (input values).
1.3.6:
Iteration
AAP-2.J.1
Computer scientists describe a repeating program structure as looping, repetition, or iteration.
AAP-2.K.1
The code can be repeated forever
, a specific number of times (such as when using repeat
), or until something specific happens (such as when using repeat until
as you'll see in Lab 5).
Lab 4: Protecting Your Privacy
1.4.1
IOC-2.A.1
Personally identifiable information (PII) is information that can let others figure out who you are and possibly get more information like your Social Security number, age, race, phone number(s), medical information, financial information, or biometric data (such as your thumbprint or face scan).
Lab 5: Follow the Leader
1.5.2
When a program keeps running forever, that's called an infinite loop.
1.5.2
CRD-2.B.2, AAP-2.B.2, AAP-2.B.6
A code segment is a sequence of connected instructions that carry out a purposeful action, such as the one pictured on the left, which animates a conversation. The instructions in the code segment are carried out in order, from top to bottom.