faaizashiq commited on
Commit
caeaa00
·
verified ·
1 Parent(s): f2fd2d1

Update backend/agents/scenario_agent.py

Browse files
Files changed (1) hide show
  1. backend/agents/scenario_agent.py +18 -84
backend/agents/scenario_agent.py CHANGED
@@ -164,8 +164,8 @@ class ScenarioAgent:
164
  base_prompt = f"""
165
  You are the Lead Game Designer for 'CodeCracker', an educational coding game for ages 10-14.
166
  Your task is to generate a UNIQUE STORY ARC of EXACTLY 5 interconnected game levels in JSON format.
167
- The story MUST be a single cohesive narrative that progresses from level 1 to level 5.
168
- Each level's 'story' field should build upon the previous one.
169
 
170
  CURRENT SETTINGS:
171
  - Mode: {mode}
@@ -180,7 +180,7 @@ class ScenarioAgent:
180
  {self._get_few_shot_examples(mode)}
181
 
182
  OUTPUT FORMAT: RAW JSON ONLY (No Markdown).
183
- The JSON must be an object with "story_arc_title" and a "levels" array containing EXACTLY 5 levels.
184
  """
185
 
186
  if mode == "maze":
@@ -370,88 +370,22 @@ class ScenarioAgent:
370
  elif mode == "blockly":
371
  return {
372
  "story_arc_title": "Logic Repair Arc",
373
- "levels": [
374
- {
375
- "type": "blockly",
376
- "level_id": "fallback_b_01",
377
- "title": "System Reboot",
378
- "story": "The mainframe is unresponsive. We need to send a simple '3' signal to wake it up.",
379
- "concept_tutorial": "Variables & Output: We use code to send values to the system.",
380
- "problem": "Print the number 3.",
381
- "toolbox_categories": ["Text", "Math"],
382
- "initial_code": "",
383
- "validation_rules": {
384
- "required_concepts": ["print"],
385
- "expected_output": "3"
386
- },
387
- "hint_1": "Use the 'print' block.",
388
- "hint_2": "Snap a number block '3' inside it."
389
- },
390
- {
391
- "type": "blockly",
392
- "level_id": "fallback_b_02",
393
- "title": "Data Stream",
394
- "story": "Mainframe is awake! Now we need to repeat the signal 3 times to stabilize the connection.",
395
- "concept_tutorial": "Loops: Use loops to repeat actions without writing code over and over.",
396
- "problem": "Create a loop that prints '3' three times.",
397
- "toolbox_categories": ["Loops", "Text", "Math"],
398
- "initial_code": "",
399
- "validation_rules": {
400
- "required_concepts": ["loop", "print"],
401
- "expected_output": "3,3,3"
402
- },
403
- "hint_1": "Use the 'repeat' block.",
404
- "hint_2": "Set the loop count to 3."
405
- },
406
- {
407
- "type": "blockly",
408
- "level_id": "fallback_b_03",
409
- "title": "Oxygen Check",
410
- "story": "Connection stable. Now check the oxygen levels. If they are below 20, we need to print 'Warning'.",
411
- "concept_tutorial": "Logic: Use 'If' blocks to make decisions based on values.",
412
- "problem": "Check if variable 'oxygen' (set to 15) is less than 20. If yes, print 'Warning'.",
413
- "toolbox_categories": ["Logic", "Variables", "Text", "Math"],
414
- "initial_code": "oxygen = 15",
415
- "validation_rules": {
416
- "required_concepts": ["if", "print"],
417
- "expected_output": "Warning"
418
- },
419
- "hint_1": "Use an 'if' block from Logic.",
420
- "hint_2": "Compare oxygen < 20."
421
- },
422
- {
423
- "type": "blockly",
424
- "level_id": "fallback_b_04",
425
- "title": "Security Key",
426
- "story": "Systems are green. Final step: generate a security key by adding 5 to the secret number 10.",
427
- "concept_tutorial": "Math: Computers are great at calculations.",
428
- "problem": "Add 5 to 10 and print the result.",
429
- "toolbox_categories": ["Math", "Text"],
430
- "initial_code": "",
431
- "validation_rules": {
432
- "required_concepts": ["print"],
433
- "expected_output": "15"
434
- },
435
- "hint_1": "Use the + block from Math.",
436
- "hint_2": ""
437
  },
438
- {
439
- "type": "blockly",
440
- "level_id": "fallback_b_05",
441
- "title": "Mission Complete",
442
- "story": "Access granted! Welcome back, Commander. Print 'Ready' to finish.",
443
- "concept_tutorial": "Final Review: You've mastered the basics of logic and calculation.",
444
- "problem": "Print 'Ready'.",
445
- "toolbox_categories": ["Text"],
446
- "initial_code": "",
447
- "validation_rules": {
448
- "required_concepts": ["print"],
449
- "expected_output": "Ready"
450
- },
451
- "hint_1": "One last print block!",
452
- "hint_2": ""
453
- }
454
- ]
455
  }
456
  elif mode == "time_challenge":
457
  return {
 
164
  base_prompt = f"""
165
  You are the Lead Game Designer for 'CodeCracker', an educational coding game for ages 10-14.
166
  Your task is to generate a UNIQUE STORY ARC of EXACTLY 5 interconnected game levels in JSON format.
167
+ The story MUST be based on STEM topics or real-life practical scenarios.
168
+ The levels should progress the story narratively from level 1 to the final level 5.
169
 
170
  CURRENT SETTINGS:
171
  - Mode: {mode}
 
180
  {self._get_few_shot_examples(mode)}
181
 
182
  OUTPUT FORMAT: RAW JSON ONLY (No Markdown).
183
+ The JSON must be an object with "story_arc_title" and a "levels" array containing the individual levels.
184
  """
185
 
186
  if mode == "maze":
 
370
  elif mode == "blockly":
371
  return {
372
  "story_arc_title": "Logic Repair Arc",
373
+ "levels": [{
374
+ "type": "blockly",
375
+ "level_id": "fallback_002",
376
+ "title": "Logic Repair",
377
+ "story": "The automated systems are down. We need manual logic configuration.",
378
+ "concept_tutorial": "Loops: Use loops to repeat actions without writing code over and over.",
379
+ "problem": "Create a loop that counts to 3.",
380
+ "toolbox_categories": ["Loops", "Math", "Variables"],
381
+ "initial_code": "",
382
+ "validation_rules": {
383
+ "required_concepts": ["loop"],
384
+ "expected_output": "3"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
385
  },
386
+ "hint_1": "Use the 'repeat' block.",
387
+ "hint_2": "Set the number to 3."
388
+ }]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
389
  }
390
  elif mode == "time_challenge":
391
  return {