pxt-calliope/olddocs/js/lessons/number-psych/quiz.md

117 lines
3.0 KiB
Markdown
Raw Permalink Normal View History

2016-03-26 00:47:20 +01:00
# number psych quiz
2016-04-02 01:22:47 +02:00
a 4-player game in which each player must outwit his opponents.
2016-03-26 00:47:20 +01:00
## Name
## Directions
2016-04-13 17:27:45 +02:00
Use this activity document to guide your work in the [number psych console tutorial](/lessons/number-psych-console/tutorial) and the [number psych controller tutorial](/lessons/number-psych-controller/tutorial).
2016-03-26 00:47:20 +01:00
Answer the questions while completing the tutorial. Pay attention to the dialogues!
**Questions 1-9 are concerned with 'number pysch console tutorial'**
## 1. Create a 'collection of options' and save them in a local variable named 'options'.
<br/>
## 2. Add the options '1', '3', and '5' into the local variable 'options'.
<br/>
<br/>
## 3. Create a collection of scores and add four values of '0' into the collection.
<br />
<br/>
## 4. Write the code that reads a byte that indicates a controller is asking for a player number. (Don't bother checking if the byte received is 255.) Next, write the code that transfers the player number to the controller.
<br />
<br/>
<br/>
## 5.Write the code that transfers the three options.
<br />
<br/>
## 6.Write the code that requests each player to send their choice in the player order number. Don't worry about reading their choice. (Hint: look at the four loop with 'k' as the index.)
<br />
<br/>
<br/>
## 7.Write the code to create two collections. One collection ("choices") stores all the choices, while the other collection ("has common") stores whether or not the choice is unique. (If the choice is not unique, then "has common" will be set to true for that particular choice.)
<br />
<br/>
## 8. Write the code that compares each of the choices with each other. If the two choices are the same, then set the appropriate value inside 'has common' to true. (Hint: look at the for loops with 'l' and 'n' as their indexes.)
<br />
<br/>
<br/>
<br/>
<br/>
<br/>
## 9. For each value inside 'has common', transfer a '1' if there is a match and transfer a '0' if there isn't a match. Add a pause of 100 milliseconds at the beginning of each transfer.)
<br />
<br/>
<br/>
**Questions 10-14 are concerned with 'number pysch controller tutorial'**
2016-11-02 01:44:37 +01:00
## 10. Write the code that asks for a player number if button 'A' is pressed on the BBC controller @boardname@.
2016-03-26 00:47:20 +01:00
<br />
<br/>
## 11. Write the code that adds the three transferred options to the "options" collection. (Hint: look at the for loop with 'k' as the index.)
<br />
<br/>
<br/>
## 12. Write the code that detects when button 'B' is pressed. Inside this condition, if 'game mode' is 2, set 'game mode' back to 1 and plot a waiting image.
<br />
<br/>
2016-11-02 01:44:37 +01:00
## 13. Create a while loop that first reads which controller the console @boardname@ is requesting data from. Plot a waiting image, and then write an IF statement to check if the request corresponds to the controller. (Don't worry about writing anything inside the if statement).
2016-03-26 00:47:20 +01:00
<br />
<br/>
<br/>
## 14. Write the code that displays an "X" on the @boardname@ if 'result' is 1. Otherwise, display a "check mark".
2016-03-26 00:47:20 +01:00
<br />
<br/>