Presentation is loading. Please wait.

Presentation is loading. Please wait.

 Make sure you are subscribed to announcements on Moodle.  Activity 5 will be due before the beginning of lab next week.  Check Moodle for complete.

Similar presentations


Presentation on theme: " Make sure you are subscribed to announcements on Moodle.  Activity 5 will be due before the beginning of lab next week.  Check Moodle for complete."— Presentation transcript:

1

2  Make sure you are subscribed to announcements on Moodle.  Activity 5 will be due before the beginning of lab next week.  Check Moodle for complete list of office hours

3  SNAP! Projects › Before we end with Snap, there will be a group (2-3) project assigned in lab › Details to come…  Begin brainstorming about potential project ideas. › http://scratch.mit.edu/starter_projects http://scratch.mit.edu/starter_projects  Game Section

4  This activity addresses the concept of recursion and how it is used in computing. › The recursive process is one in which objects are defined by other objects of the same type › It is a function procedure that calls itself › Reduce a large problem into a series of similar, smaller problems

5  Factorials › 5! Or 5 factorial is an example of a recursion process › n! = n * (n-1)! › So, 5! = 5 * 4! …. 5! = 120  4! = 4 * 3!  3! = 3 * 2!  2! = 2 * 1!  1! = 1  Create a block called “Factorial _”

6

7  The goal of this project is to create a tree using concepts of recursion › We will have a TREE block that will first draw the trunk, and then will TURN left and continue drawing

8  Step 1: Create a 1 st level block  Step 2: Create a 2 nd level block  Step 3: Create a 3 rd level block  Step 4: Create a recursive block  Step 5: Be creative!

9  After positioning our sprite to create the tree we will need to include some basic blocks.  Now, we can create the first TREE block, this will draw a single branch. › This block needs to move the sprite back to it original position › Each block should allow for an input to be entered for tree size

10

11  Create a block that draws two levels › This block should draw two branches that have a set degree between them › Make sure that you can mentally trace the code  Pay close attention to the forwards and turns  How could we simplify this code? What blocks would we use?

12

13  Now, using your knowledge of recursion create a block for the third level, this block should use a previous block. › Practice using different size inputs at this level › Be able to mentally trace your code

14

15  Now, create a TREE block that uses itself in its own script › provided that it knows how many levels it’s expected to draw!  So, in addition to the size input, it’ll have a LEVELS input › In the earlier steps, TREE3 used TREE2; TREE2 used TREE1. › Here, TREE will use TREE, but reduce levels by one › Hint: Look at the program for our # FACTORIAL!

16

17  Once you can draw a tree of five or six levels using your TREE block, see if you make one like the first picture. › Smaller trees are away from the trunk, and the pen color changes  Also, try changing your tree in the following way › Change the turn angle › Change the scale factor › Change the number of recursion


Download ppt " Make sure you are subscribed to announcements on Moodle.  Activity 5 will be due before the beginning of lab next week.  Check Moodle for complete."

Similar presentations


Ads by Google