Send the link below via email or IMCopy
Present to your audienceStart remote presentation
- Invited audience members will follow you as you navigate and present
- People invited to a presentation do not need a Prezi account
- This link expires 10 minutes after you close the presentation
- A maximum of 30 users can follow your presentation
- Learn more about this feature in our knowledge base article
Compsci 3.1 - Abstraction & Brick Wall
Transcript of Compsci 3.1 - Abstraction & Brick Wall
I. Do Now 
II. Notes - Abstraction 
III. This Week's Challenge 
IV. Build a Brick 
V. Wrap-Up 
Aim & Challenge
1) Sit in the center
2) Take out paper
III. This Week's Challenge
As a computer science student, you will be studying, using, and creating the step-by-step procedures that a program will follow in order to reach a goal.
A program can only follow the specific procedures that you give it!
: informal scripted algorithms that help programmers to conceptualize the way that they will solve a problem or reach a goal.
1) Using a tape-measure to determine the volume of your locker
2) Determine the length of a third, unknown side length in a right triangle
3) Using Google Maps to find directions to a museum
What goal? What algorithm?
What user? What computer?
Model - "Turn Off the Lights Algorithm"
User = the class
Goal = turn off one set of lights
Computer = Mr. Eiben
Algorithm = ?
Work with a partner to answer the following questions:
1) What does a brick wall look like? Feel free to draw a sketch!
2) What materials would you need to build a brick wall?
3) Explain, step by step, how you would build a brick wall that has 6 bricks per row and is four rows high.
Pick a neighbor, and swap to see their Draw a Square program. Take 3 minutes to discuss:
Shout-Outs, Questions & Prep for Next Class
Black - copy this
Blue - paraphrase
Red - no need to copy
1) Google Classroom
2) Snap! Registration
3) Snap! Basics
- Scripting Area
- Sprite Corral
This Week's Challenge:
1) Similarities and differences
2) Difficulties and questions
3) How could you make your project more interesting?
1) The "go to (0)x and (0)y" block [motion]
2) The "turn (0) degrees" block [motion]
3) The "clear" block [pen]
**Check out the Control panel if you are feeling adventurous!***
3) On your paper, write as detailed as possible an explanation for what happens when you interact with your lock to open your locker.
** Explain as many of the steps and what physically happens in each step**
So far we have...
1) Experimented with common motion, looks, and pen blocks
2) found ways to start stacks of code
3) tried a few basic ways to repeat or control the flow of our code
Today we will...
1) Learn how to change, add, or draw costumes for sprites/stages
2) Learn how to control the direction a sprite can face
3) Finish the Week 1 Challenge
V. Challenge Lab
Step 1) Create a custom block called "Build Brick" that uses the pen palette to draw uniform bricks on the stage.
VI. Turn in Weekly Challenge
1) Go to Google Classroom
2) Open the shared "challenge reflection" document
3) Answer the questions
4) Copy & paste the URL of your saved project
VII. Gallery Walk
1) Make sure your project is open and visible on the screen. Make it start when the green flag is pressed!
2) You will have 15 minutes to browse the room to see other student projects
3) At the end of this time, you will get to vote for your 3 favorite
Unit 3 Week 1 Challenge:
The Cha-Cha Slide
If _____, then _____
If you are bit by a snake with diamond markings, then you should go to a hospital immediately!
If you did not share your Unit 1 project, then you should share it as soon as possible before grades are updated!
If on edge bounce.
What do the red phrases have in common?
Takes two possible values: 0, and 1
If (3 - 2 = 1) then say "Hello!"
If (6 / 2 = 1) then say "I will never say this!"
Can combine multiple Boolean values
(4 = 4) AND (4 - 1 = 3)
(1) AND (0)
(4 = 4) OR (4 - 1 = 1)
Nested Conditional Logic
Ask - "What's the 1st letter of your first name?"
If answer = "F"
Ask - "Is your first name Frank?"
If answer = "yes"
Say - "Hi, Frank!"
Say - "Oh, I was looking for Frank."
We are going to build a script that will build a brick wall of a specific height and shape. We will make use of abstraction so that we do not need to write new blocks of code for each individual piece of the wall.
- "belong" to the script they are defined in
- can only be accessed within their stack of blocks
- are defined outside of the script and live in the variables palette
- can be accessed by any stack of blocks
In this song, there is a set of moves that dancers do in a pre-determined order, but some of the moves happen more or less frequently throughout the song.
If we were to re-create this in Snap!, it would be tedious to drag out, or even duplicate, each of the moves and specify how many times each move should happen.
Wouldn't it be nice if we could save a block with all of the basic moves, that would let us specify how many times to do each move?
Guess My Number:
1) Approaching a Problem
When the green flag is pressed, a sprite has selected a random number between 1 and 100. The sprite asks the user to guess a number in this range. If the guess matches the sprite’s number, it congratulates the user on their guess. If the number is not correct, the sprite tells the user to guess again, giving a hint for whether they should guess a higher or lower number. This continues until the user has guessed the correct number.
Break the end goal into steps - what will need to happen to make this a success? (pseudocode!)
3) What was the outcome of your attempts so far, and what type of outcome are you hoping to see instead?
Example: I completed the first three steps of my program, so the computer has guessed a number and the user has responded “yes”, “higher”, or “lower”
Example: I am trying to get the program to guess a new number based on the user’s response. I tried to make it so that when the user says “lower” the program guesses half of the last guess
Example: When the computer guesses half the last guess, the program just ends, it doesn’t let the user respond again.
1) What is your program trying to accomplish, and what steps have you completed so far?
2) What step are you stuck on, and what did you already try in order to complete this step?
Animate the movement
This week's challenge is to make a basic clone of a Mario game - the sprite should look like a plumber and should be able to jump and move around on a screen with a platform.
What should this movement look like, as far as the sprite is concerned?
Demo - Sprites for platforms and floors
On your notes...
- Careful debugging (know what isn't working and where in your code the error is happening)
You don't need to share your combination...
- Random tries or guesses
- Out-of-order priorities (focus on key, basic functions before you try to add complex costumes or interactions)
Remember - your program will do EXACTLY what you tell it to. If it "isn't working", it is doing what you told it to do in the order you specified!
the process of separating ideas from specific instances of those ideas at work.
Imagine you have to make lunch for 10 people. Each one wants a different sandwich (a unique combination of white toast, wheat toast, ham, turkey, salami, American cheese, and Swiss cheese).
How to make the first sandwich:
1) Grab two slices of wheat bread
2) Take a plate, and put the bread on it
3) On one slice of bread, place one piece of Swiss cheese on it
4) Take three slices of ham and place them on top of the cheese that you just placed on the bread
5) Take the second slice of bread and put it on top of the rest of the sandwich
It would be a lot of work to write this type of script for all 10 sandwiches!
Wouldn't it be nice if we could just write "Make a ham and Swiss sandwich on wheat" and be done with the code?
It would be even better if we could write a "Make a _____(meat) and _____(cheese) sandwich on _____(bread)" block and just insert the ingredients!
1) Make a (ham) and (swiss) sandwich on (wheat)
2) Make a (ham) and (swiss) sandwich on (white)
3) Make a (ham) and (american) sandwich on (wheat)
4) Make a (ham) and (american) sandwich on (white)
5) Make a (turkey) and (swiss) sandwich on (wheat)
6) Make a (turkey) and (swiss) sandwich on (white)
7) Make a (turkey) and (american) sandwich on (wheat)
8) Make a (turkey) and (american) sandwich on (white)
9) Make a (salami) and (swiss) sandwich on (white)
10) Make a (salami) and (swiss) sandwich on (wheat)
Benefits: These instructions are easier to read (they look more like regular English), and they are much more concise (10 vs. 50 lines)
Abstraction allows you to focus on fewer ideas at one time, rather than on the specific, individual operations happening behind the scenes.
How are these Snap blocks already examples of abstraction?
Imagine that you are driving a car - in what ways are the controls of a car an example of abstraction?
"If on edge, bounce"
"Pick random (__) to (__)"
"Glide to X: (__) Y: (__)"
- Control the pen size and color with pen blocks
- Make your pen have flat ends by clicking "flat line ends" under the gear button in Snap.
Step 2) Create a custom block called "Build Row A" that uses "Build Brick" to make a row of six bricks.