forked from hedyorg/hedy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Please replace all _____ before you create a pull request! Start the name of the PR with one of the relevant prefixes in the title of the PR: * ๐๏ธ -> changes related to grammars or the transpiler * ๐ชฒ -> solving a bug * ๐ -> changes unrelated to shipping, such as mergify scripts * ๐งน -> refactorings (changes that do not change functionality and are only a cleanup of code) * ๐ป -> improvements and changes of the Hedy website * ๐งช -> changes made to the test suite * ๐ -> changes related to content Fixes _______ (Always link the number of the issue or of the discussion that your PR concerns. If you use the word `fixes` before the issue number in this description, the related issue will automatically close then the PR is merged) **How to test** Follow these steps to verify this PR works as intended: * _____ (See this hedyorg#880 (comment) for an example) * _____ **Checklist** Done? Check if you have it all in place using this list: (mark with x if done) - [ ] Contains one of the PR categories in the name - [ ] Describes changes in the format above - [ ] Links to an existing issue or discussion - [ ] Has a "How to test" section If you're unsure about any of these, don't hesitate to ask. We're here to help!
- Loading branch information
Showing
16 changed files
with
10,647 additions
and
4 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
CheckInternet: Check whether your Internet connection is working. | ||
Connection_error: We couldn't reach the server. | ||
Empty_output: This code works but does not print anything. Add a print command to your code or use the turtle to get output. | ||
Errors_found: You made a mistake! Don't worry, we still ran the program | ||
Execute_error: Something went wrong while running the program. | ||
Other_error: Oops! Maybe we made a little mistake. | ||
Program_repair: This could be the correct code, can you fix it? | ||
Program_too_long: Your program takes too long to run. | ||
ServerError: You wrote a program we weren't expecting. If you want to help, send us an email with the level and your program at [email protected]. In the meantime, try something a little different and take another look at the examples. Thanks! | ||
Transpile_error: We can't run your program. | ||
Transpile_success: | ||
- Good job! | ||
- Amazing! | ||
- Well done! | ||
- Excellent! | ||
- You did great! | ||
Transpile_warning: Warning! | ||
Unsaved_Changes: You have an unsaved program. Do you want to leave without saving it? | ||
dice: ๐ฒ | ||
fortune: ๐ฎ, โจ | ||
haunted: ๐ฆ, ๐ป, ๐ | ||
restaurant: ๐ฃ, ๐, ๐ | ||
rock: โ๏ธ, ๐, ๐ป | ||
songs: ๐ต,๐ถ | ||
turtle: ๐ข |
Oops, something went wrong.