Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

📜 Big clean up level 9 and 10 #5217

Merged
merged 10 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 45 additions & 18 deletions content/adventures/ar.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -521,18 +521,31 @@ adventures:
10:
story_text: |
This calculator game helps you practise your tables of multiplication!
If you add more numbers to the list, you can practise all the multiplications.
### Exercise
Fill in the blanks. We want this program to ask the player these questions:
```
How much is 1 times 1?
How much is 1 times 2?
How much is 1 times 3?
How much is 2 times 1?
How much is 2 times 2?
How much is 2 times 3?
How much is 3 times 1?
How much is 3 times 2?
How much is 3 times 3?
_
```
example_code: |
```
numbers = 1, 2, 3
{for} number1 {in} numbers
{for} number2 {in} numbers
answer = {ask} 'How much is ' number2 ' times ' number1 '?'
correct = number1 * number2
{for} _
{for} _
answer = {ask} _
correct = number_1 * number_2
{if} answer {is} correct
{print} 'Great job!'
{else}
{print} 'Thats wrong. The right answer is ' correct
{print} 'That is wrong. The right answer is ' correct
```
11:
story_text: |
Expand Down Expand Up @@ -1531,6 +1544,20 @@ adventures:
{for} animal {in} animals
{print} 'I love ' animal
```
story_text_2: |
### Exercise
Finish this code by adding `{for} action {in} actions` to line 2.
example_code_2: |
```
actions = clap your hands, stomp your feet, shout Hurray!
_
{repeat} 2 {times}
{print} 'If youre happy and you know it, ' action
{sleep} 2
{print} 'If youre happy and you know it, and you really want to show it'
{print} 'If youre happy and you know it, ' action
{sleep} 3
```
11:
story_text: |-
In this level, we add a new form of the `{for}`. In earlier levels, we used `{for}` with a list, but we can also use `{for}` with numbers.
Expand Down Expand Up @@ -2895,10 +2922,10 @@ adventures:
story_text_2: |
**All items in lists need quotation marks too**
Lists are texts, so they need quotation marks too. Mind that each single item on the list has quotation marks.
This allows you to save two words as 1 item on the list, for example 'Iron Man'.
This allows you to save two words as 1 item on the list, for example 'Black Widow'.
example_code_2: |
```
superheroes = 'Spiderman', 'Batman', 'Iron Man'
superheroes = 'Spiderman', 'Batman', 'Black Widow'
{print} superheroes {at} {random}
```
story_text_3: |
Expand Down Expand Up @@ -3004,18 +3031,18 @@ adventures:
```
9:
story_text: |
In this level you can not only use multiple lines with `{if}` and `{repeat}`, but you can also put them together!
In the example you see an `{if}` command within a `{repeat}` command. It is also allowed the other way around, and an `{if}` is also allowed in an `{if}` and a `{repeat}` in a `{repeat}`.
Give it a try!
Great job! You've reached another new level! In the previous level you've learned to use multiple lines of code in an {if} or {repeat} command. But you can't yet combine the two...
Good news! In this level you will be allowed to put an {if} inside an {if}, or inside a {repeat} command. Putting a block of code inside another block of code is called nesting. ``` Putting a block of code inside another block of code is called nesting.
example_code: |
```
{repeat} 3 {times}
food = {ask} 'What do you want?'
{if} food {is} pizza
{print} 'nice!'
{else}
{print} 'pizza is better'
```
answer = {ask} 'Are you ready to learn something new?'
{if} answer {is} yes
{print} 'Great! You can learn to use the repeat command in the if command!'
{print} 'Hooray!'
{print} 'Hooray!'
{print} 'Hooray!'
{else}
{print} 'Maybe you should practice some more in the previous level'
repeat_command_2:
name: '{repeat} 2'
default_save_name: repeat_command_2
Expand Down
105 changes: 69 additions & 36 deletions content/adventures/bg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ adventures:
name {is} {ask} What is the name of the main character?
{print} name is now going to run in the woods
{print} name is a bit scared
{print} Suddenly he hears a crazy noise...
{print} Suddenly she hears a crazy noise...
{sleep}
{print} name is afraid this is a haunted forest
```
Expand Down Expand Up @@ -524,37 +524,56 @@ adventures:
{else} _
9:
story_text: |
In previous levels you've learned how to make a calculator, in this level you can expand that code and make it into a little maths game. Like this...
In a previous level you've created a calculator, in this level you can expand that code so it asks multiple questions.

### Exercise 1
Can you finish line 10 to get the code to work?

