script for scratch polygon creator

Upload: sandra-thaxter

Post on 05-Apr-2018

221 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/2/2019 Script for Scratch Polygon Creator

    1/17

    1

    SCRIPT FOR SCRATCH POLYGON CREATOR.

    Introduction.

    The purpose of this script is to illustrate the use of the following:-

    1. Project orientated learning.2. Learning by discovery.3. Community of Inquiry (COI).

    For this example, Scratch has been chosen as the vehicle.

    It is assumed that the students have been made familiar with the computer and with the basic structure of

    Scratch.

    The purpose of the project is to implement a Scratch program which will cause the sprite to draw a polygon of

    any number of sides.

    The students should have no, or little, prior knowledge of angles and their relationship to shapes, but should

    have been encouraged to use their bodies to form some different shapes by joining together in groups to form

    triangles squares etc.

    They will work on this project as a group with even the most reticent among them being encouraged to supply

    their ideas at each stage. The approach should be to take seriously even the most outlandish seeming idea and

    trying to see if it can be made to work.

    An advantage of this approach is that the least advanced of the students takes part and gets to understand the

    process and can go back to make sure that they fully understand the results, while the more advanced students

    can go out of the group for periods to devise and implement projects of their own to avoid their being

    frustrated.

    This approach, starting with using their bodies (they can even improvise songs or rhymes as mnemonics) to act

    out the project as a group, then programming the sprite, can be implanted in learning about adding, subtracting,

    multiplying, long division, etc., before formal lessons on the subjects.

    Script.

  • 8/2/2019 Script for Scratch Polygon Creator

    2/17

    2

    This is an imaginary session between a facilitator, F which could be a teacher or a more advanced student

    helping less advanced students, and the group of students, G. The entry in the computer can be made by either

    a group member or the facilitator.

    Within the dialog represents discussion ending with a decision. In a real life case there would be cases of

    backtracking and modification as decisions do not work out. This is part of a process of working by trial and errorwhere more is often learned from the ideas which did not work out, and the fixing of the errors, than by a linear

    path to the conclusion. A further valuable lesson to be learned is that a given result can be arrived at in a

    number of different ways.

    The blocks are all colored and are found in the menus shown below with the same color.

    F: We are going to design a program which will instruct the sprite to draw different shapes depending on how

    many sides it should have. We will start with a simple program and work on adding more to it as we progress.

    We will be using Turtle geometry which differs from the standard Euclidean geometry in the important way

    that it is more natural. It does not replace Euclidean geometry but helps you to understand what you will be

    taught in the conventional way.

    To begin with we will do some housekeeping to remove traces of the previous session as we go, and to position

    the sprite in a known position. The start block causes the following series of actions to take place when the

    green flag is selected, the clear block removes all traces of the previous session, the pen up block prevents the

    sprite leaving a trace when it is moved to the start position set by the next motion, blocks

    F (facilitator) : How would you tell the sprite to draw a circle?

    G (group) : .. dont know

  • 8/2/2019 Script for Scratch Polygon Creator

    3/17

    3

    F : Why dont you walk in a circle and tell us what you are doing?

    G : .Walking

    F: What do youdo differently when walking in a straight line and walking round a circle?

    G: We turn as we walk

    F: But the poor sprite can take a step in a straight line or turn, but not both at the same time, so what shall we

    tell him to do? Try moving like the sprite.

    G: ..take a step and then turn

    F: Should it be a big step or a small step?

    G: A small step

    F: And how about the turn, should he turn a lot or a little

    G: A little

    F: Right lets try the sizes already set for the move and turn and drag them out?.

    F: Now, we can either repeat move turn over and over or I will show you a POWERFUL IDEA called recursion

    you dont have to remember the name but it means that you do you the same thing over and over again. This

    is done by a number of blocks in the CONTROL menu

  • 8/2/2019 Script for Scratch Polygon Creator

    4/17

    4

    F: We will chose the forever block for now because we do not know how many times we want the sprite to

    move and turn.

    F: We will make the sprite very small so that we can see what he has drawn, and we click on the green flag and

    he draws a circle.

    F: But he does it over and over again. So now we need to figure out how he knows when he has finished

    drawing one circle. What do you thinkhow do you know when you have walked round a circle once?

  • 8/2/2019 Script for Scratch Polygon Creator

    5/17

    5

    G: .We could draw a line..or we are looking at the same thing as when we started we are facing the

    same way

    We can try stopping at a line, this works, as shown in appendix 1, but has the disadvantage that the end point is

    not very precise because of the finite size of the sprite. The program and method is based on the following

    F: Let us look at the case where we let the sprite go until he is facing the same direction as he was when he

    started. Let us be curious and, to do so, introduce the concept of variables which are names which represent

    numbers so that the number can be displayed and used in different places while being changed in one place. For

    example, let us go back to the circle program and change it by adding variables. The variable replaces

    the number 10 in the move command and the variable replaces the number 15 in the turn

    command. What should we be curious about?

    G: ..how far he has movedhow far he has turned

    F: The variables and give us those values. The variables are set up as shownbelow

    F: You will notice that, in the scratch display, above the program the sprite position is displayed and it includes

    the direction

    F: Now,to get the sprite to stop, which control should we choose to replace the forever block?

  • 8/2/2019 Script for Scratch Polygon Creator

    6/17

    6

    G: .repeat until

    F: OK

    F: Oh dear, he does not move. Why?

    G: ..oh yes, he is pointing in direction 0 when he starts

    F: What can we do about it?

    G: ..move him away from that positionlet him move and turn before the repeat block

  • 8/2/2019 Script for Scratch Polygon Creator

    7/17

    7

    F: Success!! ---Take note of the value of total degrees in particular. This number is important. Now try different

    values of -- take note of which variables change and which stay the same

    .

    .

    F: Now do the same with the variable ---- some numbers work and others do not. Why? Try single

    stepping, or putting in blocks if you get stuck

    G: .the sprite does not get to face in direction 0

    From now on, as concepts get more complex, the facilitator will have to take a more active part in the discussion,

    but only after the group has a chance to grapple with the problem.

    F: Now I am going to introduce you to another powerful ideacalled successive approximations which means

    getting nearer to solving a problem in a number of steps. We will illustrate it by trying an experiment with

    ourselves.

    Say that you have to take 10 steps and end up in a place which I have chosen but have not pointed out to you. I

    will tell you after you have taken the 10 steps if you are there; you have gone too far or not far enough. What

    size of step would you start with?

  • 8/2/2019 Script for Scratch Polygon Creator

    8/17

    8

    G: small steps so that we do not get there too soon

    F: So you will gradually take bigger steps until I tell you that you have passed the finish line. Now what will you

    do?

    G: make the step smaller

    F: Ifyou want to get to the right size in a neat way, how much smaller would you make your step?

    G: half way between the last two steps

    F: Right. Now the sprite works in exact numbers so that we would have been adding a number to the move size

    each time around. Now there is a useful series of numbers 1, 2, 4, 8, and 16. Can you tell me what is special

    about them?

    G: .. each one is twice the one before

    F: Right! Or going backwards, each one is half the next one so that if we make the step bigger by, say 16 eachtime until we pass then finish line, we can go back and increase by 16 2 = 8 for the next try. Do you all

    understand that?

    G: ..yes

    F: We will need a new variable for this number, which we will call

    F: For the circle we do not specify the number of sides, but will do that soon. Lets think of how we tell that the

    sprite has gone past the finish point of the circle. If it goes too far it will be following the same path as the first

    time round. Can anyone tell us how we know that it has just passed the 0 heading?

    G: dont know

    F: Let me give you a hint. How far did it turn at the very beginning?

    G: .. it turned

    F: Can it go more than as it passes the 0 heading?

    G: .no

    F: So can we say that if the heading is greater than 0 and less than that it has just passed the 0

    heading?

    G: ..Yes

  • 8/2/2019 Script for Scratch Polygon Creator

    9/17

    9

    F: We will find out later that it useful to know that the sprite has passed through the 0 heading, so we set what

    we call a flag, which is a variable, in this case , which we can set to 1 as we do so

    F: We need to go back to the control menu to choose a new block. What should it be?

    G: ..

    F: Yes, we can use that to set . then we need something more. We can say if is =

    1 then subtract the new variable 2; but we need to do something else otherwise, so that we need

    the control with this we can say, for example, if I it is time to go, I can go home; otherwise

    (else) I need to stay here.

    We can put these blocks inside one another to get the sprite to do complicated things

    F: Let us put it in. In fact let us go on to the main object of the project, to draw multi-sided figures. The circle is

    a special case because it has so many sides. It will become clear that it is easy to make sure that the circle is

    closed once we have found the secrets of the simpler figures. A program which does draw a circle by using

    successive approximations is in appendix 2 in case anyone would like to work on it.

    For this we need a new variable, can you tell me what it is?

    G: ..we dont know

    F: We are trying to draw figures with different numbers of sides. Does that tell you what the variable to tell the

    sprite how many sides he should draw is?

    G: ..yes it is

    F: We also need another variable to count the sides as the sprite draws them and we shall call this

    F: Now we need to think about what we are asking the sprite to do; each time he draws the number of sides

    and finds that he has not got to 0, what does he have to do. Try to do it yourself if you like with three sides

    G: ..start over

    F: Here is a list of the variables, which do we have to set up again every time we start over?

  • 8/2/2019 Script for Scratch Polygon Creator

    10/17

    10

    F: sides

    F: steps

    F: add

    F: nearly there

    F: degrees

    F: total steps

    F: drawn sides

    F: total degrees

    G: No

    G: No

    G: No

    G: No

    G: Yes

    G: Yes

    G: Yes

    G: Yes

    F: OK, so how do we begin after this set up block?

    Remember that we do not know how many times the sprite will have to start over

    G: ..if heading = 0, else

    F: But how will setthe initial position

    G: OKforever

    F: Right. We start as we have done before, with the additional variables

  • 8/2/2019 Script for Scratch Polygon Creator

    11/17

    11

    F: What next? Hint we have to attempt to draw the figure

    G: last time we repeated until = 0.no repeat until =

    F: And then?

    G: .if = 0 else

    .if > 0 and <

    and

    Else if = 1

  • 8/2/2019 Script for Scratch Polygon Creator

    12/17

    12

    F: OK lets try that except to make thing easier to see, we will move the sprite to a neutral corner both when we

    stop and when we are ready to start again. Dont forget that if things dont work the first time, set Scratch to

    the single step mode and follow the program step by step until you realize where It goes wrong.

  • 8/2/2019 Script for Scratch Polygon Creator

    13/17

    13

  • 8/2/2019 Script for Scratch Polygon Creator

    14/17

    14

    F: When you choose 3 sides, you will see that the degrees shown for each turn is 120. This is not the number

    which you will learn in geometry class. What is the difference?

    Before we figure this out lets set the sides to 2, what do we see and what is the value of degree?

    G: A straight line and 180 degrees

    F: What does the sprite do at the end of the line?

    G: He turns round and goes back to where he started

    F: Now look at a corner of the triangle and see which way the sprite turned from one side to the next try it for

    yourself if it helps. Do you see that there are two sizes of turns between the two sides?

    G: yesone inside the triangle and one outside

    F: Right, and what would happen if the sprite turned through both one afterthe other?

    G: .he would go back on the first line

    F: Right, and through how many degrees did we find he would then be turning?

    G: ..180

    F: So what is the size of the inside angle?

    G: ..180 the outside angle

    F: What is that in numbers?

    G: 180-120 = 60

    F: That is the angle usually referred to for a triangle with 3 equal sides. You can add a new variable

    = 180 - to your script and get the inside angle for all the figures

    End of script

  • 8/2/2019 Script for Scratch Polygon Creator

    15/17

    15

    Suggestions for follow up

    Each student should try to create his own version of this project, using the same technique of trial and error.

    They should end up with differences from the example which should emphasize the fact that there are many

    different ways to solve a problem. They can help one another in this exercise, but it should be emphasized that

    this should be by means of hints and not by showing exactly how to get to the next stage.

    It would be a good exercise to investigate the reason why all these figures end up where they began without

    having a gap.

    Further related projects would be to modify the as the figures are drawn to see what happens.

    Then motion could be added get the sprite to draw a stick figure which walks across the screen. This could get

    progressively more realistic as the confidence of the students develops.

  • 8/2/2019 Script for Scratch Polygon Creator

    16/17

    16

    Appendix 1.

  • 8/2/2019 Script for Scratch Polygon Creator

    17/17

    17

    Appendix 2.