This page will help you think deeply about the Create Task instructions from the College Board.
Snap! has two convenient ways to share some or all of your code.
You can download a PNG image file of any block or script by right-clicking it (or control-clicking it on a mac) and selecting "script pic..." Look in your browser's Downloads folder for the image file.
You can download an HTML file of all of the blocks in your whole project as well as a picture of the stage by selecting "Export summary..." from the Snap! File menu (). The HTML file also land in your browser's Downloads folder. Open it (in a browser), right-click (or control-click on a mac) to copy the images you need, and paste them into the document where you are describing your code.
You've been creating algorithms and using abstraction all year. All you need to know for the AP test is how to call attention to and describe what you've done.
In Unit 1, you created an algorithm for drawing this pinwheel shape:
The shape consists of eight line segments, each the same length. The first segment is 100 steps long. To prepare for the next segment, the sprite backs up 70 steps along the first segment and turns 45 degrees to the right. Each new line segment follows the same pattern: move 100
, move -70
, turn 45
. It could be written using eight sets of those three blocks (as shown at right). That is the algorithm, but it's hard to read. For one thing, it's hard to tell whether all the blocks are there. Using repeat
makes the algorithm clearer, briefer, and easier to read. This is how the algorithm is now expressed:
The last step shown above, using repeat
to clarify the structure is also a simple example of abstraction. It hides a lot of repetitive detail and shows the structure better. This type of abstraction is not what the AP Create Task is looking for though.
You used another abstraction as well. The way you actually wrote the algorithm in Unit 1 recognized that the 45° turn was \frac{1}{8} of the total turning of 360°. So you wrote the algorithm this way:
Changing both eights to fives in that algorithm would create a pinwheel with 5 branches. Instead of changing the numbers each time you wanted a new pinwheel, you created a block that contained the algorithm and let you just input whatever number of branches you want:
This is the kind of example you need to show for the Create Task: a custom block used multiple times in your project. Loops are an example of abstraction, but the expectation for the Create Task is that you create and submit your own example of abstraction rather than just pointing out existing abstractions like loop blocks.
The abstraction of pinwheel
helps in three ways:
When you create a block and give it a name that describes its purpose, you are creating an abstraction. You are hiding the details and showing only the purpose. When you use that pinwheel block, it shows the structure of your program more clearly. Someone reading your program doesn't need to figure out what the details inside pinwheel
do; they can tell from the name that it makes a pinwheel with a given number of branches.
Note that while packing your entire program into a single block might the page cleaner, it is not a good example of abstraction. The best examples of abstraction to highlight for the AP are pieces of code that you use multiple times in your program and are clearer because they are packed into a well-named block. You can often use what's in that block as an example of the algorithm for the purpose that the block serves.