### Exercise 2
Give the player feedback when the enter an answer, like `{print} 'Correct!'` or `{print} 'Wrong! The correct answer is ' correct_answer`.
example_code: |
```
score = 0
{repeat} 10 {times}
numbers = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
number1 = numbers {at} {random}
number2 = numbers {at} {random}
correct_answer = number1 * number2
{print} 'What is ' number1 ' times ' number2 '?'
number_1 = numbers {at} {random}
number_2 = numbers {at} {random}
correct_answer = number_1 * number_2
{print} 'What is ' number_1 ' times ' number_2 '?'
answer = {ask} 'Type your answer here...'
{print} 'Your answer is' answer
{if} answer {is} correct_answer
{print} 'Your answer is ' answer
{if} _ {is} _
score = score + 1
{print} 'Great job! Your score is... ' score ' out of 10!'
```
10:
story_text: |
This calculator game helps you practise your tables of multiplication!
If you add more numbers to the list, you can practise all the multiplications.
### Exercise
Fill in the blanks. We want this program to ask the player these questions:
```
How much is 1 times 1?
How much is 1 times 2?
How much is 1 times 3?
How much is 2 times 1?
How much is 2 times 2?
How much is 2 times 3?
How much is 3 times 1?
How much is 3 times 2?
How much is 3 times 3?
_
```
example_code: |
```
numbers = 1, 2, 3
{for} number1 {in} numbers
{for} number2 {in} numbers
answer = {ask} 'How much is ' number2 ' times ' number1 '?'
correct = number1 * number2
{for} _
{for} _
answer = {ask} _
correct = number_1 * number_2
{if} answer {is} correct
{print} 'Great job!'
{else}
{print} 'Thats wrong. The right answer is ' correct
{print} 'That is wrong. The right answer is ' correct
```
11:
story_text: |
Expand Down Expand Up @@ -1275,18 +1294,18 @@ adventures:
```
9:
story_text: |-
In this level you can not only use multiple lines with `{if}` {and} `{repeat}`, but you can also put them together!
In the example you see an `{if}` command within a `{repeat}` command. It is also allowed the other way around, and an `{if}` is also allowed in an `{if}` and a `{repeat}` in a `{repeat}`.
Give it a try!
Great job! You've reached another new level! In the previous level you've learned to use multiple lines of code in an {if} or {repeat} command. But you can't yet combine the two...
Good news! In this level you will be allowed to put an {if} inside an {if}, or inside a {repeat} command. Putting a block of code inside another block of code is called nesting. ``` Putting a block of code inside another block of code is called nesting.
example_code: |
```
{repeat} 3 {times}
food = {ask} 'What do you want?'
{if} food {is} pizza
{print} 'nice!'
else
{print} 'pizza is better'
```
answer = {ask} 'Are you ready to learn something new?'
{if} answer {is} yes
{print} 'Great! You can learn to use the repeat command in the if command!'
{print} 'Hooray!'
{print} 'Hooray!'
{print} 'Hooray!'
{else}
{print} 'Maybe you should practice some more in the previous level'
10:
story_text: |-
In this level we learn a new code called `{for}`. With `{for}` you can make a list and use all elements.
Expand Down Expand Up @@ -1635,6 +1654,20 @@ adventures:
{for} animal {in} animals
{print} 'I love ' animal
```
story_text_2: |
### Exercise
Finish this code by adding `{for} action {in} actions` to line 2.
example_code_2: |
```
actions = clap your hands, stomp your feet, shout Hurray!
_
{repeat} 2 {times}
{print} 'If youre happy and you know it, ' action
{sleep} 2
{print} 'If youre happy and you know it, and you really want to show it'
{print} 'If youre happy and you know it, ' action
{sleep} 3
```
11:
story_text: |-
In this level, we add a new form of the `{for}`. In earlier levels, we used `{for}` with a list, but we can also use `{for}` with numbers.
Expand Down Expand Up @@ -3029,10 +3062,10 @@ adventures:
story_text_2: |
**All items in lists need quotation marks too**
Lists are texts, so they need quotation marks too. Mind that each single item on the list has quotation marks.
This allows you to save two words as 1 item on the list, for example 'Iron Man'.
This allows you to save two words as 1 item on the list, for example 'Black Widow'.
example_code_2: |
```
superheroes = 'Spiderman', 'Batman', 'Iron Man'
superheroes = 'Spiderman', 'Batman', 'Black Widow'
{print} superheroes {at} {random}
```
story_text_3: |
Expand Down Expand Up @@ -3138,18 +3171,18 @@ adventures:
```
9:
story_text: |
In this level you can not only use multiple lines with `{if}` and `{repeat}`, but you can also put them together!
In the example you see an `{if}` command within a `{repeat}` command. It is also allowed the other way around, and an `{if}` is also allowed in an `{if}` and a `{repeat}` in a `{repeat}`.
Give it a try!
Great job! You've reached another new level! In the previous level you've learned to use multiple lines of code in an {if} or {repeat} command. But you can't yet combine the two...
Good news! In this level you will be allowed to put an {if} inside an {if}, or inside a {repeat} command. Putting a block of code inside another block of code is called nesting. ``` Putting a block of code inside another block of code is called nesting.
example_code: |
```
{repeat} 3 {times}
food = {ask} 'What do you want?'
{if} food {is} pizza
{print} 'nice!'
{else}
{print} 'pizza is better'
```
answer = {ask} 'Are you ready to learn something new?'
{if} answer {is} yes
{print} 'Great! You can learn to use the repeat command in the if command!'
{print} 'Hooray!'
{print} 'Hooray!'
{print} 'Hooray!'
{else}
{print} 'Maybe you should practice some more in the previous level'
repeat_command_2:
name: '{repeat} 2'
default_save_name: repeat_command_2
Expand Down
Loading
Loading