From 90d62dc6f80ef5f5816929bcff66fdb404490ffb Mon Sep 17 00:00:00 2001 From: SKairinos Date: Fri, 27 Oct 2023 17:17:00 +0100 Subject: [PATCH 01/21] quick save --- game/messages.py | 4 + game/migrations/0084_loop_levels.py | 322 ++++++++++++++++++++++++++++ 2 files changed, 326 insertions(+) create mode 100644 game/migrations/0084_loop_levels.py diff --git a/game/messages.py b/game/messages.py index 60d4d5cc0..c13e01ec1 100644 --- a/game/messages.py +++ b/game/messages.py @@ -2370,6 +2370,10 @@ def get_episode_title(episode_id): 9: "Blockly Brain Teasers", 10: "Introduction to Python", 11: "Python", + 12: "Sequencing and Counted Loops", + 13: "Indeterminate WHILE Loops - coming soon", + 14: "Selection in a Loop - coming soon", + 15: "For Loops - coming soon", } return episode_titles[episode_id] diff --git a/game/migrations/0084_loop_levels.py b/game/migrations/0084_loop_levels.py new file mode 100644 index 000000000..9210b3424 --- /dev/null +++ b/game/migrations/0084_loop_levels.py @@ -0,0 +1,322 @@ +from django.apps.registry import Apps +from django.db import migrations + + +def add_loop_levels(apps: Apps, *args): + Level = apps.get_model("game", "Level") + Episode = apps.get_model("game", "Episode") + Theme = apps.get_model("game", "Theme") + Character = apps.get_model("game", "Theme") + + episode_15 = Episode.objects.create( + pk=15, + name="For Loops - coming soon", + ) + episode_14 = Episode.objects.create( + pk=14, + next_episode=episode_15, + name="Selection in a Loop - coming soon", + ) + episode_13 = Episode.objects.create( + pk=13, + next_episode=episode_14, + name="Indeterminate WHILE Loops - coming soon", + ) + episode_12 = Episode.objects.create( + pk=12, + next_episode=episode_13, + name="Sequencing and Counted Loops", + ) + + theme_grass = Theme.objects.get(name="grass") + theme_snow = Theme.objects.get(name="snow") + theme_farm = Theme.objects.get(name="farm") + theme_city = Theme.objects.get(name="city") + + character_van = Character.objects.get(name="Van") + character_dee = Character.objects.get(name="Dee") + + # Episode 15, Levels 149 - 153 + level_153 = Level.objects.create( + name="153", + episode=episode_15, + path="", + ) + level_152 = Level.objects.create( + name="152", + episode=episode_15, + path="", + next_level=level_153, + ) + level_151 = Level.objects.create( + name="151", + episode=episode_15, + path="", + next_level=level_152, + ) + level_150 = Level.objects.create( + name="150", + episode=episode_15, + path="", + next_level=level_151, + ) + level_149 = Level.objects.create( + name="149", + episode=episode_15, + path="", + next_level=level_150, + ) + + # Episode 14, Levels 141 - 148 + level_148 = Level.objects.create( + name="148", + episode=episode_14, + path="", + next_level=level_149, + ) + level_147 = Level.objects.create( + name="147", + episode=episode_14, + path="", + next_level=level_148, + ) + level_146 = Level.objects.create( + name="146", + episode=episode_14, + path="", + next_level=level_147, + ) + level_145 = Level.objects.create( + name="145", + episode=episode_14, + path="", + next_level=level_146, + ) + level_144 = Level.objects.create( + name="144", + episode=episode_14, + path="", + next_level=level_145, + ) + level_143 = Level.objects.create( + name="143", + episode=episode_14, + path="", + next_level=level_144, + ) + level_142 = Level.objects.create( + name="142", + episode=episode_14, + path="", + next_level=level_143, + ) + level_141 = Level.objects.create( + name="141", + episode=episode_14, + path="", + next_level=level_142, + ) + + # Episode 13, Levels 123 - 140 + level_140 = Level.objects.create( + name="140", + episode=episode_13, + path="", + next_level=level_141, + ) + level_139 = Level.objects.create( + name="139", + episode=episode_13, + path="", + next_level=level_140, + ) + level_138 = Level.objects.create( + name="138", + episode=episode_13, + path="", + next_level=level_139, + ) + level_137 = Level.objects.create( + name="137", + episode=episode_13, + path="", + next_level=level_138, + ) + level_136 = Level.objects.create( + name="136", + episode=episode_13, + path="", + next_level=level_137, + ) + level_135 = Level.objects.create( + name="135", + episode=episode_13, + path="", + next_level=level_136, + ) + level_134 = Level.objects.create( + name="134", + episode=episode_13, + path="", + next_level=level_135, + ) + level_133 = Level.objects.create( + name="133", + episode=episode_13, + path="", + next_level=level_134, + ) + level_132 = Level.objects.create( + name="132", + episode=episode_13, + path="", + next_level=level_133, + ) + level_131 = Level.objects.create( + name="131", + episode=episode_13, + path="", + next_level=level_132, + ) + level_130 = Level.objects.create( + name="130", + episode=episode_13, + path="", + next_level=level_131, + ) + level_129 = Level.objects.create( + name="129", + episode=episode_13, + path="", + next_level=level_130, + ) + level_128 = Level.objects.create( + name="128", + episode=episode_13, + path="", + next_level=level_129, + ) + level_127 = Level.objects.create( + name="127", + episode=episode_13, + path="", + next_level=level_128, + ) + level_126 = Level.objects.create( + name="126", + episode=episode_13, + path="", + next_level=level_127, + ) + level_125 = Level.objects.create( + name="125", + episode=episode_13, + path="", + next_level=level_126, + ) + level_124 = Level.objects.create( + name="124", + episode=episode_13, + path="", + next_level=level_125, + ) + level_123 = Level.objects.create( + name="123", + episode=episode_13, + path="", + next_level=level_124, + ) + + # Episode 12, Levels 110 - 122 + level_122 = Level.objects.create( + name="122", + episode=episode_12, + path="", + next_level=level_123, + ) + level_121 = Level.objects.create( + name="121", + episode=episode_12, + path="", + next_level=level_122, + ) + level_120 = Level.objects.create( + name="120", + episode=episode_12, + path="", + next_level=level_121, + ) + level_119 = Level.objects.create( + name="119", + episode=episode_12, + path="", + next_level=level_120, + ) + level_118 = Level.objects.create( + name="118", + episode=episode_12, + path="", + next_level=level_119, + ) + level_117 = Level.objects.create( + name="117", + episode=episode_12, + path="", + next_level=level_118, + ) + level_116 = Level.objects.create( + name="116", + episode=episode_12, + path="", + next_level=level_117, + ) + level_115 = Level.objects.create( + name="115", + episode=episode_12, + path="", + next_level=level_116, + ) + level_114 = Level.objects.create( + name="114", + episode=episode_12, + path="", + next_level=level_115, + ) + level_113 = Level.objects.create( + name="113", + episode=episode_12, + path="", + next_level=level_114, + ) + level_112 = Level.objects.create( + name="112", + episode=episode_12, + path="", + next_level=level_113, + ) + level_111 = Level.objects.create( + name="111", + episode=episode_12, + path="", + next_level=level_112, + ) + level_110 = Level.objects.create( + name="110", + episode=episode_12, + path="", + next_level=level_111, + ) + + level_109 = Level.objects.get(name="109") + level_109.next_level = level_110 + level_109.save() + + +class Migration(migrations.Migration): + dependencies = [("game", "0083_add_cows_to_existing_levels")] + operations = [ + migrations.RunPython( + add_loop_levels, + reverse_code=migrations.RunPython.noop, + ) + ] From 9bc0b9a14bcf35f0498b24903421e755d63cadfe Mon Sep 17 00:00:00 2001 From: SKairinos Date: Mon, 30 Oct 2023 10:19:54 +0000 Subject: [PATCH 02/21] fix: next episode --- game/migrations/0084_loop_levels.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/game/migrations/0084_loop_levels.py b/game/migrations/0084_loop_levels.py index 9210b3424..39c9ccf82 100644 --- a/game/migrations/0084_loop_levels.py +++ b/game/migrations/0084_loop_levels.py @@ -5,8 +5,8 @@ def add_loop_levels(apps: Apps, *args): Level = apps.get_model("game", "Level") Episode = apps.get_model("game", "Episode") - Theme = apps.get_model("game", "Theme") - Character = apps.get_model("game", "Theme") + # Theme = apps.get_model("game", "Theme") + # Character = apps.get_model("game", "Character") episode_15 = Episode.objects.create( pk=15, @@ -28,13 +28,17 @@ def add_loop_levels(apps: Apps, *args): name="Sequencing and Counted Loops", ) - theme_grass = Theme.objects.get(name="grass") - theme_snow = Theme.objects.get(name="snow") - theme_farm = Theme.objects.get(name="farm") - theme_city = Theme.objects.get(name="city") + episode_11 = Episode.objects.get(pk=11) + episode_11.next_episode = episode_12 + episode_11.save() - character_van = Character.objects.get(name="Van") - character_dee = Character.objects.get(name="Dee") + # theme_grass = Theme.objects.get(name="grass") + # theme_snow = Theme.objects.get(name="snow") + # theme_farm = Theme.objects.get(name="farm") + # theme_city = Theme.objects.get(name="city") + + # character_van = Character.objects.get(name="Van") + # character_dee = Character.objects.get(name="Dee") # Episode 15, Levels 149 - 153 level_153 = Level.objects.create( From 6673f42e4552a798a929093f017b68aade807ab8 Mon Sep 17 00:00:00 2001 From: SKairinos Date: Mon, 30 Oct 2023 10:48:14 +0000 Subject: [PATCH 03/21] initial for each episode --- game/messages.py | 53 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/game/messages.py b/game/messages.py index c13e01ec1..75d89976e 100644 --- a/game/messages.py +++ b/game/messages.py @@ -2357,6 +2357,59 @@ def hint_level109(): ) +# Episode 12, Levels 110 - 122 +def title_level110(): + return "TODO" + + +def description_level110(): + return "TODO" + + +def hint_level110(): + return "TODO" + + +# Episode 13, Levels 123 - 140 +def title_level123(): + return "TODO" + + +def description_level123(): + return "TODO" + + +def hint_level123(): + return "TODO" + + +# Episode 14, Levels 141 - 148 +def title_level141(): + return "TODO" + + +def description_level141(): + return "TODO" + + +def hint_level141(): + return "TODO" + + +# Episode 15, Levels 149 - 153 +def title_level149(): + return "TODO" + + +def description_level149(): + return "TODO" + + +def hint_level149(): + return "TODO" + + +# Episode titles def get_episode_title(episode_id): episode_titles = { 1: "Getting Started", From 3d6ad809bdb675a50e2e9e52af75664b9c07404a Mon Sep 17 00:00:00 2001 From: SKairinos Date: Mon, 30 Oct 2023 11:01:06 +0000 Subject: [PATCH 04/21] fix formatting --- game/messages.py | 76 +++++++++++++++++++++++------------------------- 1 file changed, 36 insertions(+), 40 deletions(-) diff --git a/game/messages.py b/game/messages.py index 75d89976e..3e225fd90 100644 --- a/game/messages.py +++ b/game/messages.py @@ -2358,55 +2358,51 @@ def hint_level109(): # Episode 12, Levels 110 - 122 -def title_level110(): - return "TODO" - - -def description_level110(): - return "TODO" - - -def hint_level110(): - return "TODO" +( + title_level110, + description_level110, + hint_level110, +) = ( + lambda: "TODO", + lambda: "TODO", + lambda: "TODO", +) # Episode 13, Levels 123 - 140 -def title_level123(): - return "TODO" - - -def description_level123(): - return "TODO" - - -def hint_level123(): - return "TODO" +( + title_level123, + description_level123, + hint_level123, +) = ( + lambda: "TODO", + lambda: "TODO", + lambda: "TODO", +) # Episode 14, Levels 141 - 148 -def title_level141(): - return "TODO" - - -def description_level141(): - return "TODO" - - -def hint_level141(): - return "TODO" +( + title_level141, + description_level141, + hint_level141, +) = ( + lambda: "TODO", + lambda: "TODO", + lambda: "TODO", +) # Episode 15, Levels 149 - 153 -def title_level149(): - return "TODO" - - -def description_level149(): - return "TODO" - - -def hint_level149(): - return "TODO" +( + title_level149, + description_level149, + hint_level149, +) = ( + lambda: "TODO", + lambda: "TODO", + lambda: "TODO", +) # Episode titles From 9a9771c88a8ab06becaf715000dad73c545efc80 Mon Sep 17 00:00:00 2001 From: SKairinos Date: Mon, 30 Oct 2023 11:05:27 +0000 Subject: [PATCH 05/21] episode 12 --- game/messages.py | 120 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) diff --git a/game/messages.py b/game/messages.py index 3e225fd90..772536140 100644 --- a/game/messages.py +++ b/game/messages.py @@ -2368,6 +2368,126 @@ def hint_level109(): lambda: "TODO", ) +( + title_level111, + description_level111, + hint_level111, +) = ( + lambda: "TODO", + lambda: "TODO", + lambda: "TODO", +) + +( + title_level112, + description_level112, + hint_level112, +) = ( + lambda: "TODO", + lambda: "TODO", + lambda: "TODO", +) + +( + title_level113, + description_level113, + hint_level113, +) = ( + lambda: "TODO", + lambda: "TODO", + lambda: "TODO", +) + +( + title_level114, + description_level114, + hint_level114, +) = ( + lambda: "TODO", + lambda: "TODO", + lambda: "TODO", +) + +( + title_level115, + description_level115, + hint_level115, +) = ( + lambda: "TODO", + lambda: "TODO", + lambda: "TODO", +) + +( + title_level116, + description_level116, + hint_level116, +) = ( + lambda: "TODO", + lambda: "TODO", + lambda: "TODO", +) + +( + title_level117, + description_level117, + hint_level117, +) = ( + lambda: "TODO", + lambda: "TODO", + lambda: "TODO", +) + +( + title_level118, + description_level118, + hint_level118, +) = ( + lambda: "TODO", + lambda: "TODO", + lambda: "TODO", +) + +( + title_level119, + description_level119, + hint_level119, +) = ( + lambda: "TODO", + lambda: "TODO", + lambda: "TODO", +) + +( + title_level120, + description_level120, + hint_level120, +) = ( + lambda: "TODO", + lambda: "TODO", + lambda: "TODO", +) + +( + title_level121, + description_level121, + hint_level121, +) = ( + lambda: "TODO", + lambda: "TODO", + lambda: "TODO", +) + +( + title_level122, + description_level122, + hint_level122, +) = ( + lambda: "TODO", + lambda: "TODO", + lambda: "TODO", +) + # Episode 13, Levels 123 - 140 ( From 372f8a7c3b875e4f442aa45e26398bddd9484da1 Mon Sep 17 00:00:00 2001 From: SKairinos Date: Mon, 30 Oct 2023 11:11:54 +0000 Subject: [PATCH 06/21] episode 13 --- game/messages.py | 170 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 170 insertions(+) diff --git a/game/messages.py b/game/messages.py index 772536140..fb0d54523 100644 --- a/game/messages.py +++ b/game/messages.py @@ -2500,6 +2500,176 @@ def hint_level109(): lambda: "TODO", ) +( + title_level124, + description_level124, + hint_level124, +) = ( + lambda: "TODO", + lambda: "TODO", + lambda: "TODO", +) + +( + title_level125, + description_level125, + hint_level125, +) = ( + lambda: "TODO", + lambda: "TODO", + lambda: "TODO", +) + +( + title_level126, + description_level126, + hint_level126, +) = ( + lambda: "TODO", + lambda: "TODO", + lambda: "TODO", +) + +( + title_level127, + description_level127, + hint_level127, +) = ( + lambda: "TODO", + lambda: "TODO", + lambda: "TODO", +) + +( + title_level128, + description_level128, + hint_level128, +) = ( + lambda: "TODO", + lambda: "TODO", + lambda: "TODO", +) + +( + title_level129, + description_level129, + hint_level129, +) = ( + lambda: "TODO", + lambda: "TODO", + lambda: "TODO", +) + +( + title_level130, + description_level130, + hint_level130, +) = ( + lambda: "TODO", + lambda: "TODO", + lambda: "TODO", +) + +( + title_level131, + description_level131, + hint_level131, +) = ( + lambda: "TODO", + lambda: "TODO", + lambda: "TODO", +) + +( + title_level132, + description_level132, + hint_level132, +) = ( + lambda: "TODO", + lambda: "TODO", + lambda: "TODO", +) + +( + title_level133, + description_level133, + hint_level133, +) = ( + lambda: "TODO", + lambda: "TODO", + lambda: "TODO", +) + +( + title_level134, + description_level134, + hint_level134, +) = ( + lambda: "TODO", + lambda: "TODO", + lambda: "TODO", +) + +( + title_level135, + description_level135, + hint_level135, +) = ( + lambda: "TODO", + lambda: "TODO", + lambda: "TODO", +) + +( + title_level136, + description_level136, + hint_level136, +) = ( + lambda: "TODO", + lambda: "TODO", + lambda: "TODO", +) + +( + title_level137, + description_level137, + hint_level137, +) = ( + lambda: "TODO", + lambda: "TODO", + lambda: "TODO", +) + +( + title_level138, + description_level138, + hint_level138, +) = ( + lambda: "TODO", + lambda: "TODO", + lambda: "TODO", +) + +( + title_level139, + description_level139, + hint_level139, +) = ( + lambda: "TODO", + lambda: "TODO", + lambda: "TODO", +) + +( + title_level140, + description_level140, + hint_level140, +) = ( + lambda: "TODO", + lambda: "TODO", + lambda: "TODO", +) + # Episode 14, Levels 141 - 148 ( From ddf332f0a6b42ba4e7655ca8ea699a90b76b390d Mon Sep 17 00:00:00 2001 From: SKairinos Date: Mon, 30 Oct 2023 11:15:40 +0000 Subject: [PATCH 07/21] episode 14 --- game/messages.py | 70 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/game/messages.py b/game/messages.py index fb0d54523..1f7244066 100644 --- a/game/messages.py +++ b/game/messages.py @@ -2682,6 +2682,76 @@ def hint_level109(): lambda: "TODO", ) +( + title_level142, + description_level142, + hint_level142, +) = ( + lambda: "TODO", + lambda: "TODO", + lambda: "TODO", +) + +( + title_level143, + description_level143, + hint_level143, +) = ( + lambda: "TODO", + lambda: "TODO", + lambda: "TODO", +) + +( + title_level144, + description_level144, + hint_level144, +) = ( + lambda: "TODO", + lambda: "TODO", + lambda: "TODO", +) + +( + title_level145, + description_level145, + hint_level145, +) = ( + lambda: "TODO", + lambda: "TODO", + lambda: "TODO", +) + +( + title_level146, + description_level146, + hint_level146, +) = ( + lambda: "TODO", + lambda: "TODO", + lambda: "TODO", +) + +( + title_level147, + description_level147, + hint_level147, +) = ( + lambda: "TODO", + lambda: "TODO", + lambda: "TODO", +) + +( + title_level148, + description_level148, + hint_level148, +) = ( + lambda: "TODO", + lambda: "TODO", + lambda: "TODO", +) + # Episode 15, Levels 149 - 153 ( From 747f006322572f2cf0c4802af1c68843ca40c6eb Mon Sep 17 00:00:00 2001 From: SKairinos Date: Mon, 30 Oct 2023 11:18:50 +0000 Subject: [PATCH 08/21] episode 15 --- game/messages.py | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/game/messages.py b/game/messages.py index 1f7244066..529c41fad 100644 --- a/game/messages.py +++ b/game/messages.py @@ -2764,6 +2764,46 @@ def hint_level109(): lambda: "TODO", ) +( + title_level150, + description_level150, + hint_level150, +) = ( + lambda: "TODO", + lambda: "TODO", + lambda: "TODO", +) + +( + title_level151, + description_level151, + hint_level151, +) = ( + lambda: "TODO", + lambda: "TODO", + lambda: "TODO", +) + +( + title_level152, + description_level152, + hint_level152, +) = ( + lambda: "TODO", + lambda: "TODO", + lambda: "TODO", +) + +( + title_level153, + description_level153, + hint_level153, +) = ( + lambda: "TODO", + lambda: "TODO", + lambda: "TODO", +) + # Episode titles def get_episode_title(episode_id): From 4b278c8b1134ce5e36eaf70e59021e9e8f8d58b4 Mon Sep 17 00:00:00 2001 From: SKairinos Date: Mon, 30 Oct 2023 11:49:42 +0000 Subject: [PATCH 09/21] episode 12 --- game/messages.py | 100 +++++++++++++++++++++++++++++++++++------------ 1 file changed, 74 insertions(+), 26 deletions(-) diff --git a/game/messages.py b/game/messages.py index 529c41fad..a0e86b297 100644 --- a/game/messages.py +++ b/game/messages.py @@ -2363,8 +2363,11 @@ def hint_level109(): description_level110, hint_level110, ) = ( - lambda: "TODO", - lambda: "TODO", + lambda: "Here's Python", + lambda: build_description( + title_level110(), + "As you create your program using Blockly, see what it looks like in the Python programming language. Can you tell which Python statement matches which block?", + ), lambda: "TODO", ) @@ -2373,8 +2376,11 @@ def hint_level109(): description_level111, hint_level111, ) = ( - lambda: "TODO", - lambda: "TODO", + lambda: "Matching Blockly", + lambda: build_description( + title_level111(), + "As you create your program using Blockly, see what it looks like in the Python programming language. Can you tell which Python statement matches which block?", + ), lambda: "TODO", ) @@ -2383,8 +2389,13 @@ def hint_level109(): description_level112, hint_level112, ) = ( - lambda: "TODO", - lambda: "TODO", + lambda: "Don't forget to find the shortest route", + lambda: build_description( + title_level112(), + "As you create your program using Blockly, see what it looks like in the Python programming language. Can you tell which Python statement matches which block?" + "

