# Keep Going

<br>

<figure><img src="/files/y8LtdmWSajtEVlhbd9xv" alt=""><figcaption></figcaption></figure>

**Step 3**

The game will need a way of asking questions and comparing the answers typed with the correct answers. The questions and answers that are going to be used for this game are below:<br>

1. What university did I attend? Yale
2. What programming term did I create for problems? bug
3. What is my nickname? Amazing Grace
4. What programming language did I help develop? COBOL
5. What did I create for compiled languages? compiler

Look in the blocks menu and see if there is something that can be used to keep up with all of the questions and answers. You may need to click the ‘Advanced’ button to find more options.

\
**Step 3 continued**

Add 2 arrays to your program now. These need to be included with the on start block so that they get created when the game starts. You will need one array for the questions and one array for the answers. These are referred to as parallel arrays because the question is at the same index in questionList as the answer is in answerList. When you’re done, they should look like this:

<figure><img src="https://lh6.googleusercontent.com/TyIxchVBYqCKtjpho0LkNa6yZ13g9BwpSDpa2-5hioWl2F4EvRq8WThbznaMmp5JbvS5nfNhzsoPL-wWZnhP32g41mSvmH-UBHn6ROtnQVn94xeG9DvH6DKxLqpKxp9KHVlFic9E2jOTpgiyVz-uLiJ5gqTyL0JTA9WfCPVUrfGqFa8C4-fp_d09uDjhqw" alt=""><figcaption></figcaption></figure>

**In your notebook Answer these three questions**&#x20;

The number of elements (questions) that are in the array is referred to as the length of the array.&#x20;

What is the length of the questionList array?

The location of the elements in the array are referred to as the index of the elements. In MakeCode, indexing starts with 0 and ends with the length of the array - 1.&#x20;

What is the index of “What university did I attend?”\
What is the index of “What is my nickname?”\
What is the index of “What did I create for compiled languages?”

**Step 4**

Now it's time to have the sprites interact with each other. Think about how this has been done in previous games. The sprite of kind ‘player’ will move and touch the sprites of kind ‘question’.

Now, what should happen when this interaction happens?&#x20;

* The game should prompt the person playing with a question.
* This question should be random and come from the question list.
* The player will then be able to respond to the question.
* Then, the game will determine if the answer is correct or incorrect based on the value of the answer typed by the person playing the game

**In your notebook**: write an algorithm that will pick a random question from the array, questionList.

Using this algorithm, let’s get this into blocks. Once you have the question being pulled from the questionList and the corresponding answer being pulled from the answerList, the game should prompt the player for the question. This can be done using this block from the Game menu:

<figure><img src="https://lh3.googleusercontent.com/RHmdw-_tC2A5Hi0QWpxmWg_J9ycNuGNOyV5nn-zM7I5zbbYwGFdn8fb-SE0wLQ6kmmEyq4s-AbuRxBss6gHl6-EuolOGX1ICChVaIvqbGl5-LtVGlOUzWc80ekcGKYhDKHg81CG0lrOJ-2uNa05r04fhjJFgkI-xjniTNXe5XfR8hfN7R2KLkrHxHMMCQQ" alt=""><figcaption></figcaption></figure>

This block will be used with an answer variable so that when the player answers the question, the data is stored into a variable:

<figure><img src="https://lh6.googleusercontent.com/Pu1Y8ttUcBh1C-ntDm07X5_Hkfwfeu58hvz2tDBd5xFggib6LvwvcxCmmNM4tVWx0yvrxI3Par-mzqMnagDaAYqkF3Bwe_tOEC-C1I6iCJxX3wAHIdvtVIqVzxo9NNif-lnHziu4G0PFMCjQqbMUaW3dIoTBmV7_PAOXywJTXSeFSA5WAM0uV-5NjzpWVQ" alt=""><figcaption></figcaption></figure>

Don’t forget to test your game. At this point the game should have a player sprite that when it’s moved to touching a question sprite, the game prompts the player with a random question from the array, questionList.

<br>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://computational-thinking-in-room11.gitbook.io/room-112-dhs/cs-in-gaming/trivia-game-grace-hopper/keep-going.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
