Scratch Lab 8

Name: Shreya Raj

Period: 8

Assignment: Lab #8

Finch Solution

1-A

This problem involved using the finch robots and blocks that came with the finch. To solve the different problems in part 1 I used the different blocks provided by the finch and I created blocks of my own. To have the finch move forward, I used a "Move Finch" block and set the left to 100 and the right to 100. Then to make the finch move backward I used the "Move Finch" block and set the right and left to -100. Then to make the finch move right I set the "Move Finch" block to left: 100 and right:55. Then to make the finch move left I used the same block but just switchwed the left and right amounts. Within my code I created different blocks such as moveForward and moveBackward to make my code a lot more organized.

1-B

For this part of the finch solution I also used the given finch blocks and blocks that I created. To make the finch go in a square, I just repeated the code move forward and move left 4 times. For the finch orientation I just had a forever loop go around "say Finch Orientation". To have the Finch detect an obstacle I used a forever loop and if-then conditoinal statement to say that if finch left obstacle or righ obstacle then to move bacwards, move left, and then move forward, to get out of the obstacles way. Then to have the finch move in a figure 8, I had th efinch move left 4 times, made the finch move forward, move right 4 times, and made it move forward and then repeated that code 2 times.

Solution Part 2 - Calculator

To make a calculator I had many sprites act like buttons and had them act as digits on a calculator. Then I created 4 variables, answer1 , answer2, next, and operation. For the number button sprites I set the code to when this sprite clicked if next=no then to set the answer1 variable to join answer1 with the ceratin number of the button you are clicking. If the next=yes then you would set the answer2 to join answer2 with the certain number of the button you are clicking. I put that code in for all the numbers on the calculator. Then for the operation I created blocks for add, subtract, multipluication, and division and gave all these blocks 2 parameters. I then set the answer1 to number 1 and answer 2 to number 2 in each one of the operations. Along with setting the variables to the parameters in each block I had a "say number1 (operation) number2".

My Project Link

Click HERE to return to homepage.