Lab 3.4 - If My Calculations Are Correct¶
In this lab, you will write custom reporter
and predicate
blocks to perform several useful calculations and computations.
Simple Computations¶
Write a custom Snap!
reporter
block calledmin
that determines which of two numbers is smaller and reports that value. If the two numbers are equal, report either one.Write a custom Snap!
reporter
block calledmax
that determines which of two numbers is larger and reports that value. If the two numbers are equal, report either one.Write a custom Snap!
predicate
block calledbetween
that determines if a number is between two other numbers. If the first number is equal to either of the other two numbers or is between them, the block should report “true”.Write a custom Snap!
predicate
calledat least as long as
that determines whether a word has at least a specified number of letters.
Bonus: Stepping Things Up¶
Write a custom Snap! reporter
block called distance to
that computes and reports the distance from a sprite’s position to another point. Use the x position
and y position
blocks to determine the sprite’s position. Remember that the formula for the distance between points (x1, y1)
and (x2, y2)
is sqrt((y2-y1)^2+(x2-x1)^2)
.
Grading Scheme/Rubric¶
Lab 3.4 Criteria |
Points |
---|---|
1.1 min |
0.5 |
1.2 max |
0.5 |
1.3 between |
0.5 |
1.4 at least as long as |
0.5 |
Bonus |
0.5 points |
PROJECT TOTAL |
2.0 points |