" + "Don't forget to find the shortest route!", + ), lambda: "TODO", ) @@ -2393,8 +2404,11 @@ def hint_level109(): description_level113, hint_level113, ) = ( - lambda: "TODO", - lambda: "TODO", + lambda: "Where did the blocks go?", + lambda: build_description( + title_level113(), + "Can you remember how the Python was formed under the blocks in the previous levels? Take a look in the Py Commands for a quick reminder.", + ), lambda: "TODO", ) @@ -2403,8 +2417,11 @@ def hint_level109(): description_level114, hint_level114, ) = ( - lambda: "TODO", - lambda: "TODO", + lambda: "Tree snake", + lambda: build_description( + title_level114(), + "This route is just a bit longer. Make sure you type the Python code accurately!", + ), lambda: "TODO", ) @@ -2413,8 +2430,8 @@ def hint_level109(): description_level115, hint_level115, ) = ( - lambda: "TODO", - lambda: "TODO", + lambda: "Which way to turn? This way or that way?", + lambda: build_description(title_level115(), "TODO"), lambda: "TODO", ) @@ -2423,8 +2440,13 @@ def hint_level109(): description_level116, hint_level116, ) = ( - lambda: "TODO", - lambda: "TODO", + lambda: "In a while, crocodile!", + lambda: build_description( + title_level116(), + "This level may look easy, but this time you need to use a While Loop to deliver to the house." + "
" + "Can you do it? Name your variables wisely.", + ), lambda: "TODO", ) @@ -2433,8 +2455,15 @@ def hint_level109(): description_level117, hint_level117, ) = ( - lambda: "TODO", - lambda: "TODO", + lambda: "Wiggle while you work", + lambda: build_description( + title_level117(), + "This time is's a little harder. We've added the directions back in." + "
" + "Can you put them in the right place?" + "

