diff --git a/content/adventures/el.yaml b/content/adventures/el.yaml index fce12456e36..b137ba25807 100644 --- a/content/adventures/el.yaml +++ b/content/adventures/el.yaml @@ -23,23 +23,6 @@ adventures: Θα πρέπει να γράψεις λίγο παραπάνω κώδικα γι'αυτό. Τώρα θα πρέπει πρώτα να ονοματίσεις το βασικό σου χαρακτήρα πρώτα. Έπειτα μπορείς να τοποθετήσεις αυτό το όνομα οπουδήποτε στην πρόταση. - example_code: | - ``` - 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 He hears crazy noises everywhere - print name is afraid this is a haunted forest - ``` - story_text_2: | - ### Exercise - Now it's time to add variables to your own story that you've made in the previous level. - Go to 'My programs', look for your level 1 story adventure and copy the code. Paste the code in your input screen in this level. - - This code won't work in this level, because you have not used variables yet. - Change the `{ask}` commands and `{echo}` commands in your code to the correct form that you've learned in this level. - - **Extra** Add a sleep command to your code to build up tension in your story. 3: story_text: | Μπορείς επίσης να προσθέσεις κάτι τυχαίο στην ιστορία σου. Οποιοδήποτε τέρας, ζώο ή άλλο εμπόδιο. @@ -50,18 +33,6 @@ adventures: animals is κουκουβάγια, σκαντζόχοιρος, αρμαντίλο print Τώρα ακούει τον ήχο ένος animals at random ``` - story_text_2: | - The command `{add}` can also come in handy in your story. For example - example_code_2: | - ``` - {print} He hears a sound - animals {is} 🐿, 🦔, 🦇, 🦉 - animal {is} {ask} What do you think it is? - {add} animal {to_list} animals - {print} it was a animals {at} {random} - ``` - story_text_3: | - This is an example of the `{remove}` command in your story 5: story_text: | Στο επίπεδο 4 μπορείς να κάνεις την ιστορία σου ακόμα πιο διασκεδαστική. Στο επίπεδο 4 μπορείς να προγραμματίσεις διαφορετικά φινάλε. @@ -91,61 +62,6 @@ adventures: repeat 5 times print 'Βοήθεια!' print 'Γιατί δε με βοηθάει κανείς;' ``` - 8: - story_text: | - In this level you can use multiple lines in your {if} commands, this way you can upgrade your happy or sad ending! - 9: - story_text: | - In this level you can use nesting to put {if}, {repeat} or {for} commands inside other {if}, {repeat} or {for} commands. This gives you many options and really helps you to make your story interactive. - example_code: | - ``` - {print} 'Robin is walking downtown' - location = {ask} 'Is Robin going into a shop, or does she go home?' - {if} location {is} shop - {print} 'She enters the shop.' - {print} 'Robin sees an interesting looking book' - book = {ask} 'Does Robin buy the book?' - {if} book {is} yes - {print} 'Robin buys the book and goes home' - {else} - {print} 'Robin leaves the shop and goes home' - {else} - {print} 'Robin goes home' - ``` - 10: - story_text: | - In this level you can use the {for} command in your story. In this way you could easily program the children's book 'brown bear, brown bear, what do you see'. - 12: - story_text: | - In this level you can use the quotation marks to save multiple words in a variable. - example_code: | - ``` - name = 'The Queen of England' - {print} name ' was eating a piece of cake, when suddenly...' - ``` - 13: - story_text: | - By using the `{and}` and `{or}` commands, you can shorten your stories. For example, check out the dragon story. - add_remove_command: - name: '{add} {to} & {remove} {from}' - description: introducing add to and remove from - levels: - 3: - story_text: | - ## Add to - You can add items to the list with the `{add} {to_list}` command. To add an item to a list you can simply type: `{add} penguin {to} animals` or you can use the `{ask}` command like in the example code. - story_text_3: | - ### Exercise - Try out the new commands in this virtual restaurant. Add the flavor the player is hpoing for to the list and remove the flavors they are allergic to. - and_or_command: - description: introducing and or - ask_command: - description: Introduction ask command - levels: - 1: - story_text_2: | - ## The echo command - If you want the computer to repeat the answer, you can use the `{echo}` command. The answer will then be echoed back at the end of the sentence, so in this example after hello. calculator: name: Αριθμομηχανή default_save_name: Αριθμομηχανή @@ -176,372 +92,6 @@ adventures: if answer is correct_answer print 'οκ' else print 'λάθος! ήταν ' correct_answer ``` - story_text_3: | - You can also let the computer do random calculations on its own using {random}. - example_code_3: | - numbers = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 - number_1 = _ - number_2 = _ - correct_answer = number_1 * number_2 - given_answer = 'What is ' number_1 ' times ' number_2 '?' - {if} _ - {else} _ - 9: - story_text: | - 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`. - 11: - example_code: | - ``` - number = 10 - {for} i {in} {range} 1 to 10 - {print} i * number - ``` - 12: - story_text: | - Now you can make a calculator that works for decimal numbers. - 14: - example_code: | - ``` - {define} calculate_mean_grade - total = 0 - {for} i {in} {range} 1 {to} 4 - grade = {ask} _ - total = total + _ - return _ / 4 - - mean_grade = {call} _ - {print} 'Your mean grade is ' mean_grade - ``` - - total = total + _ - return _ / 4 - - mean_grade = {call} _ - {print} 'Your mean grade is ' mean_grade - clear_command: - description: clear command - debugging: - levels: - 3: - example_code: | - **Warning! This code needs to be debugged!** - ``` - movie_choices {is} dracula, fast and furious, home alone, barbie - chosen_movie {is} movies {at} {random} - {print} Tonight we will watch chosen _movies - like {ask} Do you like that movie? - {print} Tomorrow we will watch something else. - {add} chosen_movie {to} movie_choices - {print} Tomorrow we will watch tomorrows_movie - tomorrows_movie {is} movie_choices {at} {random} - I'll go get the popcorn! {print} - ``` - 7: - story_text: |- - ### Exercise - Surprise! This program looks more like an output than a code. And yet, we don't want you to just add `{print}` commands in front of each line. - Fix this program to turn it into the nursery rhyme 'Brother John (Frère Jaques)' by using the {repeat} command of course! - 8: - example_code: | - **Warning! This code needs to be debugged!** - ``` - {print} 'Welcome to Manicures and Pedicures by Hedy' - bodypart = {ask} 'Are you getting your fingernails or toenails done today? Or both?' - {if} bodyparts {is} both - {print} That will be $25' - price = 25 - {else} - {print} That will be $18' - price = 18 - color = {ask} What color would you like? - sparkles = {ask} 'Would you like some sparkles with that?' - {if} sparkles {is} yes - {print} 'We charge $3 extra for that' - price = price + 3 - {else} {print} 'No sparkles' {print} 'So no extra charge' - {sleep} 5 - {print} 'All done! That will be $' price ' please!' - {print} 'Thank you! Byebye!' - ``` - 9: - example_code: | - **Warning! This code needs to be debugged!** - ``` - {print} 'Welcome to our sandwich shop' - amount 'How many sandwiches would you like to buy?' - {repeat} amount {times} - {ask} {is} {ask} 'What kind or bread would you like your sandwich to be?' - types_of_bread {is} white, wheat, rye, garlic, gluten free - {if} chosen_bread in types_of_bread - {print} 'Lovely!' - {else} - 'I'm sorry we don't sell that' - topping {is} {ask} 'What kind of topping would you like?' - sauce {is} {ask} 'What kind of sauce would you like?' - {print} One chosen_bread with topping and sauce. - price = amount * 6 - {print} 'That will be 'price dollar' please' - ``` - - price = amount * 6 - {print} 'That will be 'price dollar' please' - 10: - example_code: | - **Warning! This code needs to be debugged!** - ``` - names = Muad Hasan Samira Noura - activities = fly a kite, go swimming, go hiking, catch tan in the sun - {for} name {is} names - {print} At the beach name loves to activity at random - ``` - 11: - story_text: |- - ### Exercise - Debug this calender program. The output of this program is supposed to look like a list of dates. - For example: - - ``` - Hedy calender - Here are all the days of November - November 1 - November 2 - November 3 - ``` - And so on. - - Mind that you have to test your code extra carefully for the month February, because the amount of days in this month changes in leap years. - example_code: | - **Warning! This code needs to be debugged!** - ``` - print 'Hedy calender' - months_with_31 days = January, March, May, July, September, October, December - months_with_30_days = April, June, August, November - month = ask 'Which month would you like to see?' - if month in months_with_31_days - days = 31 - if month in months_with30_days - days = 30 - if month = February - leap_years = 2020, 2024, 2028, 2036, 2040, 2044, 2028 - year = ask 'What year is it?' - if year in leap_years - days = 29 - else - days = 28 - - print 'Here are all the days of ' moth - for i in range 1 to days - print month i - ``` - 12: - example_code: | - **Warning! This code needs to be debugged!** - ``` - define greet - greetings = 'Hello', 'Hi there', 'Goodevening' - print greetings at random - - define take_order - food = ask 'What would you like to eat?' - print 'One food' - drink = 'What would you like to drink?' - print 'One ' drink - more = ask 'Would you like anything else?' - if more is 'no' - print 'Alright' - else - print 'And ' more - print 'Thank you' - - print 'Welcome to our restaurant' - people = ask 'How many people are in your party tonight?' - for i in range 0 to people - call greet_costumer - ``` - 13: - example_code: | - **Warning! This code needs to be debugged!** - ``` - defin movie_recommendation with name - action_movies == 'Die Hard', 'Fast and Furious', 'Inglorious Bastards' - romance_movies = 'Love Actually', 'The Notebook', 'Titanic' - comedy_movies = 'Mr Bean' 'Barbie''Deadpool' - kids_movies = 'Minions', 'Paddington', 'Encanto' - if name is 'Camila' or name is 'Manuel' - recommended_movie = kids_movie at random - if name is 'Pedro' or 'Gabriella' - mood = ask 'What you in the mood for?' - if mood is 'action' - recommended_movie = comedy_movies at random - if mood is 'romance' - recommended_movie = romance_movies - if mood is 'comedy' - recommended_movie = comedy_movies at random - - print 'I would recommend ' recommended_movie ' for ' name - - name = ask 'Who is watching?' - recommendation = ask 'Would you like a recommendation?' - if recommendaion is 'yes' - print movie_recommendation with name - else - print 'No problem!' - ``` - 14: - example_code: | - **Warning! This code needs to be debugged!** - ``` - define calculate_heartbeat - print 'Press your fingertips gently against the side of your neck' - print '(just under your jawline)' - print 'Count the number of beats you feel for 15 seconds' - beats == ask 'How many beats do you feel in 15 seconds?' - heartbeat = beats*4 - print 'Your heartbeat is ' heartbeat - if heartbeat >= 60 or heartbeat <= 100 - print 'Your heartbeat seems fine' - else - if heartbeat > 60 - print 'Your heartbeat seems to be too low' - if heartbeat < 100 - print 'Your heartbeat seems to be too high' - print 'You might want to contact a medical professional' - - measure_heartbeat = ask 'Would you like to measure your heartbeat?' - if measure_heartbeat = 'yes' - call measure_heartbeat - else - 'no problem' - ``` - - print '(just under your jawline)' - print 'Count the number of beats you feel for 15 seconds' - beats == ask 'How many beats do you feel in 15 seconds?' - heartbeat = beats*4 - print 'Your heartbeat is ' heartbeat - if heartbeat >= 60 or heartbeat <= 100 - print 'Your heartbeat seems fine' - else - if heartbeat > 60 - print 'Your heartbeat seems to be too low' - if heartbeat < 100 - print 'Your heartbeat seems to be too high' - print 'You might want to contact a medical professional' - - measure_heartbeat = ask 'Would you like to measure your heartbeat?' - if measure_heartbeat = 'yes' - call measure_heartbeat - else - 'no problem' - 15: - example_code: | - **Warning! This code needs to be debugged!** - ``` - names = 'Tanya', 'Romy', 'Kayla', 'Aldrin', 'Ali' - verbs='walking', 'skipping', 'cycling', 'driving', 'running' - locations = 'on a mountaintop', 'in the supermarket', 'to the swimming pool' - hiding_spots = 'behind a tree', under a table', in a box' - sounds = 'a trumpet', 'a car crash', 'thunder' - causes_of_noise = 'a television', 'a kid with firecrackers', 'a magic elephant', 'a dream' - - chosen_ name = names at random - chosen_verb = verbs at random - chosen_location = 'locations at random' - chosen_sounds = noises at random - chosen_spot = hiding_spots random - chosen_causes = causes_of_noise at random - - print chosen_name ' was ' chosen_verb ' ' chosen_location - print 'when they suddenly heard a sound like ' sounds at random - print chosen_name ' looked around, but they couldn't discover where the noise came from' - print chosen_name ' hid ' chosen_spot' - print 'They tried to look around, but couldn't see anything from there' - hidden = 'yes' - while hidden = 'yes' - print chosen_name 'still didn't see anything' - answer = ask 'does ' chosen_name ' move from their hiding spot?' - if answer = 'yes' - hidden == 'no' - print 'chosen_name moved from' chosen_spot - print 'And then they saw it was just' chosen_cause - print chosen_name 'laughed and went on with their day' - print The End - ``` - 16: - example_code: | - **Warning! This code needs to be debugged!** - ``` - country = ['The Netherlands', 'Poland', 'Turkey', 'Zimbabwe', 'Thailand', 'Brasil', 'Peru', 'Australia', 'India', 'Romania' ] - capitals = 'Amsterdam', 'Warshaw' 'Istanbul', 'Harare', 'Bangkok', 'Brasilia', 'Lima', 'Canberra', 'New Delhi', 'Bucharest' - score = 0 - for i in range 0 to 10 - answer = ask 'What's the capital of ' countries[i] - correct = capital[i] - if answer = correct - print 'Correct!' - score = score + 1 - else - print 'Wrong,' capitals[i] 'in the capital of' countries[i] - print 'You scored ' score ' out of 10' - - ``` - 17: - example_code: | - **Warning! This code needs to be debugged!** - ``` - define food_order - toppings = ask 'pepperoni, tuna, veggie or cheese?' - size = ask 'big, medium or small?' - number_of_pizza = ask 'How many these pizzas would you like?' - - print 'YOU ORDERED' - print number_of_pizzas ' size ' topping ' pizza' - - define drinks_order - drink = ask 'water, coke, icetea, lemonade or coffee?' - number_of_drinks = ask 'How many of these drinks would you like?' - - print 'YOU ORDERED' - print number_of_drinks ' ' drink - - 'Welcome to Hedy pizza' - more_food = ask 'Would you like to order a pizza?' - while more_food = 'yes' - return food_order - more_food = ask 'Would you like to order a pizza?' - more_drinks = ask 'Would you like to order some drinks?' - while more_drinks == 'yes' - call drink_order - more_drinks == ask 'Would you like to order more drinks?' - - - print 'Thanks for ordering!' - ``` - 18: - example_code: | - **Warning! This code needs to be debugged!** - ``` - animals = ['pig', 'dog', 'cow'] - sounds = ['oink', 'woof', 'moo'] - for i in range 1 to 3 - animal = animals[i] - sound = sounds[i] - print 'Old MacDonald had a farm' - print 'E I E I O!' - print 'and on that farm he had a ' animal - print 'E I E I O!' - print 'with a ' sound sound ' here' - print 'and a ' sound sound ' there' - print 'here a ' sound - print 'there a ' sound - print 'everywhere a ' sound sound - ``` default: levels: 1: @@ -551,12 +101,6 @@ adventures: Στο επίπεδο 3 μπορείς να δημιουργήσεις μια λίστα. Μπορείς να αφήσεις τον υπολογιστή να επιλέξει κάτι τυχαία από τη λίστα. Αυτό γίνεται με τη χρήση της `at random`. 4: story_text: "Στο επίπεδο 4 οι εντολές `{ask}` and `{print}` αλλάζουν.\n\n Πρέπει να περικλείσεις το κείμενο που θέλεις να εμφανίσεις σε εισαγωγικά.\n \nΑυτό είναι χρήσιμο, επειδή τώρα μπορείς να εμφανίσεις όσες λέξεις θέλεις. Επίσης, τις λέξεις που αποθήκευες με την `{is}`.\n\nΟι περισσότερες γλώσσες προγραμματισμού χρησιμοποιούν εισαγωγικά όταν εμφανίζουν στην οθόνη, οπότε βρισκόμαστε ένα βήμα πιο κοντά στον πραγματικό προγραμματισμό!\n\nΘα βρεις τις εντολές στα αριστερά και πάλι, και τις ασκήσεις στις ακόλουθες καρτέλες. Οι ασκήσεις πλέον γίνονται όλο και πιο δύσκολες στις διαδοχικές καρτέλες. \nΈτσι, είναι καλύτερα να ξεκινήσεις από τα αριστερά με την ιστορία, και να δουλεύεις στα δεξιά, έτσι ώστε να προσπαθείς όλο και περισσότερο.\n" - example_code: | - ``` - print 'You need to use quotation marks from now on!' - answer is ask 'What do we need to use from now on?' - print 'We need to use ' answer - ``` 5: story_text: | Οι `ask` και `print` λειτουργούν ακριβώς όπως στο επίπεδο 4. @@ -622,22 +166,6 @@ adventures: else print 'η πίτσα είναι καλύτερη!' ``` - - food = ask 'Τι θέλεις;' - if food is 'πίτσα' - print 'ωραία!' - else - print 'η πίτσα είναι καλύτερη!' - 10: - story_text: | - In this level we learn a new code called `for`. With `for` you can make a list and use all elements. - `for` creates a block, like `repeat` and `if` so all lines in the block need to start with spaces. - example_code: |- - ``` - animals is dog, cat, blobfish - for animal in animals - print 'I love ' animal - ``` 12: story_text: "Μέχρι τώρα η Hedy δενεπέτρεπε δεκαδικούς αριθμούς όπως 1.5, αλλά δεν θα το επιτρέψουμε πλέον. Σημείωσε ότι οι υπολογιστές χρησιμοποιούν το `.` για τους δεκαδικούς αριθμούς.\n\nΑπό αυτό το επίπεδο και μετά πρέπει να χρησιμοποιείς τα εισαγωγικά όταν αποθηκεύεις κείμενο με `=`:\n\nΟι λίστες είναι κείμενα, άρα θέλουν επίσης εισαγωγικά. Πρόσεξε ότι κάθε στοιχείο στη λίστα έχει εισαγωγικά. \nΑυτό σου επιτρέπει να αποθηκέυσεις δυο λέξεις ως ένα στοιχείο, πχ 'Black Widow'.\n\n\nΓια τους αριθμούς, δεν χρησιμοποιούνται εισαγωγικά στο `=`/\n" example_code: |- @@ -649,31 +177,14 @@ adventures: print 2.5 + 2.5 13: story_text: Τώρα θα μάθουμε τα `and` και `or`! Αν θέλεις να ελέγξεις δύο δηλώσεις, δεν χρειάζεται να χρησιμοποίησεις δύο if αλλά μπορείς να χρησιμοποιήσεις τα `and` και `or`. Αν χρησιμοποιήσεις τo `and`, και οι δύο προτάσεις, αριστερά και δεξιά από το `and` θα πρέπει να είναι αληθείς. Μπορούμε επίσης να χρησιμοποιήσουμε το `or`. Τότε, μόνο μια πρόταση χρειάζεται να είναι αληθής. - example_code: | - ``` - name = ask 'what is your name?' - age = ask 'what is your age?' - if name is 'Hedy' and age is 2 - print 'You are the real Hedy!' - ``` 14: story_text: "Θα μάθουμε μερικά ακόμα νέα πράγματα! Ίσως να τα γνωρίζεις ήδη από τα μαθηματικά, τα `<` και `>`. \nΤο `<` ελέγχει αν ο πρώτος αριθμός είναι μικρότερος από τον δεύτερο, πχ `age < 12` ελέγχει αν το `age` είναι μικρότερο από 12.\nΑν θέλεις να ελέγξεις αν ο πρώτος αριθμός είναι μικρότερος ή ίσος από τον δεύτερο, μπορείς να χρησιμοποιήσεις `<=`, πχ`age <= 11`.\n Το `>` ελέγχει αν ο πρώτος αριθμός είναι μεγαλύτερος από τον δεύτερο, πχ `points > 10` ελέγχει αν `points` είναι μεγαλύτερο από 10.\nΑν θέλεις να ελέγξεις αν ο πρώτος αριθμός είναι μεγαλύτερος ή ίσος από τον δεύτερο, μπορείς να χρησιμοποιήσεις`>=`, πχ `points >= 11`.\nΧρησιμοποιείς αυτές τις συγκρίσεις μέσα σε ένα `{if}`, ως εξής." - example_code: | - ``` - age = {ask} 'How old are you?' - {if} age > 12 - {print} 'You are older than I am!' - ``` 15: story_text: "Θα μάθουμε ένα νέο βρόχο, το βρόχο `while`! Συνεχίζουμε το βρόχο για όσο η πρόταση είναι αληθής/ορθή! \nΜην ξεχάσεις να αλλάξεις την τιμή στον βρόχο.\n\nΈτσι στο παράδειγμα του κώδικα, συνεχίζουμε ώσπου να δοθεί μια σωστή απάντηση. \nΑν δε δοθεί ποτέ η σωστή απάντηση, ο βρόχος δε θα σταματήσει ποτέ!\n" example_code: | ``` answer = 0 while answer != 25 - answer = ask 'What is 5 times 5?' - print 'A correct answer has been given' - ``` - answer = ask 'Πόσο κάνει 5 φορές το 5;' print 'Δόθηκε η σωστή απάντηση' 16: @@ -681,10 +192,6 @@ adventures: example_code: \n```\nfriends = ['Μαρία', 'Κώστας', 'Αλκμήνη']\nlucky_numbers = [15, 18, 6]\n{for} i {in} {range} 1 {to} 3\n {print} 'ο τυχερός αριθμός του/της' friends[i]\n {print} 'είναι' lucky_numbers[i]\n```\n" 17: story_text: "Τώρα θα αλλάξουμε λίγο τις εσοχές. Κάθε φορά που χρειαζόμαστε μια εσοχή, χρειαζόμαστε ένα `:` στη γραμμή πριν την εσοχή.\n\nΣ' αυτό το επίπεδο μπορείς επίσηςνα χρησιμοποιήσει ςμια νέα εντολή: `{elif}`. 'Η`{elif}` είναι σύντμηση των `{else} {if}` και θα το χρειαστείς όταν θέλεις να έχεις 2 (ή περισσότερες!) επιλογές. \nΔοκίμασέ το!." - 18: - story_text: |- - We arrived at real Python code! That means we need to use parentheses with {print} and {range} from now on. - {print}('My name is ', naam) dice: name: Φτιάξε τα δικά σου ζάρια default_save_name: ζάρια @@ -737,8 +244,6 @@ adventures: Κατάφερες να υπολογίσεις το σκορ για 8 ζάρια; Χρειάστηκε αρκετή αποκοπή και επικόλληση, έτσι; Θα το κάνουμε πιο εύκολο στο επίπεδο 7! - example_code_2: | - Did you manage to calculate the score for 8 dice? That required a lot of cutting and pasting, right? We are going to make that easier in level 7! 7: story_text: | Μπορείς να φτιάξεις ένα ζάρι και πάλι στο επίπεδο 6. Με την εντολή `repeat` μπορείς έυκολα να ρίξεις μια ολόκληρη χούφτα από ζάρια. @@ -750,9 +255,6 @@ adventures: choices is 1, 2, 3, 4, 5, σκουληκάκι repeat _ _ print _ _ _ ``` - 10: - story_text: | - Is everybody taking too long throwing the dice? In this level you can let Hedy throw all the dice at once! dishes: name: Ποιός πρέπει να πλύνει τα πιάτα default_save_name: πιάτα @@ -766,8 +268,6 @@ adventures: Πρώτα φτιάξε μια λίστα με τα μέλη της οικογένειάς σου. Ύστερα επίλεξε 'τυχαία' από τη λίστα. example_code: "```\npeople is μαμά, μπαμπάς, Ελένη, Σοφία\nprint people at random\n```\n\nΔοκίμασες να κάνεις μια πρόταση χρησιμοποιώντας τη λέξη people; \n\nΔηλαδή, `print Επέλεξα από αυτούς τους people`. Αν δεν το έχεις κάνει ήδη, πήγαινε να το δοκιμάσεις! \n\nΘα δεις ότι δε δουλεύει σωστά. H Hedy θα εμφανίσει: Επέλεξα από αυτούς τους [μαμά, μπαμπάς, Ελένη, Σοφία]. Αυτό μπορείς να το λύσεις στο επίπεδο 3.\n" - story_text_2: | - Don't feel like doing the dishes yourself? Hack the program to remove your name from the list. 4: story_text: | Με εισαγωγικά μπορείς να κάνεις τον προγραμματισμό του πλυσίματος πιάτων πιο όμορφο. @@ -804,12 +304,6 @@ adventures: Τώρα θα πρέπει να κάνεις πολλή αντιγραφή και επικόλληση, έτσι; Αυτό θα το διορθώσουμε στο επίπεδο 7. Αυτό το επίπεδο είναι το τέλος της περιπέτειας του πλυσίματος! Όμως υπάρχουν πολλές ακόμα περιπέτειες να ακολουθήσεις σε άλλα επίπεδα, όπως το κομπιουτεράκι, μια διαδραστική ιστορία και ένα πιο περίπλοκο παιχνίδι. - story_text_2: | - If you are extremely unlucky the previous program might choose you to to the dishes for the whole week! That's not fair! - To create a fairer system you can use the `{remove}` command to remove the chosen person from the list. This way you don't have to do the dishes again untill everybody has had a turn. - - Monday and tuesday are ready for you! Can you add the rest of the week? - And... can you come up with a solution for when your list is empty? example_code_2: |- ``` people is μαμά, μπαμπάς, Ελένη, Σοφία @@ -827,417 +321,6 @@ adventures: people is μαμά, μπαμπάς, Ελένη, Σοφία repeat _ _ print 'αυτό που θα πλύνει τα πιάτα είναι' _ ``` - 10: - story_text: | - In this level you could make an even better dish washing shedule. - elif_command: - description: elif - levels: - 17: - example_code: | - ``` - prices = ['1 million dollars', 'an apple pie', 'nothing'] - your_price = prices[{random}] - {print} 'You win ' your_price - {if} your_price == '1 million dollars' : - {print} 'Yeah! You are rich!' - {elif} your_price == 'an apple pie' : - {print} 'Lovely, an apple pie!' - {else}: - {print} 'Better luck next time..' - ``` - for_command: - description: for command - levels: - 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. - We do that by adding a variable name, followed by `{in}` `{range}`. We then write the number to start at, `{to}` and the number to end at. - Try the example to see what happens! In this level again, you will need to use indentations in lines below the `{for}` statements. - fortune: - levels: - 1: - story_text: | - Have you ever been to a carnival and had your future predicted by a fortune teller? Or have you ever played with a magic eight ball? - Then you probably know that they can't really predict your future, but it's still fun to play! - - In the upcoming levels you can learn how to create your own fortune telling machine! - In level 1 you can start off easy by letting Hedy introduce herself as a fortune teller and let her {echo} the players' answers. - Like this: - story_text_2: | - ### Exercise - Hedy now only tells you your name. Can you expand the code so that Hedy can predict more things about you? - Obviously, Hedy isn't a very good fortune teller yet, as she can only repeat the answers that were given by the players! - Take a look in level 2 to improve your fortune teller. - 3: - story_text: | - In the previous levels you've created your first fortune telling machine, but Hedy couldn't really predict anything, only {echo}. - In this level you can use a variable and the `{at} {random}` command to really let Hedy choose an answer for you. Check out this code for instance: - story_text_2: | - ### Exercises - Now, Hedy can only answer yes, no or maybe. Can you give Hedy more answer options, like 'definitely' or '{ask} again'. - 5: - story_text: | - In this level you'll learn to (secretly) tip the odds in your favor, when using the fortune teller! - By using `{if}` and `{else}` you can make sure that you will always get a good fotune, while other people might not. - Check out this example to find out how. - 6: - story_text: | - In this level you can use math in your predictions as a fortune teller. This allows you to make up (silly) formulas to calculate the future. - For example you could calculate how rich you'll get or how many kids you will have when you grow up. - 7: - story_text: | - In this level you can use the `{repeat}` command to make your machine tell multiple fortunes at once. - 8: - story_text: | - In the previous levels you've learned how to use repeat to make the fortune teller answer 3 questions in a row, but we had a problem with printing the questions. - Now that problem is solved, because of the new way of using the repeat command. - In the next example you can have your fortune teller {ask} 3 questions and also print them! - example_code: | - ``` - {print} 'I am Hedy the fortune teller!' - {print} 'You can ask me 3 questions.' - answers = yes, no, maybe - _ _ _ - question = {ask} 'What do you want to know?' - {print} question - {sleep} - {print} 'My crystal ball says...' answers {at} {random} - ``` - 10: - story_text: | - In this level you'll learn how to program the game MASH (mansion, apartement, shack, house). In this game you can predict for all the players at once, what their future will look like. - 12: - story_text: | - In this level you can make your fortunes multiple words. Like in this example below: - functions: - levels: - 12: - example_code: | - ``` - sides = 'left', 'right' - limbs = 'hand', 'foot' - colors = 'red', 'blue', 'green', 'yellow' - - {define} turn - chosen_side = sides {at} {random} - chosen_limb = limbs _ - chosen_color = colors _ - {print} chosen_side ' ' chosen_limb ' on ' chosen_color - - {print} 'Lets play a game of Twister!' - {for} i {in} {range} 1 to _ - {call} turn - {sleep} 2 - ``` - 13: - story_text: | - Now that you've learned how to use functions, you'll learn how to use a function with an argument. - An **argument** is a variable that is used within a function. It is not used outside the function. - - For example in this code we've programmed the first verse of the song 'My Bonnie is over the ocean'. - In this example code the argument `place` is used. Place is a variable that is only used in the function, so an argument. - To use `place` we have programmed the line `define song with place`. - When the function is called, computer will replace the argument `place`, with the piece of text after `call song with`. - - ### Exercise - The next verse of this song goes: - - Last night as I lay on my pillow - Last night as I lay on my bed - Last night as I lay on my pillow - I dreamed that my Bonnie is dead - - Can you program this verse in the same way as the example? - 14: - example_code: | - ``` - {define} calculate_new_price {with} amount, percentage - percentage = percentage / 100 - discount_amount = amount * percentage - return amount - discount_amount - - old_price = {ask} 'How much is on the price tag?' - discount = {ask} 'What percentage is the discount?' - - new_price = _ calculate_new_price {with} old_price, _ - {print} 'The new price is ' new_price ' dollar' - ``` - haunted: - levels: - 1: - story_text: | - In this adventure you are working towards making a game in which you have to escape from a haunted house by picking the correct door. - If you pick the right door you'll survive, but {if} not a terrible monster might... - - In level 1 we start our haunted house game by making up a scary story and {ask} the player what monster they'll see in the haunted house. - story_text_2: | - Can you finish the scary story? Or make up your own haunted house story? - 2: - example_code: | - ``` - monster_1 {is} 👻 - monster_2 {is} 🤡 - monster_3 {is} 👶 - {print} You enter the haunted house. - {print} Suddenly you see a monster_1 - {print} You run into the other room, but a monster_2 is waiting there for you! - {print} Oh no! Quickly get to the kitchen. - {print} But as you enter monster_3 attacks you! - ``` - example_code_2: | - ``` - monster_1 {is} _ - monster_2 {is} _ - monster_3 {is} _ - {print} You enter the haunted house. - {print} Suddenly you see a monster_1 - {print} You run into the other room, but a monster_2 is waiting there for you! - {print} Oh no! Quickly get to the kitchen. - {print} But as you enter monster_3 attacks you! - ``` - 3: - story_text: | - In the previous levels you've made an introduction to your haunted house game, but as you might have noticed the story would always have a dreadful end. - In this level you can make your story more interactive by changing the outcome of the game; sometimes you'll get eaten, sometimes you'll escape! - Let Hedy decide randomly! - 4: - story_text: | - In this level you learn how to use quotation marks in your games. - Can you make your Haunted House level 4 proof? - example_code: | - ``` - {print} _Escape from the haunted house!_ - {print} _There are 3 doors in front of you..._ - choice {is} {ask} _Which door do you choose?_ - {print} _You picked door ..._ choice - monsters {is} a zombie, a vampire, NOTHING YOUVE ESCAPED - {print} _You see..._ - {sleep} - {print} monsters {at} {random} - ``` - 5: - story_text: | - Up until this level the haunted house game always asked the player to choose a door, but as you might have noticed, they didn't really have to answer correctly. - If the player filled in a completely random answer, the game would still work and the player might even win (despite not picking a door). - In this level you can only win the game by picking the same door Hedy picked randomly. - example_code: | - ``` - {print} 'Escape from the haunted house!' - {print} 'There are 3 doors in front of you...' - doors {is} 1, 2, 3 - monsters {is} werewolf, mummy, vampire, zombie - chosen_door {is} {ask} 'Which door do you choose?' - {print} 'You chose door...' chosen_door - {sleep} - correct_door {is} doors {at} {random} - {if} chosen_door {is} correct_door {print} 'Great! Youve escaped!' - {else} {print} 'Oh no! You are being eaten by a...' monsters {at} {random} - ``` - 9: - story_text: | - In this level you can use nesting, which allows you to make the haunted house even more interactive! - - Now it's very hard to win this game, can you make it easier to win? - For example by only having 1 wrong door and 2 correct doors instead of 1 correct door and 2 wrong ones? - 11: - story_text: | - In this level we've changed the repeat command and we've added a line to our haunted house that tells the player in which room they are. - example_code: | - ``` - {print} 'Escape from the Haunted House!' - player {is} alive - doors = 1, 2, 3 - monsters = zombie, vampire, giant spider - {for} i {in} {range} 1 {to} 3 - {if} player {is} alive - correct_door = doors {at} {random} - {print} 'Room ' i - {print} 'There are 3 doors in front of you...' - chosendoor = {ask} 'Which door do you choose?' - {if} chosendoor {is} correct_door - {print} 'No monsters here!' - {else} - {print} 'You are eaten by a ' monsters {at} {random} - player = dead - {else} - {print} 'GAME OVER' - {if} player {is} alive - {print} 'Great! You survived!' - ``` - if_command: - description: Introducing the if command - levels: - 9: - story_text: | - In this level you can also put an {if} command inside another {if} command. - in_command: - description: Introducing the in command - levels: - 5: - example_code_2: | - ``` - animals is dog, cow, sheep - answer is ask 'What is your favorite animal?' - _ answer _ animals _ 'Mine too!' - _ _ 'My favorite animals are dogs, cows and sheep' - ``` - is_command: - description: introducing is command - levels: - 2: - story_text_2: | - ### Exercise - Time to make your own variables! - In the example code we made an example of the variable `favorite_animal`. In line 1 the variable is set, and in line 2 we haved used the variable in a print command. - Firstly, finish our example by filling in your favorite animal on the blank. Then make at least 3 of these codes yourself. Pick a variable, and set the variable with the {is} command. Then use it with a {print} command, just like we did. - 14: - example_code: | - ``` - age = {ask} 'How old are you?' - {if} age > 12 - {print} 'You are older than I am!' - ``` - example_code_3: | - ``` - name = {ask} 'What is your name?' - {if} name != 'Hedy' - {print} 'You are not Hedy' - ``` - - {if} age < 13 - {print} 'You are younger than me!' - {else} - {print} 'You are older than me!' - language: - levels: - 5: - story_text: | - Make your own program to practice your vocabulary in a new language. - maths: - levels: - 6: - example_code: | - ``` - {print} '5 plus 5 is ' 5 + 5 - {print} '5 minus 5 is ' 5 - 5 - {print} '5 times 5 is ' 5 * 5 - ``` - 12: - example_code_2: | - ``` - a = 'Hello ' - b = 'world!' - {print} a + b - ``` - - {print} 2.5 + 2.5 - music: - levels: - 6: - story_text: "Instead of playing notes, you can also play numbers now. Simply type `{play} 1` for the lowest note, `{play} 70` for the highest note, or anything in between.\n\n### Exercise\n This calls for musical maths! Try out the example code a couple of times with different starting numbers. \nThen, see if you can compose a song using the numbers.\n" - parrot: - levels: - 1: - story_text_2: | - ### Exercise - Can you make the parrot ask a different question? Fill in the blanks in the example! - 2: - story_text: | - Create your own online pet parrot that will copy you! - story_text_2: | - ### Exercise - You can use variables to make the parrot say more than only your name. Can you complete this code? - 3: - story_text: | - Teach your parrot a new word with `{add}`. - 4: - story_text: | - In this level we have to use quotation marks with the commands `{ask}` and `{print}`. - Can you complete the code by adding quotation marks? - 5: - story_text: | - Reward your parrot {if} it says the correct word! - piggybank: - levels: - 12: - story_text: | - In this adventure you learn how to make a digital piggy bank, to calculate how much money you have and how long you need to save up to buy what you want! - 14: - example_code: | - ``` - _ calculate_budget with wish, money, allowance - to_save = wish - money - weeks = to_save / allowance - {if} wish _ money - {print} 'You need to save up some more!' - {print} 'Youll need ' weeks ' more weeks.' - {else} - {print} 'Great! You have enough' - {print} 'Lets go shopping!' - - money = {ask} 'How much money have you saved?' - wish = {ask} 'How much money do you need?' - allowance = {ask} 'How much pocket money do you get each week?' - - {call} calculate_budget with _, _, _ - ``` - pressit: - levels: - 9: - story_text: | - Now that you know how to combine statements, you can create a touch type tool with `{pressed}`. - - ### Exercise - Finish the code. Each time a random letter should be chosen, which you have to press. You get a point for a correct press, and and two points deduction for a wrong press. - **(extra)** Clear the screen after each letter, and show the user how many points they have scored. - print_command: - levels: - 18: - example_code_2: | - ``` - temperature = 25 - {print}('It is ', temperature, ' degrees outside') - ``` - - {print}('My name is ', name) - random_command: - levels: - 16: - story_text: |- - We are going to make lists the Python way, with square brackets around the lists! We also keep the quotation marks around each item like we have learned in previous levels. - We use square brackets to point out a place in a list. For example: `friends[1]` is the first name on the list of friends, as you can see in the first part of the example code. The second part of the example code shows you that we can also match 2 lists using the variable i. - repeat_command: - description: repeat command - levels: - 7: - story_text: | - ## Repeat! Repeat! Repeat! - Level 7 adds the `{repeat}` command. `{repeat}` can be used to execute one line of code multiple times. Like this: - - ### Exercise - Play around with the repeat command. Can you make the happy birthday song in only 3 lines of code instead of 4 now? - 9: - story_text: | - 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: | - ``` - 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: - description: repeat command 2 - levels: - 7: - story_text_2: | - Another interesting thing you can so with the `{repeat}` command is using variables to set the amount of times something should be repeated. In the example code you can see that we first ask the person how old they are. - Then, in line 3, the question is repeated 'age' times. So we have used the variable 'age' with the `{repeat}` command. restaurant: name: Εστιατόριο default_save_name: Εστιατόριο @@ -1265,9 +348,6 @@ adventures: print Σας ευχαριστώ για την παραγγελία. print Το φαγητό και τα ποτά σας θα είναι έτοιμα αμέσως! ``` - story_text_2: | - ### Exercise - Can you make this code more elaborate? For example by adding drinks to the order? Or...? 3: story_text: | Δυσκολεύεσαι να αποφασίσεις τί θέλεις να φάς για δείπνο. Μπορείς να αφήσεις τη Hedy να επιλέξει για σένα! @@ -1289,94 +369,6 @@ adventures: print Το κόστος θα είναι: prices at random print Ευχαριστούμε και καλή όρεξη! ``` - story_text_2: | - Does your costumer have any allergies or do they dislike certain dishes? Then you can use the `{remove}`command to remove it from your menu. - example_code_2: | - ``` - {print} Mystery milkshake - flavors {is} strawberry, chocolate, vanilla - allergies {is} {ask} Are you allergic to any falvors? - {remove} allergies {from} flavors - {print} You get a flavors {at} {random} milkshake - ``` - 4: - story_text: | - ### Exercise - Add the quotation marks to this code to make it work! Be careful: variables should not be in quotation marks. - Then, use the `{clear}` command to only show one line at a time in your output screen. - - ### Exercise 2 - Go back to the previous level and copy your restaurant code. Make the code work in this level by adding quotation marks in the right spots and add some `{clear}` commands. - 5: - story_text: | - In this level the {if} command allows you to {ask} your customers questions and give different responses to the answers. - In the example below, you see that you can {ask} the customer {if} they want to hear the specials and Hedy can respond accordingly. - 6: - story_text: | - In this level you can use maths to calculate the total price of your customer's order, which can make your virtual restaurant more realistic. - example_code: | - You can make a simple restaurant code, like this: - ``` - {print} 'Welcome to Hedys restaurant' - {print} 'Here is our menu:' - {print} 'Our main courses are pizza, lasagne, or spaghetti' - main = {ask} 'Which main course would you like?' - price = 0 - {if} main {is} pizza price = 10 - {if} main {is} lasagne price = 12 - {if} main {is} spaghetti price = 8 - {print} 'You have ordered ' main - {print} 'That will be ' price ' dollars, please' - {print} 'Thank you, enjoy your meal!' - ``` - 7: - story_text: |- - In this level you've learned how to use the {repeat} command to repeat a line of code a certain amount of times. - You can use that in your restaurant to {ask} multiple people what they'd like to eat. - example_code: | - ``` - {print} 'Welcome to Hedys restaurant!' - people = {ask} 'How many people are joining us today?' - {repeat} people times food = {ask} 'What would you like to eat?' - {print} 'Thanks for your order! Its coming right up!' - ``` - 9: - story_text: | - In this level you can use nesting to make your restaurant more realistic and more fun! - For example you would {ask} for sauce {if} somebody orders fries, but you wouldn't {if} someone orders pizza! - Check out the example, and try this at your own virtual restaurant! - 10: - story_text: | - In this level you'll learn how to easily {ask} your guests' orders in a short code. - example_code_2: | - ``` - courses = appetizer, main course, dessert - names = Timon, Onno - {for} name {in} names - {for} course {in} courses - food = {ask} name ', what would you like to eat as your ' course '?' - {print} name ' orders ' food ' as their ' course - ``` - 11: - story_text: | - We can use the `{for} i {in} {range} 1 {to} 5` to {print} the orders from multiple customers in an orderly manner. - 12: - story_text: | - From this level on you can use decimal numbers to make you menu more realistic. - 13: - story_text: | - In this level we can use the new commands to upgrade our restaurant. - We use `{and}` to see {if} two things are both the case. - example_code: | - ``` - price = 10 - food = {ask} 'What would you like to eat?' - drinks = {ask} 'What would you like to drink?' - {if} food {is} 'sandwich' {and} drinks {is} 'juice' - {print} 'Thats our discount menu' - price = price - 3 - {print} 'That will be ' price ' dollars' - ``` rock: name: Πέτρα, ψαλίδι, χαρτί default_save_name: Πέτρα @@ -1401,16 +393,6 @@ adventures: Μπορείς να χρησιμοποιήσεις την `ask` και πάλι στο επίπεδο 2. Μπορείς να εμφανίσεις την επιλογή σου και την επιλογή από τον υπολογιστή; Προσοχή όμως, η `ask` τώρα λειτουργεί διαφορετικά απ'ότι στο επίπεδο 1. Θα πρέπει να υπάρχει ένα όνομα πριν από αυτή. - story_text_2: | - ### Exercise - Now you only have one player, so can you add a second player? - You can even use variables to name player 1 and player 2. - example_code_2: | - ``` - choices {is} rock, paper, scissors - {print} player 1 chooses... choices {at} {random} - {print} player 2 _ - ``` 5: story_text: | Στο επίπεδο 4 μπορούμε να αποφασίσουμε ποιός θα κερδίσει. Για αυτό θα χρειαστούμε τον νέο κώδικα `if`. @@ -1429,75 +411,6 @@ adventures: ``` Πρώτα, συμπλήρωσε το σωστό κώδικα στις τελίτσες για να δεις αν είναι ισοπαλία. - 9: - story_text: | - In this level you can program the whole rock, paper, scissors game by nesting the {if}-commands. Can you finish the code? - example_code: | - ``` - choices = rock, paper, scissors - your_choice = {ask} 'What do you choose?' - {print} 'You choose ' your_choice - computer_choice = choices {at} {random} - {print} 'The computer chooses ' computer_choice - {if} computer_choice {is} your_choice - {print} 'Tie' - {if} computer_choice {is} rock - {if} your_choice {is} paper - {print} 'You win!' - {if} your_choice {is} scissors - {print} 'You lose!' - # finish this code - ``` - 10: - story_text: | - Feeling too lazy to play the game yourself? Let Hedy play it for you! - 13: - story_text: | - With the `{and}` command you can shorten your rock, paper, scissors code! Check out the example code below and try to finish it. - rock_2: - levels: - 2: - story_text: | - Now that you have learned how to use the `{ask} command, you can make your rock, paper, scissors code interavtive too! - - ### Exercise - Make the rock, paper, scissors code interactive by adding the `{ask}` command and a question to your rock, paper, scissors code. - example_code: | - ``` - choice is _ - {print} I choose choice - ``` - secret: - default_save_name: language - levels: - 12: - story_text: | - In this adventure you can create your own super spy code. Encode a message that only the right agent can decipher. - If the enemy tries to crack the code, they will get some false info to waste their time. - example_code: | - ``` - name {is} {ask} 'What is your name?' - {if} name {is} '_' - a {is} 'Go to the airport ' - {else} - a {is} 'Go to the trainstation ' - password {is} {ask} 'What is the password?' - {if} password {is} _ - b {is} 'tomorrow at 02.00' - {else} - b {is} 'today at 10.00' - {print} _ _ _ - ``` - 13: - story_text: | - The code you made in the previous level can be made a lot easier in this one with the `{and}` command. - sleep_command: - description: introducing sleep command - levels: - 2: - story_text: | - ## The sleep command - Another new command in this level is `{sleep}`, which pauses your program for a second. If you type a number behind the {sleep} command, the program pauses for that amount of seconds. songs: name: Τραγούδα ένα τραγούδι! default_save_name: τραγούδι @@ -1525,16 +438,7 @@ adventures: * repeat 3 times print 'Μωρό Καρχαρίας Τουτουρουτουτου' Όμως όπως θα δείτε σε αυτό το μάθημα, κάποιες φορές θέλεις να επαναλάβεις αρκετές γραμμές μαζί. Αυτό μπορεί να γίνει με αποκοπή και επικόλληση, όμως αυτό απαιτεί αρκετή δουλειά. Στο επίπεδο 7 θα μάθες πώς να το κάνεις αυτό εύκολα. - example_code_2: | - ``` - number = 6 - number = number - 1 - print number ' little monkeys jumping on the bed' - print 'One fell off and bumped his head' - print 'Mama called the doctor and the doctor said' - print 'NO MORE MONKEYS JUMPING ON THE BED!' - sleep - ``` + 7: story_text: | Τα τραγούδια συχνά περιλαμβάνουν αρκετή επανάληψη. Για παράδειγμα... το Μωρό Καρχαρίας! Αν το τραγουδήσεις, τραγουδάς διαρκώς το ίδιο πράγμα: @@ -1552,229 +456,3 @@ adventures: repeat _ _ print 'Μωρό Καρχαρίας τουτουρουτουτου' print 'Μωρό Καρχαρίας' ``` - 8: - story_text: | - In a previous level you've programmed the song 'Bottles of beer'. You made one verse and then had to copy the verses 99 times. In level 7 you can repeat the song 99 times, just by adding one simple line! - 10: - story_text: | - In this level you can easily make the childrens' song 'Five little monkeys'. Can you make the last chorus? - You can also make the whole baby shark song (including all the other sharks in the family) in only 6 lines! - Or you can make Old MacDonald with all the different animals. - example_code: | - ``` - monkeys = 5, 4, 3, 2 - {for} monkey {in} monkeys - {print} monkey ' little monkeys jumping on the bed' - {print} 'One fell off and bumped his head' - {print} 'Mama called the doctor and the doctor said' - {print} 'NO MORE MONKEYS JUMPING ON THE BED!' - ``` - - ``` - sharks = baby, mommy, daddy, grandma, grandpa - {for} shark {in} sharks - {print} shark 'tututututudu' - {print} shark 'tututututudu' - {print} shark 'tututututudu' - {print} shark - ``` - ``` - animals = pig, dog, cow - {for} animal {in} animals - {if} animal {is} pig - sound = oink - {if} animal {is} dog - sound = woof - {if} animal {is} cow - sound = moo - {print} 'Old MacDonald had a farm' - {print} 'E I E I O!' - {print} 'and on that farm he had a ' animal - {print} 'E I E I O!' - {print} 'with a ' sound sound ' here' - {print} 'and a ' sound sound ' there' - {print} 'here a ' sound - {print} 'there a ' sound - {print} 'everywhere a ' sound sound - ``` - story_text_2: | - ### Exercise 2 - Print the song Five little moneys jumping on the bed. Look up the text if you don't remember. - - **(extra)** Print the song Old MacDonald had a farm, and make sure all animals make a different sound, using an `{if}`. - 11: - story_text: | - In this level you can use the `{for} i {in} {range}` command to make songs that use counting. - example_code: | - ``` - {for} i {in} {range} 5 {to} 1 - {print} i ' little monkeys jumping on the bed' - {print} 'One fell off and bumped his head' - {print} 'Mama called the doctor and the doctor said' - {if} i {is} 1 - {print} 'PUT THOSE MONKEYS RIGHT TO BED!' - {else} - {print} 'NO MORE MONKEYS JUMPING ON THE BED!' - ``` - 12: - story_text: | - In this song we can make it even easier to program '{if} you're happy and you know it, clap your hands'. Because we can put all of the actions in a variable, check it out: - songs_2: - levels: - 12: - example_code: | - ``` - {define} twinkle - {print} 'Twinkle' - {print} '...' - - {call} twinkle - {print} 'Up above the world so high' - {print} 'Like a diamond in the sky' - {call} _ - ``` - turtle: - default_save_name: turtle - levels: - 2: - story_text: | - In level 1 the turtle could only turn left or right. That is a bit boring! - In level 2 he can point his nose in all directions. - - Use 90 to turn a quarter. We call this degrees. A full turn is 360 degrees. - Can you make a figure with this code? Maybe a triangle or a circle? - example_code: | - ``` - answer {is} {ask} How many steps should the turtle make? - {forward} answer - ``` - story_text_2: | - Also, in level 1 the turtle could only turn left or right. That is a bit boring! - In level 2 he can point his nose in all directions. - - Use 90 to turn a quarter. We call this degrees. A full turn is 360 degrees. - Can you make a figure with this code? Maybe a triangle or a circle? - example_code_2: | - ``` - {print} Drawing figures - angle {is} 90 - {turn} angle - {forward} 25 - {turn} angle - {forward} 25 - ``` - 3: - story_text: | - In this level you can use use `{random}` with the drawing turtle. A random choice makes the turtle walk a different path each time. - Use `{at} {random}` to choose a value from a list. You can copy and paste lines 2 and 3 to create a longer random path. - 5: - example_code_2: | - ``` - direction {is} {ask} 'Do you want to go left, right, or straight ahead?' - if direction is left turn _ - if direction is right turn _ - forward 100 - ``` - 8: - story_text: | - Now that we can repeat several lines, we can make figures more easily. - We only have to set the angle once and then use that variable in the `{repeat}`. - story_text_2: | - Also, we can now improve the program that draws different figures. - Can you figure out how far the turtle has to turn here? Finish the code and you can draw any polygon you'd like! - 9: - story_text: | - Now that we can use a `{repeat}` inside a `{repeat}`, we can create more complex figures. - - ### Exercise 1 - This code creates three black triangles, change that into five pink squares. - - **(extra)** Create a figure of your own choosing consisting of at least two different shapes types. - 10: - story_text: | - In this level you can make the turtle draw a figure. - The turtle will travel the distances in the list, one by one, making bigger and bigger steps. - ### Exercise 1 - Add a 90 degree turn in the loop, so that a spiral is drawn. - Add at least 5 numbers to the list, so the spiral grows larger. - **(extra)** can you change the spiral into another shape? Experiment with numbers for the turn! - ### Exercise 2 - The spiral is drawn outwards, make it go inwards? - turtle_draw_it: - levels: - 9: - example_code: | - Hint for the nested squares: - ``` - colors = red, blue, orange, yellow, pink, purple, green, brown, black - distance = 120 - repeat 5 times - _ - ``` - Hint for the flags: - ``` - country = ask 'which country would you like to see the flag of?' - if country is 'the Netherlands' - color_1 = red - color_2 = white - color_3 = blue - ``` - 10: - example_code: | - Hint Nested Hexagon: - ``` - distances = 100, 80, 60, 40, 20 - {for} distance {in} distances - _ - ``` - - Hint Traffic Lights: - ``` - colors = red, yellow, green - {for} chosen_color {in} colors - color _ - {repeat} _ - ``` - 12: - story_text: | - ### Exercise - Recreate the drawings with the turtle! - Hint: Bracelet designing program. Firstly, define a function **for each shape** you want to use on the bacelet. Then, add the shapes to the bacelet like this: - - Bracelet Designing program - example_code: | - ``` - {define} draw_a_square - _ - - {color} white - {turn} -90 - {forward} 300 - {turn} 180 - - {for} i {in} {range} 1 {to} 5 - {color} gray - {forward} 100 - shape = {ask} 'What kind of shape would you like next on the bracelet?' - chosen_color = {ask} 'In which color?' - {color} chosen_color - {if} shape = 'square' - {call} draw_a_square - ``` - while_command: - description: while - years: - description: Countdown to the new year! - levels: - 11: - story_text: | - In this level you can use the `{for} i {in} {range}` command to countdown to the New Year. - - ### Exercise - Fill in the blanks and make the code work! - example_code: | - ``` - for _ in _ 10 to 1 - {print} i - {print} 'Happy New Year!' - ```