Lab 8 Write Up

Name: Zak "The Legend" Singh

Period: 7

Assignment:Scratch Lab #8

Lab Overview

Problem 1A

For problem 1A, we had to make blocks for "TurnRight" "TurnLeft" "moveForwards" "moveBackwards" for the Finch. We also had to make a "Finch Left Obstacle" and "Finch Right Obstacle" boolean value.

Problem 2

For problem 2, we had to create a calculator that could perform the four basic operations of addition, multiplication, subtraction, and division.

My Solution

Problem 1A Solution

For Problem 1A, we made defined our blocks as moving the wheels the proper amount to turn or move the amount necessary. The Finch would then check if it was blocked on either side and then set a variable to the corresponding value. We then checked for the value of the variable, and depending on what it is, the Finch would move to avoid the obstacle.

Problem 1B

For Problem 1B, we first made the Finch move in a square using our previous blocks we defined before. For the next question, we used the finch orientation to detect when the beak was down. It would then say "my beak is down". We got the Finch to back away from obstacles using the light sensors on the Finch.

Problem 2 Solution

To make the calculator, we first defined the 4 operations the calculator can perform (addition, subtraction, multiplication, divison). We then made 4 spries, one for each operation, as buttons. We used variables that would change depending on your input for the two starting numbers and the answer. Depending on what operation was selected.

Problem 2