" + "Notice how the Python looks in the console.", + ), lambda: "TODO", ) @@ -2443,8 +2472,13 @@ def hint_level109(): description_level118, hint_level118, ) = ( - lambda: "TODO", - lambda: "TODO", + lambda: "This way, that way, forwards...", + lambda: build_description( + title_level118(), + "Now all three directions are back!" + "
" + "Use what you have learned so far to get your delivery completed.", + ), lambda: "TODO", ) @@ -2453,8 +2487,13 @@ def hint_level109(): description_level119, hint_level119, ) = ( - lambda: "TODO", - lambda: "TODO", + lambda: "Four leaf clover", + lambda: build_description( + title_level119(), + "Now let's try what you've learned without blocks." + "
" + "Click on the Py Commands button to remind yourself of the syntax you need.", + ), lambda: "TODO", ) @@ -2463,8 +2502,11 @@ def hint_level109(): description_level120, hint_level120, ) = ( - lambda: "TODO", - lambda: "TODO", + lambda: "Pond life", + lambda: build_description( + title_level120(), + "So many routes but only one that is efficient. Can you work out which one it is?", + ), lambda: "TODO", ) @@ -2473,8 +2515,11 @@ def hint_level109(): description_level121, hint_level121, ) = ( - lambda: "TODO", - lambda: "TODO", + lambda: "Farmyard overdrive", + lambda: build_description( + title_level121(), + "Maybe including a loop is the answer here?", + ), lambda: "TODO", ) @@ -2483,8 +2528,11 @@ def hint_level109(): description_level122, hint_level122, ) = ( - lambda: "TODO", - lambda: "TODO", + lambda: "Snnnaaaake reflection", + lambda: build_description( + title_level122(), + "Can you see some patterns? Looks like those loops will come in handy again for this tricky route.", + ), lambda: "TODO", ) From 1cca5e91c8acdcfff60f4c6407278018e1a186b7 Mon Sep 17 00:00:00 2001 From: SKairinos Date: Mon, 30 Oct 2023 11:58:25 +0000 Subject: [PATCH 10/21] setup for other episodes --- game/messages.py | 62 ++++++++++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/game/messages.py b/game/messages.py index a0e86b297..87d66039d 100644 --- a/game/messages.py +++ b/game/messages.py @@ -2544,7 +2544,7 @@ def hint_level109(): hint_level123, ) = ( lambda: "TODO", - lambda: "TODO", + lambda: build_description(title_level123(), "TODO"), lambda: "TODO", ) @@ -2554,7 +2554,7 @@ def hint_level109(): hint_level124, ) = ( lambda: "TODO", - lambda: "TODO", + lambda: build_description(title_level124(), "TODO"), lambda: "TODO", ) @@ -2564,7 +2564,7 @@ def hint_level109(): hint_level125, ) = ( lambda: "TODO", - lambda: "TODO", + lambda: build_description(title_level125(), "TODO"), lambda: "TODO", ) @@ -2574,7 +2574,7 @@ def hint_level109(): hint_level126, ) = ( lambda: "TODO", - lambda: "TODO", + lambda: build_description(title_level126(), "TODO"), lambda: "TODO", ) @@ -2584,7 +2584,7 @@ def hint_level109(): hint_level127, ) = ( lambda: "TODO", - lambda: "TODO", + lambda: build_description(title_level127(), "TODO"), lambda: "TODO", ) @@ -2594,7 +2594,7 @@ def hint_level109(): hint_level128, ) = ( lambda: "TODO", - lambda: "TODO", + lambda: build_description(title_level128(), "TODO"), lambda: "TODO", ) @@ -2604,7 +2604,7 @@ def hint_level109(): hint_level129, ) = ( lambda: "TODO", - lambda: "TODO", + lambda: build_description(title_level129(), "TODO"), lambda: "TODO", ) @@ -2614,7 +2614,7 @@ def hint_level109(): hint_level130, ) = ( lambda: "TODO", - lambda: "TODO", + lambda: build_description(title_level130(), "TODO"), lambda: "TODO", ) @@ -2624,7 +2624,7 @@ def hint_level109(): hint_level131, ) = ( lambda: "TODO", - lambda: "TODO", + lambda: build_description(title_level131(), "TODO"), lambda: "TODO", ) @@ -2634,7 +2634,7 @@ def hint_level109(): hint_level132, ) = ( lambda: "TODO", - lambda: "TODO", + lambda: build_description(title_level132(), "TODO"), lambda: "TODO", ) @@ -2644,7 +2644,7 @@ def hint_level109(): hint_level133, ) = ( lambda: "TODO", - lambda: "TODO", + lambda: build_description(title_level133(), "TODO"), lambda: "TODO", ) @@ -2654,7 +2654,7 @@ def hint_level109(): hint_level134, ) = ( lambda: "TODO", - lambda: "TODO", + lambda: build_description(title_level134(), "TODO"), lambda: "TODO", ) @@ -2664,7 +2664,7 @@ def hint_level109(): hint_level135, ) = ( lambda: "TODO", - lambda: "TODO", + lambda: build_description(title_level135(), "TODO"), lambda: "TODO", ) @@ -2674,7 +2674,7 @@ def hint_level109(): hint_level136, ) = ( lambda: "TODO", - lambda: "TODO", + lambda: build_description(title_level136(), "TODO"), lambda: "TODO", ) @@ -2684,7 +2684,7 @@ def hint_level109(): hint_level137, ) = ( lambda: "TODO", - lambda: "TODO", + lambda: build_description(title_level137(), "TODO"), lambda: "TODO", ) @@ -2694,7 +2694,7 @@ def hint_level109(): hint_level138, ) = ( lambda: "TODO", - lambda: "TODO", + lambda: build_description(title_level138(), "TODO"), lambda: "TODO", ) @@ -2704,7 +2704,7 @@ def hint_level109(): hint_level139, ) = ( lambda: "TODO", - lambda: "TODO", + lambda: build_description(title_level139(), "TODO"), lambda: "TODO", ) @@ -2714,7 +2714,7 @@ def hint_level109(): hint_level140, ) = ( lambda: "TODO", - lambda: "TODO", + lambda: build_description(title_level140(), "TODO"), lambda: "TODO", ) @@ -2726,7 +2726,7 @@ def hint_level109(): hint_level141, ) = ( lambda: "TODO", - lambda: "TODO", + lambda: build_description(title_level141(), "TODO"), lambda: "TODO", ) @@ -2736,7 +2736,7 @@ def hint_level109(): hint_level142, ) = ( lambda: "TODO", - lambda: "TODO", + lambda: build_description(title_level142(), "TODO"), lambda: "TODO", ) @@ -2746,7 +2746,7 @@ def hint_level109(): hint_level143, ) = ( lambda: "TODO", - lambda: "TODO", + lambda: build_description(title_level143(), "TODO"), lambda: "TODO", ) @@ -2756,7 +2756,7 @@ def hint_level109(): hint_level144, ) = ( lambda: "TODO", - lambda: "TODO", + lambda: build_description(title_level144(), "TODO"), lambda: "TODO", ) @@ -2766,7 +2766,7 @@ def hint_level109(): hint_level145, ) = ( lambda: "TODO", - lambda: "TODO", + lambda: build_description(title_level145(), "TODO"), lambda: "TODO", ) @@ -2776,7 +2776,7 @@ def hint_level109(): hint_level146, ) = ( lambda: "TODO", - lambda: "TODO", + lambda: build_description(title_level146(), "TODO"), lambda: "TODO", ) @@ -2786,7 +2786,7 @@ def hint_level109(): hint_level147, ) = ( lambda: "TODO", - lambda: "TODO", + lambda: build_description(title_level147(), "TODO"), lambda: "TODO", ) @@ -2796,7 +2796,7 @@ def hint_level109(): hint_level148, ) = ( lambda: "TODO", - lambda: "TODO", + lambda: build_description(title_level148(), "TODO"), lambda: "TODO", ) @@ -2808,7 +2808,7 @@ def hint_level109(): hint_level149, ) = ( lambda: "TODO", - lambda: "TODO", + lambda: build_description(title_level149(), "TODO"), lambda: "TODO", ) @@ -2818,7 +2818,7 @@ def hint_level109(): hint_level150, ) = ( lambda: "TODO", - lambda: "TODO", + lambda: build_description(title_level150(), "TODO"), lambda: "TODO", ) @@ -2828,7 +2828,7 @@ def hint_level109(): hint_level151, ) = ( lambda: "TODO", - lambda: "TODO", + lambda: build_description(title_level151(), "TODO"), lambda: "TODO", ) @@ -2838,7 +2838,7 @@ def hint_level109(): hint_level152, ) = ( lambda: "TODO", - lambda: "TODO", + lambda: build_description(title_level152(), "TODO"), lambda: "TODO", ) @@ -2848,7 +2848,7 @@ def hint_level109(): hint_level153, ) = ( lambda: "TODO", - lambda: "TODO", + lambda: build_description(title_level153(), "TODO"), lambda: "TODO", ) From 17389e814307ffa9d7af64e9d17a1d0d5056d476 Mon Sep 17 00:00:00 2001 From: SKairinos Date: Mon, 30 Oct 2023 12:27:21 +0000 Subject: [PATCH 11/21] disconnect levels 122 and 123 --- game/migrations/0084_loop_levels.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/game/migrations/0084_loop_levels.py b/game/migrations/0084_loop_levels.py index 39c9ccf82..133152cfa 100644 --- a/game/migrations/0084_loop_levels.py +++ b/game/migrations/0084_loop_levels.py @@ -236,7 +236,7 @@ def add_loop_levels(apps: Apps, *args): name="122", episode=episode_12, path="", - next_level=level_123, + # next_level=level_123, TODO: connect them when the next levels are enabled. ) level_121 = Level.objects.create( name="121", From 338179574ea8959a7fe16041f2db10ffe60705e9 Mon Sep 17 00:00:00 2001 From: SKairinos Date: Mon, 30 Oct 2023 12:29:09 +0000 Subject: [PATCH 12/21] remove unused comments --- game/migrations/0084_loop_levels.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/game/migrations/0084_loop_levels.py b/game/migrations/0084_loop_levels.py index 133152cfa..f7cfa6426 100644 --- a/game/migrations/0084_loop_levels.py +++ b/game/migrations/0084_loop_levels.py @@ -5,8 +5,6 @@ def add_loop_levels(apps: Apps, *args): Level = apps.get_model("game", "Level") Episode = apps.get_model("game", "Episode") - # Theme = apps.get_model("game", "Theme") - # Character = apps.get_model("game", "Character") episode_15 = Episode.objects.create( pk=15, @@ -32,14 +30,6 @@ def add_loop_levels(apps: Apps, *args): episode_11.next_episode = episode_12 episode_11.save() - # theme_grass = Theme.objects.get(name="grass") - # theme_snow = Theme.objects.get(name="snow") - # theme_farm = Theme.objects.get(name="farm") - # theme_city = Theme.objects.get(name="city") - - # character_van = Character.objects.get(name="Van") - # character_dee = Character.objects.get(name="Dee") - # Episode 15, Levels 149 - 153 level_153 = Level.objects.create( name="153", From a7fe6d302c4a60f15eb9ee674c27c31bd5a4f545 Mon Sep 17 00:00:00 2001 From: SKairinos Date: Mon, 30 Oct 2023 12:42:01 +0000 Subject: [PATCH 13/21] difficulty --- game/models.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/game/models.py b/game/models.py index 0e1fdaade..496657f2c 100644 --- a/game/models.py +++ b/game/models.py @@ -1,6 +1,6 @@ from builtins import str -from common.models import UserProfile, Student, Class +from common.models import Class, Student, UserProfile from django.contrib.auth.models import User from django.db import models @@ -35,6 +35,7 @@ def __str__(self): class Meta: ordering = ["block_type", "pk"] + class Episode(models.Model): """Variables prefixed with r_ signify they are parameters for random level generation""" @@ -83,6 +84,10 @@ def difficulty(self): 9: "brainteasers", 10: "hard", 11: "advanced", + 12: "loops", + 13: "loops", + 14: "loops", + 15: "loops", } return difficulty_map.get(self.id, "easy") From a6b786442d554aa3a5584b03b8f448bfedfc8236 Mon Sep 17 00:00:00 2001 From: SKairinos Date: Mon, 30 Oct 2023 12:42:26 +0000 Subject: [PATCH 14/21] formatting --- game/templates/game/level_selection.html | 246 ++++++++++++----------- game/views/level_selection.py | 43 +++- 2 files changed, 165 insertions(+), 124 deletions(-) diff --git a/game/templates/game/level_selection.html b/game/templates/game/level_selection.html index f3ca0888f..2503234fb 100644 --- a/game/templates/game/level_selection.html +++ b/game/templates/game/level_selection.html @@ -9,39 +9,39 @@ - + {% endblock %} {% block css %} @@ -57,13 +57,13 @@ {% block nav_ocargo_levels %} - {% if user|is_logged_in_as_student %} - Levels - {% elif user|is_independent_student %} - Levels - {% else %} - Levels - {% endif %} +{% if user|is_logged_in_as_student %} +Levels +{% elif user|is_independent_student %} +Levels +{% else %} +Levels +{% endif %} {% endblock nav_ocargo_levels %} {% block content %} @@ -77,9 +77,12 @@

Blockly levels

{% for episode in blocklyEpisodes %}
-

Blockly levels

{% for level in episode.levels %} - {% if user|is_logged_in_as_student and user.new_student.class_field in level.locked_for_class.all %} - -

- {{level.name}}: {{level.title.strip | safe}} - {% if level.score != None %} - {{level.score|floatformat}}/{{level.maxScore|floatformat}} - - {% endif %} -

- {% else %} - -

- {{level.name}}: {{level.title.strip | safe}} - {% if level.score != None %} - {{level.score|floatformat}}/{{level.maxScore|floatformat}} - - {% endif %} -

+ {% if user|is_logged_in_as_student and user.new_student.class_field in level.locked_for_class.all %} + +

+ {{level.name}}: {{level.title.strip | safe}} + {% if level.score != None %} + {{level.score|floatformat}}/{{level.maxScore|floatformat}} + + {% endif %} +

+ {% else %} + +

+ {{level.name}}: {{level.title.strip | + safe}} + {% if level.score != None %} + {{level.score|floatformat}}/{{level.maxScore|floatformat}} + {% endif %} +

+ {% endif %} {% endfor %} {% if episode.random_levels_enabled %}

- Random: Try your hand at a random level. + Random: Try your hand at a random level.

{% endif %} @@ -130,9 +135,12 @@

Python levels

{% for episode in pythonEpisodes %}
-

Python levels

{% for level in episode.levels %} - {% if user|is_logged_in_as_student and user.new_student.class_field in level.locked_for_class.all %} - -

- {{level.name}}: {{level.title.strip | safe}} - {% if level.score != None %} - {{level.score|floatformat}}/{{level.maxScore|floatformat}} - - {% endif %} -

- {% else %} - -

- {{level.name}}: {{level.title.strip | safe}} - {% if level.score != None %} - {{level.score|floatformat}}/{{level.maxScore|floatformat}} - - {% endif %} -

+ {% if user|is_logged_in_as_student and user.new_student.class_field in level.locked_for_class.all %} + +

+ {{level.name}}: {{level.title.strip | safe}} + {% if level.score != None %} + {{level.score|floatformat}}/{{level.maxScore|floatformat}} + {% endif %} +

+ {% else %} + +

+ {{level.name}}: {{level.title.strip | + safe}} + {% if level.score != None %} + {{level.score|floatformat}}/{{level.maxScore|floatformat}} + + {% endif %} +

+ {% endif %} {% endfor %}
@@ -174,26 +184,29 @@

Created levels

-
{% if owned_levels %} - {% for level in owned_levels %} -

- {{level.title}} - {% if level.score != None %} - {{level.score|floatformat}}/10 - - {% endif %} -

- {% endfor %} + {% for level in owned_levels %} +

+ {{level.title}} + {% if level.score != None %} + {{level.score|floatformat}}/10 + + {% endif %} +

+ {% endfor %} {% else %} -

No levels have been created by you yet.

+

No levels have been created by you yet.

{% endif %}
@@ -201,54 +214,57 @@

Created levels

-
{% if user|is_logged_in_as_admin_teacher %} -
Your classes
+
Your classes
{% endif %} {% if directly_shared_levels %} - {% for level in directly_shared_levels %} -

- - {{ level.title }}, {{ level.owner|make_into_username }} - {% if level.class %} - ({{ level.class }}) - {% endif %} - - {% if level.score != None %} - {{ level.score|floatformat }}/10 - - {% endif %} -

- {% endfor %} + {% for level in directly_shared_levels %} +

+ + {{ level.title }}, {{ level.owner|make_into_username }} + {% if level.class %} + ({{ level.class }}) + {% endif %} + + {% if level.score != None %} + {{ level.score|floatformat }}/10 + + {% endif %} +

+ {% endfor %} {% else %} -

No levels.

+

No levels.

{% endif %} {% if indirectly_shared_levels %} - {% for teacher, levels in indirectly_shared_levels.items %} -
Owned by {{ teacher|make_into_username }}
- {% for level in levels %} -

- - {{ level.title }}, {{level.owner|make_into_username}} - {% if level.class %} - ({{ level.class }}) - {% endif %} - - {% if level.score != None %} - {{level.score|floatformat}}/10 - - {% endif %} -

- {% endfor %} - {% endfor %} + {% for teacher, levels in indirectly_shared_levels.items %} +
Owned by {{ teacher|make_into_username }}
+ {% for level in levels %} +

+ + {{ level.title }}, {{level.owner|make_into_username}} + {% if level.class %} + ({{ level.class }}) + {% endif %} + + {% if level.score != None %} + {{level.score|floatformat}}/10 + + {% endif %} +

+ {% endfor %} + {% endfor %} {% endif %}
@@ -256,4 +272,4 @@
Owned by {{ teacher|make_into_username }}
{% endif %}
-{% endblock content %} +{% endblock content %} \ No newline at end of file diff --git a/game/views/level_selection.py b/game/views/level_selection.py index d2c9c2e59..4d487cc8a 100644 --- a/game/views/level_selection.py +++ b/game/views/level_selection.py @@ -12,6 +12,7 @@ from game import app_settings, random_road from game.cache import cached_episode from game.models import Attempt, Episode, Level + from .level_editor import play_anonymous_level @@ -43,7 +44,12 @@ def fetch_episode_data_from_database(early_access, start, end): minName = level_name levels.append( - {"id": level.id, "name": level_name, "maxScore": max_score(level), "title": get_level_title(level_name)} + { + "id": level.id, + "name": level_name, + "maxScore": max_score(level), + "title": get_level_title(level_name), + } ) e = { @@ -78,7 +84,10 @@ def fetch_episode_data(early_access, start=1, end=12): dict( episode, name=messages.get_episode_title(episode["id"]), - levels=[dict(level, title=get_level_title(level["name"])) for level in episode["levels"]], + levels=[ + dict(level, title=get_level_title(level["name"])) + for level in episode["levels"] + ], ) for episode in data ] @@ -114,7 +123,8 @@ def get_blockly_episodes(request): def get_python_episodes(request): - return fetch_episode_data(app_settings.EARLY_ACCESS_FUNCTION(request), 10, 11) + return fetch_episode_data(app_settings.EARLY_ACCESS_FUNCTION(request), 10, 15) + def levels(request): """Loads a page with all levels listed. @@ -145,13 +155,17 @@ def levels(request): for episode in blockly_episodes: for level in episode["levels"]: attach_attempts_to_level(attempts, level) - level["locked_for_class"] = Level.objects.get(id=level["id"]).locked_for_class + level["locked_for_class"] = Level.objects.get( + id=level["id"] + ).locked_for_class python_episodes = get_python_episodes(request) for episode in python_episodes: for level in episode["levels"]: attach_attempts_to_level(attempts, level) - level["locked_for_class"] = Level.objects.get(id=level["id"]).locked_for_class + level["locked_for_class"] = Level.objects.get( + id=level["id"] + ).locked_for_class owned_level_data = [] directly_shared_levels = [] @@ -161,7 +175,12 @@ def levels(request): for level in owned_levels: owned_level_data.append( - {"id": level.id, "title": level.name, "score": attempts.get(level.id), "maxScore": 10} + { + "id": level.id, + "title": level.name, + "score": attempts.get(level.id), + "maxScore": 10, + } ) for level in shared_levels: @@ -176,20 +195,26 @@ def levels(request): if teacher not in indirectly_shared_levels: indirectly_shared_levels[teacher] = [] - indirectly_shared_levels[teacher].append(get_shared_level(level, attempts)) + indirectly_shared_levels[teacher].append( + get_shared_level(level, attempts) + ) else: student_class = level.owner.student.class_field class_teacher = student_class.teacher.new_user # get levels shared by students in the current user's classes if class_teacher == user: - directly_shared_levels.append(get_shared_level(level, attempts, student_class)) + directly_shared_levels.append( + get_shared_level(level, attempts, student_class) + ) # get levels shared by students in the other teachers' classes else: if class_teacher not in indirectly_shared_levels: indirectly_shared_levels[class_teacher] = [] - indirectly_shared_levels[class_teacher].append(get_shared_level(level, attempts, student_class)) + indirectly_shared_levels[class_teacher].append( + get_shared_level(level, attempts, student_class) + ) # if user is a student or a standard teacher, just get levels shared with them directly. else: directly_shared_levels.append(get_shared_level(level, attempts)) From bdf6c49677b4ab791b7103e1e638eee081d4b0f8 Mon Sep 17 00:00:00 2001 From: SKairinos Date: Mon, 30 Oct 2023 12:49:19 +0000 Subject: [PATCH 15/21] undo formatting --- game/templates/game/level_selection.html | 244 +++++++++++------------ 1 file changed, 114 insertions(+), 130 deletions(-) diff --git a/game/templates/game/level_selection.html b/game/templates/game/level_selection.html index 2503234fb..d78fd836c 100644 --- a/game/templates/game/level_selection.html +++ b/game/templates/game/level_selection.html @@ -9,39 +9,39 @@ - + {% endblock %} {% block css %} @@ -57,13 +57,13 @@ {% block nav_ocargo_levels %} -{% if user|is_logged_in_as_student %} -Levels -{% elif user|is_independent_student %} -Levels -{% else %} -Levels -{% endif %} + {% if user|is_logged_in_as_student %} + Levels + {% elif user|is_independent_student %} + Levels + {% else %} + Levels + {% endif %} {% endblock nav_ocargo_levels %} {% block content %} @@ -77,12 +77,9 @@

