Skip to content

Commit

Permalink
Merge branch 'main' of github.com:Felienne/hedy into create_accounts_…
Browse files Browse the repository at this point in the history
…in_bulk_3936
  • Loading branch information
boryanagoncharenko committed Oct 23, 2024
2 parents 716feab + 595628f commit 5e21d4e
Show file tree
Hide file tree
Showing 27 changed files with 1,085 additions and 561 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/deploy-to-alpha.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
name: Automatically deploy to Alpha
on:
workflow_dispatch: {}

# Run this AFTER the unit test job finishes
workflow_run:
# Must be the same as in unittests.yml, cypresstests.yml
Expand Down
7 changes: 6 additions & 1 deletion .mergify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ queue_rules:
commit_message_template: |-
{{ title }} (#{{number}})
{{ body }}
{# Add co-author information at the end of the squash merge commit message #}
{% for co_author in co_authors | unique -%}
Co-Authored-By: {{ co_author.name }} <{{ co_author.email }}>
{% endfor -%}
{# `Co-Authored-By` lines must the be last ones for GitHub to recognize them #}
pull_request_rules:
- name: Automatic squash merge on approval
Expand All @@ -21,4 +26,4 @@ pull_request_rules:
comment:
message: Thank you for contributing! Your pull request is now going on the merge train (choo choo! Do not click update from main anymore, and be sure to [allow changes to be pushed to your fork](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/allowing-changes-to-a-pull-request-branch-created-from-a-fork)).
queue:
name: default_queue
name: default_queue
7 changes: 5 additions & 2 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -1877,12 +1877,15 @@ def view_program(user, id):
result['username']) else None

code = result['code']
if result.get("lang") != "en" and result.get("lang") in ALL_KEYWORD_LANGUAGES.keys():
# if the snippet has blanks, it'll fail in the translation process
# so we just dont translate it if it has any
has_blanks = hedy.location_of_first_blank(code) > 0
if not has_blanks and result.get("lang") != "en" and result.get("lang") in ALL_KEYWORD_LANGUAGES.keys():
code = hedy_translation.translate_keywords(code, from_lang=result.get(
'lang'), to_lang="en", level=int(result.get('level', 1)))
# If the keyword language is non-English -> parse again to guarantee
# completely localized keywords
if g.keyword_lang != "en":
if not has_blanks and g.keyword_lang != "en":
code = hedy_translation.translate_keywords(
code,
from_lang="en",
Expand Down
103 changes: 56 additions & 47 deletions content/adventures/ca.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,7 @@ adventures:
```
clear_command:
name: '{clear}'
default_save_name: clear_command
default_save_name: comanda_netejar
description: comanda {clear}
levels:
4:
Expand Down Expand Up @@ -1711,26 +1711,26 @@ adventures:
Check it out!
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' :
prizes = ['1 million dollars', 'an apple pie', 'nothing']
your_prize = prizes[{random}]
{print} 'You win ' your_prize
{if} your_prize == '1 million dollars' :
{print} 'Yeah! You are rich!'
{elif} your_price == 'an apple pie' :
{elif} your_prize == 'an apple pie' :
{print} 'Lovely, an apple pie!'
{else}:
{print} 'Better luck next time..'
```
for_command:
name: '{for}'
default_save_name: for
description: for command
default_save_name: per
description: comanda {for}
levels:
10:
story_text: |-
## For
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 4 spaces.
## Per
En aquest nivell aprendrem una nova comanda anomenada `{for}`. Amb `{for}` pots fer una llista i utilitzar-ne tots els elements.
`{for}` crea un bloc, com `{repeat}` i `{if}`, de manera que totes les línies del bloc han de començar amb 4 espais.
example_code: |
```
animals = dog, cat, blobfish
Expand Down Expand Up @@ -1780,9 +1780,9 @@ adventures:
{print} (i)
```
fortune:
name: Fortune teller
default_save_name: Fortune Teller
description: Let Hedy predict the future
name: L'endeví
default_save_name: L'endeví
description: Deixa que Hedy predigui el futur
levels:
1:
story_text: |
Expand All @@ -1794,17 +1794,16 @@ adventures:
Like this:
example_code: |
```
{print} Hello, I'm Hedy the fortune teller!
{ask} Who are you?
{print} Let me take a look in my crystal ball
{print} I see... I see...
{echo} Your name is
_ Hola, soc Hedy l'endevina
_ Qui ets tu?
_ Deixa'm donar una ullada a la meva bola de cristall
_ Veig... Veig...
_ El teu nom és
```
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.
### Exercici
Copia el codi d'exemple a la teva pantalla d'entrada i omple els espais en blanc per fer funcionar el teu codi.
**Extra** Canvia el codi i deixa que l'endevina no només predigui el teu nom, sinó també la teva edat, el teu esport preferit o alguna altra cosa sobre tu mateix.
3:
story_text: |
In the previous levels you've created your first fortune telling machine, but Hedy couldn't really predict anything, only {echo}.
Expand All @@ -1831,26 +1830,37 @@ adventures:
Go back to the previous level and copy your fortune teller code. Make the code work in this level by adding quotation marks in the right spots.
example_code: |
```
_ Add the quotation marks to this code _
{print} Im Hedy the fortune teller!
question {is} {ask} What do you want to know?
{print} This is your question: question
answers {is} yes, no, maybe
{print} My crystal ball says...
_ Agrega les cometes a aquest codi _
{print} Sóc Hedy l'endevina!
pregunta {is} {ask} Què vols saber?
{print} Aquesta és la teva pregunta: · · pregunta
resposta {is} si, no, potser
{print} La meva bola de cristall diu...
{sleep} 2
{print} answers {at} {random}
{print} resposta {at} {random}
```
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.
### Exercici
En aquest codi d'exemple veuràs com fer un programa endeví que et permeti inclinar les possibilitats a favor teu. Aquest programa que fa trames sempre et diu que guanyaràs la loteria, però els teus amics mai guanyaran.
Usa això per fer el teu propi programa, sigues creatiu! Per exemple, pots crear un codi que predigui que:
* el teu equip esportiu preferit guanyarà a tots els seus contrincants!
* s'elegirà la teva pel·lícula preferida com a pel·lícula de la nit!
* guanyaràs entrades pel teu espectacle preferit!
* ets el més bonic/a de tots/es, com el mirall màgic de la Blancaneu.
Deixa que la teva imaginació faci el treball!
El teu programa ha de tenir almenys 10 línies de codi i ha de contenir com a mínim una comanda '{if}' i '{else}'.
example_code: |
```
{print} 'Im Hedy the fortune teller!'
{print} 'I can predict if youll win the lottery tomorrow!'
friends {is} Jordan, Lucy, Dave
{print} 'I can predict if you will win the lottery tomorrow!'
person {is} {ask} 'Who are you?'
{if} person {is} Hedy {print} 'You will definitely win!🤩' {else} {print} 'Bad luck! Someone else will win!😭'
good_answer {is} Hurray! You win!, You will definitely win!, We have a winner!
bad_answer {is} Bad luck! Try again!, Another person will win, You lose!
{if} person {in} friends {print} good_answer {at} {random}
{else} {print} bad_answer {at} {random}
```
6:
story_text: |
Expand Down Expand Up @@ -1888,23 +1898,22 @@ adventures:
```
7:
story_text: |
In this level you can use the `{repeat}` command to make your machine tell multiple fortunes at once.
### Exercici
Finalitza aquest programa que et diu si el teu enamorat t'estima o no.
example_code: |
```
{print} 'Im Hedy the fortune teller!'
{print} 'You can ask 3 questions!'
{repeat} 3 {times} question = {ask} 'What do you want to know?'
answer = yes, no, maybe
{repeat} 3 {times} {print} 'My crystal ball says... ' answer {at} {random}
{print} 'Tinc una flor amb pètals màgics'
{print} "Si agafes els pètals de la flor, et dirà si el teu amor també t'estima"
quantitat = {ask} 'Quants pètals vols agafar?'
options = t'estima, no t'estima
_ _ _ _ options {at} {random}
```
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!
En el pròxim exemple pots fre que l'endeví et faci diverses preguntes i també que les imprimeixi!
### Exercise
Can you fill in the `{repeat}` command correctly on the blanks?
### Exercici
Pots posar les comandes correctes als forats en blanc?
example_code: |
```
{print} 'I am Hedy the fortune teller!'
Expand Down
Loading

0 comments on commit 5e21d4e

Please sign in to comment.