Beginner Coding with Blocks
Chapter
>
Level
Math and Text Operations
Add and Subtract
Objective
Collect eggs and balance the books by adding and subtracting their quantities.
It's time to collect some eggs in the nesting grounds, walk over and grab the various eggs in the field so we can document how many eggs were laid. Of all the eggs laid there are four (4) eggs that are no good, red eggs however hold twice the nutrition as regular eggs. Document how many good eggs you have, and what their nutritional value is.
First walk over all the eggs to collect them, then make three (3) variables for each type of egg: white_eggs, dark_eggs, red_eggs. Use the set block to create these variables and set them to the amount of eggs you've gathered of each type.
Once you've collected everything, walk to the dark X marks and document all the eggs that are good from this batch. Use the speak block to announce the number by using math blocks to add (+) together the three variables you created and subtract (-) the number of eggs that are bad from this batch (4 bad eggs total).
After you're done documenting the amount of eggs you have this batch, head for the light X mark and check what the nutritional value is of each egg. First you need to update the variables by subtracting the bad eggs: there are two (2) bad white eggs, one (1) bad dark egg, one (1) bad red egg. Use the set block with math blocks to subtract these values from each variable.
Next, multiply the red_eggs by two (2) because their nutritional value is double. Use the set block with a math block to multiply red_eggs by 2. Then use the speak block at the X mark and use math blocks to add (+) together all the variables with their new values to complete the level.