Blockly levels

{% for episode in blocklyEpisodes %}
-

Blockly levels

{% for level in episode.levels %} - {% if user|is_logged_in_as_student and user.new_student.class_field in level.locked_for_class.all %} - -

- {{level.name}}: {{level.title.strip | safe}} - {% if level.score != None %} - {{level.score|floatformat}}/{{level.maxScore|floatformat}} - - {% endif %} -

- {% else %} - -

- {{level.name}}: {{level.title.strip | - safe}} - {% if level.score != None %} - {{level.score|floatformat}}/{{level.maxScore|floatformat}} - + {% if user|is_logged_in_as_student and user.new_student.class_field in level.locked_for_class.all %} + +

+ {{level.name}}: {{level.title.strip | safe}} + {% if level.score != None %} + {{level.score|floatformat}}/{{level.maxScore|floatformat}} + + {% endif %} +

+ {% else %} + +

+ {{level.name}}: {{level.title.strip | safe}} + {% if level.score != None %} + {{level.score|floatformat}}/{{level.maxScore|floatformat}} + + {% endif %} +

{% endif %} -

- {% endif %} {% endfor %} {% if episode.random_levels_enabled %}

- Random: Try your hand at a random level. + Random: Try your hand at a random level.

{% endif %} @@ -135,12 +130,9 @@

