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

🚚 Stop copying yaml content when a new language is added #5815

Closed
wants to merge 15 commits into from
Closed
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
5,284 changes: 5,284 additions & 0 deletions content-raw/adventures/en.yaml

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions content-raw/adventures/om.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
adventures:
story:
name: StoryOm
default_save_name: StoryOm
description: StoryOm
levels:
1:
story_text: |
Om In level 1 you can make a story with a different main character that you enter yourself.

Om In the first line, use `{ask}` and ask who the main character of the story will be.

Om After that first line, start with `{print}` if the sentence needs to be printed.
Om You use `{echo}` if you want your main character to be at the end of the sentence.
367 changes: 367 additions & 0 deletions content-raw/cheatsheets/en.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,367 @@
1:
- name: '{print}'
explanation: Print something with `{print}`.
demo_code: '{print} Hello welcome to Hedy!'
- name: '{ask}'
explanation: Ask something with `{ask}`.
demo_code: '{ask} What is your favorite color?'
- name: '{echo}'
explanation: Repeat something using `{echo}`.
demo_code: |-
{ask} What is your favorite color?
{echo} so your favorite color is
- name: '{print} emojis'
explanation: Print an emoji with `{print}`.
demo_code: '{print} 🙋 🌍 ❗'
- name: '{forward}'
explanation: Draw a line with `{forward}`.
demo_code: '{forward} 100'
- name: '{turn}'
explanation: Turn the drawing turtle with `{turn}`.
demo_code: |-
{forward} 25
{turn} {left}
{forward} 25
{turn} {right}
2:
- name: '{is}'
explanation: Give a word a name to use in the program using `{is}`. You can choose the name yourself.
demo_code: |-
name {is} Hedy
{print} welcome name
- name: '{ask}'
explanation: Ask something with `{ask}`. Beware! You need to give the answer a name with `{is}`.
demo_code: |-
color {is} {ask} What is your favorite color?
{print} color is your favorite!
- name: '{sleep}'
explanation: With `{sleep}`, you can let Hedy pause for a (couple of) second(s).
demo_code: |-
{print} Let me think for one second...
{sleep}
{print} Hmm.. I need 3 more seconds...
{sleep} 3
{print} Eureka! Ive got it!
- name: '{is} with turtle'
explanation: Give a number a name using `{is}`. You can choose the name yourself.
demo_code: |-
angle {is} 90
{turn} angle
{forward} 100
3:
- name: Choose random
explanation: Choose a random word from a group with `{at}` and `{random}`.
demo_code: |-
animals {is} dog, cat, kangaroo
{print} animals {at} {random}
- name: '{add}'
explanation: '`{add}` an item `{to_list}` a list.'
demo_code: |-
animals {is} cow, cat
{add} dog {to_list} animals
- name: '{remove}'
explanation: '`{remove}` an item `{from}` a list.'
demo_code: |-
animals {is} cat, dog, cow
{remove} dog {from} animals
4:
- name: '{print}'
explanation: Print exactly using quotation marks.
demo_code: '{print} ''Hello welcome to Hedy.'''
- name: '{is}'
explanation: Give a name to some text and `{print}` without quotation marks.
demo_code: |-
name {is} Hedy
{print} 'my name is ' name
- name: '{ask}'
explanation: Ask something with `{ask}`.
demo_code: |-
color {is} {ask} 'What is your favorite color?'
{print} color ' is your favorite!'
5:
- name: '{print}'
explanation: Print exactly using quotation marks.
demo_code: '{print} ''Hello welcome to Hedy.'''
- name: '{ask}'
explanation: Ask something with `{ask}`.
demo_code: |-
color {is} {ask} 'What is your favorite color?'
{print} color ' is your favorite!'
- name: '{if}'
explanation: Make a choice with `{if}`.
demo_code: |-
color {is} {ask} 'What is your favorite color?'
{if} color {is} green {print} 'pretty!' {else} {print} 'meh'
- name: '{if} with turtle'
explanation: Make a choice with `{if}`.
demo_code: |-
answer {is} {ask} 'How far should I walk?'
{if} answer {is} far {forward} 100 {else} {forward} 5
- name: '{in}'
explanation: Check elements with `{in}`.
demo_code: |-
pretty_colors {is} green, yellow
color {is} {ask} 'What is your favorite color?'
{if} color {in} pretty_colors {print} 'pretty!' {else} {print} 'meh'
- name: '{pressed}'
explanation: Check whether a given key on the keyboard is `{pressed}`.
demo_code: '{if} a {is} {pressed} {print} ''You pressed A!'' {else} {print} ''You pressed another key!'''
6:
- name: '{print}'
explanation: Print exactly using quotation marks.
demo_code: '{print} ''5 times 5 is '' 5 * 5'
- name: '{ask}'
explanation: Ask for a calculation and check whether it is correct.
demo_code: |-
answer = {ask} 'What is 10 plus 10?'
{if} answer {is} 20 {print} 'Yes!' {else} {print} 'Oops'
- name: '`{ask}` and `{if}` with turtle'
explanation: Ask the user how many angles they want.
demo_code: |-
angles = {ask} 'How many angles?'
angle = 360 / angles
{forward} 50
7:
- name: '{print}'
explanation: Print exactly using quotation marks.
demo_code: '{print} ''Hello welcome to Hedy.'''
- name: '{ask}'
explanation: Ask something with `{ask}`.
demo_code: |-
color = {ask} 'What is your favorite color?'
{print} color ' is your favorite!'
- name: '{if}'
explanation: Make a choice with `{if}`.
demo_code: |-
color = {ask} 'What is your favorite color?'
{if} color {is} green {print} 'pretty!' {else} {print} 'meh'
- name: '{repeat} with turtle'
explanation: Repeat a line of code with `{repeat}`.
demo_code: '{repeat} 3 {times} {forward} 10'
8:
- name: '{print}'
explanation: Print something. Remember to use a quotation mark for literal printing.
demo_code: '{print} ''5 times 5 is '' 5 * 5'
- name: '{ask}'
explanation: Ask for the answer to a sum and check if it is correct. We can now print 2 lines.
demo_code: |-
answer = {ask} 'What is 5 plus 5?'
{if} answer {is} 10
{print} 'Well done!'
{print} 'Indeed, the answer was ' answer
{else}
{print} 'Oops!'
{print} 'The answer is 10'
- name: '{repeat} with turtle'
explanation: Repeat multiple lines.
demo_code: |-
{repeat} 4 {times}
{turn} 90
{forward} 50
- name: '{pressed}'
explanation: Check whether a given key on the keyboard is `{pressed}`.
demo_code: |-
{if} a {is} {pressed}
{print} 'You pressed A!'
{else}
{print} 'You pressed another key!'
9:
- name: '{if} with multiple lines'
explanation: The answer of a sum of questions with `{ask}` and see if it is correct. Now we print out two lines.
demo_code: |-
answer = {ask} 'What is 10 plus 10?'
{if} answer {is} 20
{print} 'Well done!!'
{print} 'The answer is indeed' answer
{else}
{print} 'Wrong'
{print} 'The answer is 20'
- name: '{repeat} with turtle'
explanation: Repeat multiple lines.
demo_code: |-
{repeat} 4 {times}
{turn} 90
{forward} 50
10:
- name: '{print}'
explanation: Print something. Remember to use a quotation mark for literal printing.
demo_code: '{print} ''5 times 5 is '' 5 * 5'
- name: '{for} with a list'
explanation: Print all things in a list.
demo_code: |-
animals {is} dog, cat, blobfish
{for} animal {in} animals
{print} 'I love ' animal
11:
- name: '{for} loop'
explanation: We can use `{for}` with a `{range}`.
demo_code: |-
{for} counter {in} {range} 1 {to} 5
{print} counter
- name: '{ask}'
explanation: Ask for the answer to a sum and check if it is correct. We can now print 2 lines.
demo_code: |-
answer = {ask} 'What is 5 plus 5?'
{if} answer {is} 10
{print} 'Well done!'
{print} 'Indeed, the answer was ' answer
{else}
{print} 'Oops!'
{print} 'The answer is 10'
12:
- name: float directly
explanation: Decimal numbers.
demo_code: |-
{print} 'Calculate away!'
{print} 'Two and a half plus two and a half is...'
{print} 2.5 + 2.5
- name: assign text
explanation: Text with quotation marks after `=`
demo_code: |-
name = 'Hedy the Robot'
{print} 'Hello ' name
- name: quotes after `{if}` comparison
explanation: Text with quotation marks after `{if}`.
demo_code: |-
name = {ask} 'Who are you?'
{if} name = 'Hedy'
{print} 'Hi there!'
- name: quotes in list
explanation: A list with quotation marks.
demo_code: |-
superheroes = 'Iron Man', 'Batman', 'Superman'
{print} superheroes {at} {random}
13:
- name: '{and}'
explanation: Two parts both need to be correct.
demo_code: |-
answer1 = {ask} 'What is 3+2?'
answer2 = {ask} 'What is 2+2?'
{if} answer1 {is} 5 {and} answer2 {is} 4
{print} 'Both answers are correct!'
{else}
{print} 'At least one answer is wrong!'
- name: '{or}'
explanation: At least 1 of the two parts need to be correct. If both are correct, it is also fine.
demo_code: |-
answer1 = {ask} 'What is 3+2?'
answer2 = {ask} 'What is 2+2?'
{if} answer1 {is} 5 {or} answer2 {is} 4
{print} 'At least one answer is correct!'
{else}
{print} 'Both answers are wrong!'
14:
- name: Smaller
explanation: We use the `<` to check if the first number is smaller than the second number.
demo_code: |-
age = {ask} 'How old are you?'
{if} age < 13
{print} 'You are younger than me!'
- name: Bigger
explanation: We use the `>` to check if the first number is bigger than the second number.
demo_code: |-
age = {ask} 'How old are you?'
{if} age > 13
{print} 'You are older than me!'
- name: Equal
explanation: We use the `==` to check if two things are the same.
demo_code: |-
answer = {ask} 'What is 5 * 5?'
{if} answer == 25
{print} 'That is correct!'
- name: Not equal
explanation: We use the `!=` to check if two things are not the same.
demo_code: |-
answer = {ask} 'What is 5 * 5?'
{if} answer != 25
{print} 'That is not correct!'
- name: Smaller or equal
explanation: We use the `<=` to check if the first number is smaller than or equal to the second number.
demo_code: |-
age = {ask} 'How old are you?'
{if} age <= 12
{print} 'You are younger than me!'
- name: Bigger or equal
explanation: We use the `>=` to check if the first number is bigger than or equal to the second number.
demo_code: |-
age = {ask} 'How old are you?'
{if} age >= 14
{print} 'You are older than me!'
15:
- name: '{while}'
explanation: We can use the `{while}` loop with not equal.
demo_code: |-
answer = 0
{while} answer != 25
answer = {ask} 'What is 5 times 5?'
{print} 'A correct answer has been given'
- name: Smaller {while}
explanation: We can also use the `{while}` loop with `<` and `>`.
demo_code: |-
count = 1
{while} count < 3
{print} 'We do this ' 3 - count ' more times'
count = count + 1
{print} 'We are done'
16:
- name: square brackets
explanation: Lists with square brackets.
demo_code: |-
fruit = ['apple', 'banana', 'cherry']
{print} fruit
- name: Get an item from a list
explanation: To get an item from a list we use [number] so fruit[1] means, get the first fruit from the list!
demo_code: |-
fruit = ['banana', 'apple', 'cherry']
firstfruit = fruit[1]
{print} firstfruit
- name: Get a random item from a list
explanation: To get a random item from a list we use [{random}] so fruit[{random}] means, get a random fruit from the list!
demo_code: |-
fruit = ['banana', 'apple', 'cherry']
random_fruit = fruit[{random}]
{print} random_fruit
17:
- name: '{elif}'
explanation: '`{elif}`'
demo_code: |-
a = 2
{if} a == 1:
{print} 'a is 1'
{elif} a == 2:
{print} 'a is 2'
{else}:
{print} 'a is not 1 or 2'
- name: '{print}'
explanation: When we use a `{for}`, we need to put a `:` behind the `{for}` statement!
demo_code: |-
{for} i {in} {range} 1 {to} 12:
{print} i
{print} 'Ready or not, here I come!'
- name: '{if}'
explanation: We need to do the same with all of our `{if}` statements.
demo_code: |-
color = {ask} 'What is your favorite color?'
{if} color == 'green':
{print} 'Your favorite color is green'
{else}:
{print} 'Your favorite color is not green'
18:
- name: '{print}'
explanation: After `{print}` you need to use parentheses.
demo_code: '{print}(''hi!'')'
- name: '{range}'
explanation: After `{range}` you need to use parentheses.
demo_code: |-
{for} i {in} {range} (1,10):
{print}('Hello, times ', i)
- name: '{print} with var'
explanation: With `{print}` you need to use parentheses and commas if you print more items.
demo_code: |-
name = 'Hedy'
{print}('my name is ', name)
- name: ask something with {input}
explanation: Use `{input}` instead of `{ask}` to ask something.
demo_code: |-
name = {input}('What is your name?')
{print}('So your name is ', name)
1 change: 1 addition & 0 deletions content-raw/cheatsheets/om.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
Loading
Loading