ST EK List:
4.1.1B Sequencing is the application of each step of an algorithm in the order in which the statements are given.
4.1.1C Selection uses a Boolean condition to determine which of two parts of an algorithm is used.
5.2.1B Program instructions are executed sequentially.

Learning Player Names

BH/PG/AC/MF FP meeting:

Animation should be redone so that the name is added to the list before the greeting is said. Also, change the sprite costume so that it's not a child younger than our students. --MF, 6/18/18

This appears is the first place where we talk about global variables; we should have a vocab box. --MF, 6/18/18

Move this to U2 in place of 2.1.4, which should be junked except for the pieces that are needed for 2.2.3. --MF, 6/18/18

On this page, you will create a greet player script that greets users and remembers their names so that first-timers get a different greeting from return visitors. greet player example

     

    The decision is made by if-else.
    ask(What is your name?) and wait;if((player list) contains(answer)){}else{}
    The if and if-else blocks are called conditionals because they control the code based on a condition (here, whether the list of players contains this player's name).

    Deciding (selecting) which part of an algorithm to run based on a condition is called selection.

    Sequencing is the process of ordering the code (putting it in a sequence), as you do here.

  1. Click here to load this file. Then save it to your Snap! account.
    It contains most of the code you'll need to make the script.
  2. Snap the pieces together in a sequence so that:
    1. The greeter will ask the player for their name.
    2. If the player's name is in the player list,
      • Say "nice to see you again, player name."
    3. Otherwise when the player isn't on the list,
      • Say "nice to meet you, player name," and
      • Add the player's name to the player list.
  3. Test and debug. Make sure the script works the way you want it to.
  4. Create a greet player block command block, and drag in your working script.
  5. Click greet player several times to test that it works as expected. Fix any bugs.
  6. Save. You will use this later.