From b8754a77e96fe451900f6c0aec9c9963af7dbf16 Mon Sep 17 00:00:00 2001 From: Florent Bouchez Tichadou <florent.bouchez-tichadou@imag.fr> Date: Fri, 24 Jan 2025 16:41:56 +0100 Subject: [PATCH 1/3] Fix typo in doc --- doc/mission.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/mission.md b/doc/mission.md index 9f6ec8ab..f2079f9a 100644 --- a/doc/mission.md +++ b/doc/mission.md @@ -201,7 +201,7 @@ Useful commands =============== cd PLACE - Move to the given place, if accessible from you current location. + Move to the given place, if accessible from your current location. ``` For uniformity, meta-variables in commands should be in UPPERCASE. From a8a5b94bc6f90af6e1291008890ea89d14c6136f Mon Sep 17 00:00:00 2001 From: Florent Bouchez Tichadou <florent.bouchez-tichadou@imag.fr> Date: Fri, 24 Jan 2025 17:09:19 +0100 Subject: [PATCH 2/3] Moving back to the top of the tower when resetting mission #3 --- missions/basic/03_cd_HOME_throne/init.sh | 4 ++++ missions/basic/03_cd_HOME_throne/static.sh | 1 + 2 files changed, 5 insertions(+) create mode 100644 missions/basic/03_cd_HOME_throne/init.sh diff --git a/missions/basic/03_cd_HOME_throne/init.sh b/missions/basic/03_cd_HOME_throne/init.sh new file mode 100644 index 00000000..7d3f26db --- /dev/null +++ b/missions/basic/03_cd_HOME_throne/init.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env sh + +cd "$GSH_HOME/Castle/Main_tower/First_floor/Second_floor/Top_of_the_tower" +echo "Current position: $(pwd)" diff --git a/missions/basic/03_cd_HOME_throne/static.sh b/missions/basic/03_cd_HOME_throne/static.sh index 44cd0b87..69287029 100644 --- a/missions/basic/03_cd_HOME_throne/static.sh +++ b/missions/basic/03_cd_HOME_throne/static.sh @@ -1,3 +1,4 @@ #!/usr/bin/env sh +mkdir -p "$(eval_gettext '$GSH_HOME/Castle/Main_tower/First_floor/Second_floor/Top_of_the_tower')" mkdir -p "$(eval_gettext '$GSH_HOME/Castle/Main_building/Throne_room')" From cf4fec27dfc98c16087e1e82389f328f3f9cb6ee Mon Sep 17 00:00:00 2001 From: Florent Bouchez Tichadou <florent.bouchez-tichadou@imag.fr> Date: Fri, 24 Jan 2025 17:51:37 +0100 Subject: [PATCH 3/3] Moving back to cellar when resetting/starting mission 3 + adding error messages to help struggling students. --- missions/basic/03_cd_HOME_throne/check.sh | 20 ++++++++++++++++--- missions/basic/03_cd_HOME_throne/goal/fr.txt | 2 +- missions/basic/03_cd_HOME_throne/i18n/en.po | 16 +++++++++++++++ missions/basic/03_cd_HOME_throne/i18n/fr.po | 16 +++++++++++++++ missions/basic/03_cd_HOME_throne/i18n/it.po | 3 +++ .../basic/03_cd_HOME_throne/i18n/template.pot | 16 +++++++++++++++ missions/basic/03_cd_HOME_throne/init.sh | 4 ++-- missions/basic/03_cd_HOME_throne/static.sh | 2 +- 8 files changed, 72 insertions(+), 7 deletions(-) diff --git a/missions/basic/03_cd_HOME_throne/check.sh b/missions/basic/03_cd_HOME_throne/check.sh index 4c59892a..75c6d102 100644 --- a/missions/basic/03_cd_HOME_throne/check.sh +++ b/missions/basic/03_cd_HOME_throne/check.sh @@ -8,9 +8,23 @@ _mission_check() { ppc=$(. fc-lnr.sh | sed -n '2p;3q') - # FIXME: also accept other commands to go back to the starting point? - # FIXME: add an error message - [ "$goal" = "$current" ] && [ "$ppc" = "cd" ] + # Accepts only "cd" and "cd ~". "cd ../../../../" and variants are not valid. + if [ "$ppc" != "cd" ] && [ "$ppc" != "cd ~" ]; then + if [ "$ppc" =~ "cd ../*" ]; then + echo "$(gettext "The command to go to the starting point is too complicated.")" + else + echo "$(gettext "The previous to last command must take you to the starting point.")" + fi + return 1 + fi + + # Verify the current location + if [ "$goal" != "$current" ]; then + echo "$(gettext "You are not in the throne room.")" + return 1 + fi + + return 0 } _mission_check diff --git a/missions/basic/03_cd_HOME_throne/goal/fr.txt b/missions/basic/03_cd_HOME_throne/goal/fr.txt index a58eaba7..95f935cf 100644 --- a/missions/basic/03_cd_HOME_throne/goal/fr.txt +++ b/missions/basic/03_cd_HOME_throne/goal/fr.txt @@ -19,7 +19,7 @@ Commandes utiles ================ cd - Revient au lieu initial. + Revient au point de départ. cd LIEU1/LIEU2/LIEU3 Fait plusieurs déplacements avec une commande. diff --git a/missions/basic/03_cd_HOME_throne/i18n/en.po b/missions/basic/03_cd_HOME_throne/i18n/en.po index 9357b4a6..b76374d8 100644 --- a/missions/basic/03_cd_HOME_throne/i18n/en.po +++ b/missions/basic/03_cd_HOME_throne/i18n/en.po @@ -7,6 +7,9 @@ msgstr "Content-Type: text/plain; charset=UTF-8\n" msgid "$GSH_HOME/Castle/Main_building/Throne_room" msgstr "$GSH_HOME/Castle/Main_building/Throne_room" +msgid "$GSH_HOME/Castle/Cellar" +msgstr "$GSH_HOME/Castle/Cellar" + # path for the text file containing the goal msgid "$MISSION_DIR/goal/en.txt" msgstr "$MISSION_DIR/goal/en.txt" @@ -18,3 +21,16 @@ msgstr "$MISSION_DIR/skip/en.txt" # path for the text file containing the treasure message msgid "$MISSION_DIR/treasure-msg/en.txt" msgstr "$MISSION_DIR/treasure-msg/en.txt" + +# Message for current position +msgid "Current position:" +msgstr "Current position:" + +msgid "The command to go to the starting point is too complicated." +msgstr "The command to go to the starting point is too complicated." + +msgid "The previous to last command must take you to the starting point." +msgstr "The previous to last command must take you to the starting point." + +msgid "You are not in the throne room." +msgstr "You are not in the throne room." diff --git a/missions/basic/03_cd_HOME_throne/i18n/fr.po b/missions/basic/03_cd_HOME_throne/i18n/fr.po index 14783449..23b277c1 100644 --- a/missions/basic/03_cd_HOME_throne/i18n/fr.po +++ b/missions/basic/03_cd_HOME_throne/i18n/fr.po @@ -6,6 +6,9 @@ msgstr "Content-Type: text/plain; charset=UTF-8\n" msgid "$GSH_HOME/Castle/Main_building/Throne_room" msgstr "$GSH_HOME/Chateau/Batiment_principal/Salle_du_trone" +msgid "$GSH_HOME/Castle/Cellar" +msgstr "$GSH_HOME/Chateau/Cave" + # path for the text file containing the goal msgid "$MISSION_DIR/goal/en.txt" msgstr "$MISSION_DIR/goal/fr.txt" @@ -17,3 +20,16 @@ msgstr "$MISSION_DIR/skip/fr.txt" # path for the text file containing the treasure message msgid "$MISSION_DIR/treasure-msg/en.txt" msgstr "$MISSION_DIR/treasure-msg/fr.txt" + +# Message for current position +msgid "Current position:" +msgstr "Position actuelle :" + +msgid "The command to go to the starting point is too complicated." +msgstr "La commande pour retourner au point de départ est trop compliquée." + +msgid "The previous to last command must take you to the starting point." +msgstr "L'avant-dernière commande doit vous ramener au point de départ." + +msgid "You are not in the throne room." +msgstr "Vous n'êtes pas dans la salle du trône." diff --git a/missions/basic/03_cd_HOME_throne/i18n/it.po b/missions/basic/03_cd_HOME_throne/i18n/it.po index 6b117ef1..c0927af5 100644 --- a/missions/basic/03_cd_HOME_throne/i18n/it.po +++ b/missions/basic/03_cd_HOME_throne/i18n/it.po @@ -17,6 +17,9 @@ msgstr "" msgid "$GSH_HOME/Castle/Main_building/Throne_room" msgstr "$GSH_HOME/Castello/Palazzo_principale/Sala_del_trono" +msgid "$GSH_HOME/Castle/Cellar" +msgstr "$GSH_HOME/Castello/Cantina" + # path for the text file containing the goal msgid "$MISSION_DIR/goal/en.txt" msgstr "$MISSION_DIR/goal/it.txt" diff --git a/missions/basic/03_cd_HOME_throne/i18n/template.pot b/missions/basic/03_cd_HOME_throne/i18n/template.pot index 02912d7e..18e22dfa 100644 --- a/missions/basic/03_cd_HOME_throne/i18n/template.pot +++ b/missions/basic/03_cd_HOME_throne/i18n/template.pot @@ -6,6 +6,9 @@ msgstr "Content-Type: text/plain; charset=UTF-8\n" msgid "$GSH_HOME/Castle/Main_building/Throne_room" msgstr "" +msgid "$GSH_HOME/Castle/Cellar" +msgstr "" + # path for the text file containing the goal msgid "$MISSION_DIR/goal/en.txt" msgstr "" @@ -17,3 +20,16 @@ msgstr "" # path for the text file containing the treasure message msgid "$MISSION_DIR/treasure-msg/en.txt" msgstr "" + +# Message for current position +msgid "Current position:" +msgstr "" + +msgid "The command to go to the starting point is too complicated." +msgstr "" + +msgid "The previous to last command must take you to the starting point." +msgstr "" + +msgid "You are not in the throne room." +msgstr "" diff --git a/missions/basic/03_cd_HOME_throne/init.sh b/missions/basic/03_cd_HOME_throne/init.sh index 7d3f26db..1c3daaca 100644 --- a/missions/basic/03_cd_HOME_throne/init.sh +++ b/missions/basic/03_cd_HOME_throne/init.sh @@ -1,4 +1,4 @@ #!/usr/bin/env sh -cd "$GSH_HOME/Castle/Main_tower/First_floor/Second_floor/Top_of_the_tower" -echo "Current position: $(pwd)" +cd "$(eval_gettext '$GSH_HOME/Castle/Cellar')" +echo "$(gettext "Current position:") $(pwd)" diff --git a/missions/basic/03_cd_HOME_throne/static.sh b/missions/basic/03_cd_HOME_throne/static.sh index 69287029..78fd4dea 100644 --- a/missions/basic/03_cd_HOME_throne/static.sh +++ b/missions/basic/03_cd_HOME_throne/static.sh @@ -1,4 +1,4 @@ #!/usr/bin/env sh -mkdir -p "$(eval_gettext '$GSH_HOME/Castle/Main_tower/First_floor/Second_floor/Top_of_the_tower')" +mkdir -p "$(eval_gettext '$GSH_HOME/Castle/Cellar')" mkdir -p "$(eval_gettext '$GSH_HOME/Castle/Main_building/Throne_room')"