Skip to content

Latest commit

 

History

History
30 lines (19 loc) · 1.66 KB

File metadata and controls

30 lines (19 loc) · 1.66 KB

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

  1. Write a custom reporter block called min that determines which of two numbers is smaller and reports that value. If the two numbers are equal, report either one.

  2. Write a custom reporter block called max that determines which of two numbers is larger and reports that value. If the two numbers are equal, report either one.

  3. Write a custom predicate block called between 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".

  4. Write a custom predicate called at least as long as that determines whether a word has at least a specified number of letters.

  5. Save your project as Lab3.4.

Bonus: Stepping Things Up

Write a custom 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 rubric

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
Total 2.0