Python levels

{% for episode in pythonEpisodes %}
-

Python levels

{% for level in episode.levels %} - {% if user|is_logged_in_as_student and user.new_student.class_field in level.locked_for_class.all %} - -

- {{level.name}}: {{level.title.strip | safe}} - {% if level.score != None %} - {{level.score|floatformat}}/{{level.maxScore|floatformat}} - + {% if user|is_logged_in_as_student and user.new_student.class_field in level.locked_for_class.all %} + +

+ {{level.name}}: {{level.title.strip | safe}} + {% if level.score != None %} + {{level.score|floatformat}}/{{level.maxScore|floatformat}} + + {% endif %} +

+ {% else %} + +

+ {{level.name}}: {{level.title.strip | safe}} + {% if level.score != None %} + {{level.score|floatformat}}/{{level.maxScore|floatformat}} + + {% endif %} +

{% endif %} -

- {% else %} - -

- {{level.name}}: {{level.title.strip | - safe}} - {% if level.score != None %} - {{level.score|floatformat}}/{{level.maxScore|floatformat}} - - {% endif %} -

- {% endif %} {% endfor %}
@@ -184,29 +174,26 @@

Created levels

-
{% if owned_levels %} - {% for level in owned_levels %} -

- {{level.title}} - {% if level.score != None %} - {{level.score|floatformat}}/10 - - {% endif %} -

