pxt-calliope/olddocs/js/lessons/the-hat-game/quiz.md
2016-04-15 14:37:25 -07:00

1.2 KiB

the hat game quiz

The all famous Hat Game -- one of 3 hats has the ball, which is revealed at the beginning. The hats then swap with each other. You goal is to choose the hat with the ball after the hats have finished swapping.

Name

Directions

Use this activity document to guide your work in the the hat game tutorial

Answer the questions while completing the tutorial. Pay attention to the dialogues!

1. What is the name of the first function you created? What does it do?


2. Write a for loop that plots the points (0, 2), (2, 2), and (4, 2).


3. How can you increase the difficulty of the game?


4. Consider the following code

cupSelect = "LMR"
index = -1

Write the code that displays the next letter of the string in "cup select" when button A is pressed.






5. Write the line of code that shows the swapping animation of two hats swapping if hat 1 = 0 and hat 2 = 2.


6. Consider the following code

let not = Math.random(3)

Given the hat we are not going to swap, how can we calculate the other two hats that we are going to swap? Use these two values to call "swap hats()" with a swap speed of 50.