Skip to content

Commit

Permalink
fix: Add icon and code example to level 36 description (#1551)
Browse files Browse the repository at this point in the history
* fix: Level 36 description with icon and code example

* Merge branch 'master' into level_36_desc
  • Loading branch information
faucomte97 authored Dec 5, 2023
1 parent 5afe359 commit e21fb58
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 18 deletions.
45 changes: 27 additions & 18 deletions game/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,19 @@ def step_button_icon_url():
)


def if_else_icon_url():
return (
'<img src="/static/game/image/icons/if_else.svg" alt="If Else button" '
'" style="width: 4%;">'
)


def if_else_example_url():
return (
'<img src="/static/game/image/if_else_example.png" alt="If Else example">'
)


def not_shared_level():
return (
"This level is private. You can only see the public levels and the ones "
Expand Down Expand Up @@ -861,24 +874,20 @@ def title_level36():
def description_level36():
message = youtube_link("https://www.youtube-nocookie.com/embed/GUUJSRuAyU0", 0)
message += (
"<div class='popup_message'>"
"You can change the <b>if</b> block to make more choices. Click on the"
" cog in the <b>if</b> block and add <b>else if</b>."
"<br>"
"This will tell the van what to do if the first <b>if</b> direction"
" can't be done."
"<br>"
"You can also add an <b>else</b> block to tell the van what to do if"
" none of the conditions match."
"<br>"
"For example:"
"<br>"
"<b>If</b> there is a road ahead, go forwards."
"<br>"
"<b>Else if</b> there is a road left, turn left."
"<br>"
"<b>Else</b>, go right."
"</div>"
f"<div class='popup_message'>"
f"You can change the <b>if</b> block to make more choices. Click on the"
f" {if_else_icon_url()} to add <b>else if</b>."
f"<br>"
f"This will tell the van what to do if the first <b>if</b> direction"
f" can't be done."
f"<br>"
f"You can also add an <b>else</b> block to tell the van what to do if"
f" none of the conditions match."
f"<br>"
f"{if_else_example_url()}"
f"<br>"
f"This is a general algorithm, it can be used for lots of different routes!"
f"</div>"
)
return build_description(
title_level36(), f"<div class='main_popup_container'>{message}</div>"
Expand Down
3 changes: 3 additions & 0 deletions game/static/game/image/icons/if_else.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added game/static/game/image/if_else_example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e21fb58

Please sign in to comment.