- {% endfor %} + {% for level in owned_levels %} +

+ {{level.title}} + {% if level.score != None %} + {{level.score|floatformat}}/10 + + {% endif %} +

+ {% endfor %} {% else %} -

No levels have been created by you yet.

+

No levels have been created by you yet.

{% endif %}
@@ -214,57 +201,54 @@

Created levels

-
{% if user|is_logged_in_as_admin_teacher %} -
Your classes
+
Your classes
{% endif %} {% if directly_shared_levels %} - {% for level in directly_shared_levels %} -

- - {{ level.title }}, {{ level.owner|make_into_username }} - {% if level.class %} - ({{ level.class }}) - {% endif %} - - {% if level.score != None %} - {{ level.score|floatformat }}/10 - - {% endif %} -

- {% endfor %} + {% for level in directly_shared_levels %} +

+ + {{ level.title }}, {{ level.owner|make_into_username }} + {% if level.class %} + ({{ level.class }}) + {% endif %} + + {% if level.score != None %} + {{ level.score|floatformat }}/10 + + {% endif %} +

+ {% endfor %} {% else %} -

No levels.

+

No levels.

{% endif %} {% if indirectly_shared_levels %} - {% for teacher, levels in indirectly_shared_levels.items %} -
Owned by {{ teacher|make_into_username }}
- {% for level in levels %} -

- - {{ level.title }}, {{level.owner|make_into_username}} - {% if level.class %} - ({{ level.class }}) - {% endif %} - - {% if level.score != None %} - {{level.score|floatformat}}/10 - - {% endif %} -

- {% endfor %} - {% endfor %} + {% for teacher, levels in indirectly_shared_levels.items %} +
Owned by {{ teacher|make_into_username }}
+ {% for level in levels %} +

+ + {{ level.title }}, {{level.owner|make_into_username}} + {% if level.class %} + ({{ level.class }}) + {% endif %} + + {% if level.score != None %} + {{level.score|floatformat}}/10 + + {% endif %} +

+ {% endfor %} + {% endfor %} {% endif %}
From 7bb803eb1ac9ef7051c7911f0539ae5410eeec1e Mon Sep 17 00:00:00 2001 From: SKairinos Date: Mon, 30 Oct 2023 12:49:29 +0000 Subject: [PATCH 16/21] add bg for loops --- game/static/game/css/backgrounds.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/game/static/game/css/backgrounds.css b/game/static/game/css/backgrounds.css index 4d6b004e4..05c3c315b 100644 --- a/game/static/game/css/backgrounds.css +++ b/game/static/game/css/backgrounds.css @@ -27,3 +27,7 @@ .bg--shared-levels { background: #f6be00; } + +.bg--loops { + background: #3F3F3F; +} From 69f27590c325f79867aba2f5d3f60db94c34ce75 Mon Sep 17 00:00:00 2001 From: SKairinos Date: Mon, 30 Oct 2023 13:09:44 +0000 Subject: [PATCH 17/21] iterate level links --- game/static/game/css/level_selection.css | 4 + game/templates/game/level_selection.html | 117 ++++++++++++++++------- 2 files changed, 88 insertions(+), 33 deletions(-) diff --git a/game/static/game/css/level_selection.css b/game/static/game/css/level_selection.css index 1762dfdae..62e11de1f 100644 --- a/game/static/game/css/level_selection.css +++ b/game/static/game/css/level_selection.css @@ -2,6 +2,10 @@ margin: 30px 0 20px 0; } +#episodes .panel-subintro { + margin: 20px 0 20px 0; +} + #episodes .panel-header { color: #fff; margin-bottom: 0; diff --git a/game/templates/game/level_selection.html b/game/templates/game/level_selection.html index d78fd836c..a449fafad 100644 --- a/game/templates/game/level_selection.html +++ b/game/templates/game/level_selection.html @@ -128,43 +128,94 @@

Python levels

here.
{% for episode in pythonEpisodes %} -
-
- -
+ {% if episode.difficulty != "loops" %} +
+
+ +
-
-
- {% for level in episode.levels %} - {% if user|is_logged_in_as_student and user.new_student.class_field in level.locked_for_class.all %} - -

- {{level.name}}: {{level.title.strip | safe}} - {% if level.score != None %} - {{level.score|floatformat}}/{{level.maxScore|floatformat}} - - {% endif %} -

- {% else %} - -

- {{level.name}}: {{level.title.strip | safe}} - {% if level.score != None %} - {{level.score|floatformat}}/{{level.maxScore|floatformat}} - +

+
+ {% for level in episode.levels %} + {% if user|is_logged_in_as_student and user.new_student.class_field in level.locked_for_class.all %} + +

+ {{level.name}}: {{level.title.strip | safe}} + {% if level.score != None %} + {{level.score|floatformat}}/{{level.maxScore|floatformat}} + + {% endif %} +

+ {% else %} + +

+ {{level.name}}: {{level.title.strip | safe}} + {% if level.score != None %} + {{level.score|floatformat}}/{{level.maxScore|floatformat}} + + {% endif %} +

{% endif %} -

- {% endif %} - {% endfor %} + {% endfor %} +
+
-
+ {% endif %} + {% endfor %} +
+ The following levels focus on Loops using Blockly and Python.
+ {% for episode in pythonEpisodes %} + {% if episode.difficulty == "loops" %} +
+
+ +
+ +
+
+ {% for level in episode.levels %} + {% if user|is_logged_in_as_student and user.new_student.class_field in level.locked_for_class.all %} + +

+ {{level.name}}: {{level.title.strip | safe}} + {% if level.score != None %} + {{level.score|floatformat}}/{{level.maxScore|floatformat}} + + {% endif %} +

+ {% else %} + +

+ {{level.name}}: {{level.title.strip | safe}} + {% if level.score != None %} + {{level.score|floatformat}}/{{level.maxScore|floatformat}} + + {% endif %} +

+ {% endif %} + {% endfor %} +
+
+
+ {% endif %} {% endfor %} {% if user|is_logged_in %} From 6b71359743af675fd053643ffb4fc85d48e9d165 Mon Sep 17 00:00:00 2001 From: SKairinos Date: Mon, 30 Oct 2023 13:24:58 +0000 Subject: [PATCH 18/21] add hints --- game/messages.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/game/messages.py b/game/messages.py index 87d66039d..da85a815a 100644 --- a/game/messages.py +++ b/game/messages.py @@ -2368,7 +2368,7 @@ def hint_level109(): title_level110(), "As you create your program using Blockly, see what it looks like in the Python programming language. Can you tell which Python statement matches which block?", ), - lambda: "TODO", + lambda: "This is a deliberately simple level. What you need to focus on is the Python code that is being generated for the blocks you join.", ) ( @@ -2381,7 +2381,7 @@ def hint_level109(): title_level111(), "As you create your program using Blockly, see what it looks like in the Python programming language. Can you tell which Python statement matches which block?", ), - lambda: "TODO", + lambda: "This is a deliberately simple level. What you need to focus on is the Python code that is being generated for the blocks you join.", ) ( @@ -2396,7 +2396,7 @@ def hint_level109(): "

" "Don't forget to find the shortest route!", ), - lambda: "TODO", + lambda: "Pay close attention to the spelling of the Python commands, the use of the dot and the round brackets.", ) ( @@ -2409,7 +2409,7 @@ def hint_level109(): title_level113(), "Can you remember how the Python was formed under the blocks in the previous levels? Take a look in the Py Commands for a quick reminder.", ), - lambda: "TODO", + lambda: "Now it is your turn, you can click on the Py commands button for a reminder of the Python commands that you can use.", ) ( @@ -2422,7 +2422,7 @@ def hint_level109(): title_level114(), "This route is just a bit longer. Make sure you type the Python code accurately!", ), - lambda: "TODO", + lambda: "The most common errors here are missing the round brackets at the end of the commands or mis-typing the commands, e.g. use my_van.move_fowards() and not my_van.move_foward()", ) ( @@ -2432,7 +2432,7 @@ def hint_level109(): ) = ( lambda: "Which way to turn? This way or that way?", lambda: build_description(title_level115(), "TODO"), - lambda: "TODO", + lambda: "If you are stuck on this one, check that the you are using the Python commands accurately. Click the Py Commands button to help you.", ) ( @@ -2447,7 +2447,7 @@ def hint_level109(): "
" "Can you do it? Name your variables wisely.", ), - lambda: "TODO", + lambda: "Make sure that you are using the right blocks here. You must use the pink block for variables and the dark blue number block for values. Watch the video if you are unsure.", ) ( @@ -2464,7 +2464,7 @@ def hint_level109(): "

" "Notice how the Python looks in the console.", ), - lambda: "TODO", + lambda: "If you cannot solve this one, try creating a solution without a while loop and then looking for what is repeated...", ) ( @@ -2479,7 +2479,7 @@ def hint_level109(): "
" "Use what you have learned so far to get your delivery completed.", ), - lambda: "TODO", + lambda: "You can solve this in stages. Try moving to the start of the repeated section, then adding the loop and then finishing it off.", ) ( @@ -2494,7 +2494,7 @@ def hint_level109(): "
" "Click on the Py Commands button to remind yourself of the syntax you need.", ), - lambda: "TODO", + lambda: "If you cannot solve this one, try creating a solution without a while loop and then looking for what is repeated...", ) ( @@ -2507,7 +2507,7 @@ def hint_level109(): title_level120(), "So many routes but only one that is efficient. Can you work out which one it is?", ), - lambda: "TODO", + lambda: "What if you go down the middle section?", ) ( @@ -2520,7 +2520,7 @@ def hint_level109(): title_level121(), "Maybe including a loop is the answer here?", ), - lambda: "TODO", + lambda: "Try that middle route...", ) ( @@ -2533,7 +2533,7 @@ def hint_level109(): title_level122(), "Can you see some patterns? Looks like those loops will come in handy again for this tricky route.", ), - lambda: "TODO", + lambda: "Don't try to solve this in one go. Work out the pattern for the top route and check that works. Then move on to the next part...", ) From 9c7b0a91bef907da2bc4d8b4f8748208cc7c0522 Mon Sep 17 00:00:00 2001 From: SKairinos Date: Mon, 30 Oct 2023 14:31:17 +0000 Subject: [PATCH 19/21] level 115 description --- game/messages.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/game/messages.py b/game/messages.py index da85a815a..e3812dd06 100644 --- a/game/messages.py +++ b/game/messages.py @@ -2431,7 +2431,7 @@ def hint_level109(): hint_level115, ) = ( lambda: "Which way to turn? This way or that way?", - lambda: build_description(title_level115(), "TODO"), + lambda: build_description(title_level115(), "Try to find the shortest route using Python code only. You are getting really good at this!"), lambda: "If you are stuck on this one, check that the you are using the Python commands accurately. Click the Py Commands button to help you.", ) From bbb236f253f1842c6936dacc3c852ab4562f3f68 Mon Sep 17 00:00:00 2001 From: SKairinos Date: Mon, 30 Oct 2023 18:29:11 +0000 Subject: [PATCH 20/21] remove extra the --- game/messages.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/game/messages.py b/game/messages.py index e3812dd06..29934aafe 100644 --- a/game/messages.py +++ b/game/messages.py @@ -2432,7 +2432,7 @@ def hint_level109(): ) = ( lambda: "Which way to turn? This way or that way?", lambda: build_description(title_level115(), "Try to find the shortest route using Python code only. You are getting really good at this!"), - lambda: "If you are stuck on this one, check that the you are using the Python commands accurately. Click the Py Commands button to help you.", + lambda: "If you are stuck on this one, check that you are using the Python commands accurately. Click the Py Commands button to help you.", ) ( From 56651a6bca7a2d6d7a41e4f0f4af7896fe809a15 Mon Sep 17 00:00:00 2001 From: SKairinos Date: Mon, 30 Oct 2023 18:32:45 +0000 Subject: [PATCH 21/21] update migration name --- game/migrations/{0084_loop_levels.py => 0086_loop_levels.py} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename game/migrations/{0084_loop_levels.py => 0086_loop_levels.py} (99%) diff --git a/game/migrations/0084_loop_levels.py b/game/migrations/0086_loop_levels.py similarity index 99% rename from game/migrations/0084_loop_levels.py rename to game/migrations/0086_loop_levels.py index f7cfa6426..300c86c54 100644 --- a/game/migrations/0084_loop_levels.py +++ b/game/migrations/0086_loop_levels.py @@ -307,7 +307,7 @@ def add_loop_levels(apps: Apps, *args): class Migration(migrations.Migration): - dependencies = [("game", "0083_add_cows_to_existing_levels")] + dependencies = [("game", "0085_add_new_blocks")] operations = [ migrations.RunPython( add_loop_levels,