opencompletion.com/research/activity30-logic-puzzles.yaml
Claude f774d36d74
Fix activity completion and progression issues in activities 30-37
This commit addresses two critical issues:

1. Completion Bug (activities 30-37):
   - Final steps were looping forever, preventing activity completion
   - Fixed by removing next_section_and_step from completion transitions
   - Kept off_topic transition looping to avoid validator terminal step errors
   - Activities now complete properly when users give valid final answers

2. Activity37 Bucket Logic:
   - Changed "close" bucket to retry same step instead of advancing
   - Only "correct" bucket now advances to next step
   - All other buckets (close, incomplete, wrong_language, etc.) retry
   - This ensures students must get correct answers to progress

Technical Details:
- Final steps are not considered "terminal" if at least one transition
  has next_section_and_step (validator requirement)
- Off-topic transitions loop back to allow another attempt
- Completion happens when get_next_step() returns None, None

Validation:
- All 8 activities pass activity_yaml_validator.py
- No errors or warnings

Affects: activity30-37 (all new merged activities)
2025-11-08 22:59:06 +00:00

598 lines
22 KiB
YAML

default_max_attempts_per_step: 3
tokens_for_ai_rubric: 'Evaluate the student''s performance throughout the logic puzzle activity.
Consider:
- Their ability to reason through logical statements
- Understanding of deductive reasoning
- Improvement over the course of the activity
- Engagement with explanations
Provide encouraging feedback and suggest areas for continued practice.
'
sections:
- section_id: introduction
title: Welcome to Logic Puzzles
steps:
- step_id: welcome
title: Welcome to Logic Puzzles
content_blocks:
- '# Welcome to Critical Thinking & Logic Puzzles!'
- In this activity, you'll develop your logical reasoning skills through a series of engaging puzzles.
- You'll learn to identify logical patterns, make deductions, and think critically.
- '**What you''ll learn:**'
- '- How to analyze logical statements'
- '- Deductive reasoning techniques'
- '- Pattern recognition'
- '- How to avoid common logical fallacies'
- ''
- Let's begin your journey into the world of logic!
question: Are you ready to sharpen your logical thinking skills?
tokens_for_ai: 'The student is expressing readiness to begin. Accept any positive, affirming response.
Categorize as:
- ready: Student is ready to proceed
- set_language: Student is setting language preference
- off_topic: Completely unrelated response
'
buckets:
- ready
- set_language
- off_topic
transitions:
ready:
content_blocks:
- Excellent! Let's start with the fundamentals of logical reasoning.
next_section_and_step: section_1:step_1
set_language:
content_blocks:
- I'll communicate with you in your preferred language.
counts_as_attempt: false
next_section_and_step: introduction:welcome
off_topic:
content_blocks:
- Let's focus on beginning our logic journey. Are you ready to start?
counts_as_attempt: false
next_section_and_step: introduction:welcome
- section_id: section_1
title: Basic Logical Statements
steps:
- step_id: step_1
title: Understanding Logical Statements
content_blocks:
- '## Understanding Logical Statements'
- Logic is about drawing valid conclusions from given information.
- ''
- '**Basic principle:** If A is true, and ''A implies B'' is true, then B must be true.'
- ''
- '**Example:**'
- '- Statement 1: All cats are mammals.'
- '- Statement 2: Whiskers is a cat.'
- '- Conclusion: Therefore, Whiskers is a mammal.'
- ''
- This is called **deductive reasoning** - going from general rules to specific cases.
question: Based on this reasoning, if 'All birds have feathers' and 'A robin is a bird', what can we conclude?
tokens_for_ai: 'The student should conclude that a robin has feathers.
Categorize as:
- correct: States that robin has feathers (exact wording doesn''t matter)
- partial_understanding: Mentions birds or feathers but incomplete reasoning
- limited_effort: Very brief or unclear answer
- off_topic: Unrelated response
'
feedback_tokens_for_ai: 'Provide feedback on their logical reasoning. If incorrect, gently explain the deductive
process: since ALL birds have feathers, and a robin IS a bird, then the robin must have feathers.
'
buckets:
- correct
- partial_understanding
- limited_effort
- off_topic
transitions:
correct:
ai_feedback:
tokens_for_ai: Praise their correct deductive reasoning and encourage them to continue.
metadata_add:
score: n+1
puzzles_solved: n+1
next_section_and_step: section_1:step_2
partial_understanding:
ai_feedback:
tokens_for_ai: Acknowledge what they got right, then gently guide them to the complete answer.
next_section_and_step: section_1:step_2
limited_effort:
ai_feedback:
tokens_for_ai: Encourage them to think more carefully about the logical structure and try again.
next_section_and_step: section_1:step_1
off_topic:
content_blocks:
- Let's stay focused on the logic puzzle. Think about what we can deduce from the two statements.
next_section_and_step: section_1:step_1
- step_id: step_2
title: The Contrapositive
content_blocks:
- '## The Contrapositive'
- Great! Now let's learn about the **contrapositive** - a powerful logical tool.
- ''
- 'If we know: ''If A, then B'' is true'
- 'Then we also know: ''If NOT B, then NOT A'' is true'
- ''
- '**Example:**'
- '- Original: ''If it''s raining, then the ground is wet'''
- '- Contrapositive: ''If the ground is NOT wet, then it''s NOT raining'''
- ''
- Both statements are logically equivalent!
- ''
- '**Practice:** We know: ''If you study hard, you will pass the test.'''
question: What is the contrapositive of this statement?
tokens_for_ai: 'The correct contrapositive is: "If you don''t pass the test, then you didn''t study hard"
or any equivalent phrasing.
Categorize as:
- correct: Correctly identifies the contrapositive (not passing → didn''t study)
- partial_understanding: Gets the concept but reverses incorrectly or incomplete
- logical_error: Confuses with converse or inverse
- limited_effort: Very brief or doesn''t attempt to construct the statement
- off_topic: Unrelated
'
feedback_tokens_for_ai: 'If correct, praise their understanding. If incorrect, explain that the contrapositive
negates both parts AND reverses them. Common error: converse (if B then A) is NOT
logically equivalent to the original.
'
buckets:
- correct
- partial_understanding
- logical_error
- limited_effort
- off_topic
transitions:
correct:
ai_feedback:
tokens_for_ai: Excellent work! You've grasped an important logical concept. Explain why contrapositives are useful in reasoning.
metadata_add:
score: n+1
puzzles_solved: n+1
next_section_and_step: section_2:step_1
partial_understanding:
ai_feedback:
tokens_for_ai: You're on the right track. Explain the contrapositive clearly and encourage them.
metadata_add:
score: n+1
next_section_and_step: section_2:step_1
logical_error:
ai_feedback:
tokens_for_ai: Explain the difference between contrapositive, converse, and inverse. Give them another example.
next_section_and_step: section_1:step_2
limited_effort:
content_blocks:
- 'Take your time. Remember: negate both parts AND reverse the order.'
next_section_and_step: section_1:step_2
off_topic:
content_blocks:
- Let's focus on constructing the contrapositive statement.
next_section_and_step: section_1:step_2
- section_id: section_2
title: Syllogisms and Deduction
steps:
- step_id: step_1
title: Classic Syllogism Puzzle
content_blocks:
- '## Classic Syllogism Puzzle'
- A **syllogism** is a form of logical argument with two premises and a conclusion.
- ''
- '**Here''s your puzzle:**'
- ''
- '**Premise 1:** All philosophers love wisdom.'
- '**Premise 2:** Socrates is a philosopher.'
- '**Premise 3:** No one who loves wisdom is foolish.'
- ''
- What can we logically conclude about Socrates?
question: What must be true about Socrates based on these premises?
tokens_for_ai: 'The correct conclusion is that Socrates is not foolish (or Socrates loves wisdom, which also leads to not being foolish).
Categorize as:
- correct: States Socrates is not foolish, or loves wisdom, or both
- partial_understanding: Gets one conclusion but not the full chain of reasoning
- limited_effort: Too brief or unclear
- off_topic: Unrelated or makes up facts not in premises
'
feedback_tokens_for_ai: 'Guide them through the logical chain if needed:
1. Socrates is a philosopher
2. All philosophers love wisdom → Socrates loves wisdom
3. No one who loves wisdom is foolish → Socrates is not foolish
'
buckets:
- correct
- partial_understanding
- limited_effort
- off_topic
transitions:
correct:
ai_feedback:
tokens_for_ai: Excellent deductive reasoning! You followed the logical chain perfectly.
metadata_add:
score: n+1
puzzles_solved: n+1
next_section_and_step: section_2:step_2
partial_understanding:
ai_feedback:
tokens_for_ai: Good start! Can you extend your reasoning further using all three premises?
next_section_and_step: section_2:step_1
limited_effort:
content_blocks:
- Try working through each premise step by step. What do we know about philosophers? What do we know about Socrates?
next_section_and_step: section_2:step_1
off_topic:
content_blocks:
- Focus only on what the premises tell us. What can we deduce step by step?
next_section_and_step: section_2:step_1
- step_id: step_2
title: Truth Tables and Logical Consistency
content_blocks:
- '## Truth Tables and Logical Consistency'
- Sometimes we need to check if statements are consistent with each other.
- ''
- '**The Scenario:**'
- 'Three friends make the following statements:'
- ''
- '**Alice:** ''If Bob is telling the truth, then Carol is lying.'''
- '**Bob:** ''I am telling the truth.'''
- '**Carol:** ''Alice is telling the truth.'''
- ''
- Let's assume Bob IS telling the truth (as he claims).
question: If Bob is telling the truth, is there a logical contradiction? If so, where?
tokens_for_ai: 'Let''s work through this:
- If Bob is telling the truth (as assumed)
- Then by Alice''s statement, Carol must be lying
- But Carol says "Alice is telling the truth"
- If Carol is lying (as we deduced), then Alice must be lying
- But this contradicts our assumption that Alice''s statement about Bob/Carol is valid
Student should identify that there IS a contradiction, or that Carol must be lying.
Categorize as:
- correct: Identifies the contradiction or that Carol must be lying
- partial_understanding: Sees some inconsistency but doesn''t fully explain it
- confused: Gets lost in the logic
- limited_effort: Very brief answer
- asking_clarifying_questions: Requests help or clarification
- off_topic: Unrelated
'
feedback_tokens_for_ai: 'If they''re struggling, walk through it step by step. This is a harder puzzle, so be
encouraging. The key insight is following the chain of implications.
'
buckets:
- correct
- partial_understanding
- confused
- limited_effort
- asking_clarifying_questions
- off_topic
transitions:
correct:
ai_feedback:
tokens_for_ai: Brilliant! You navigated a complex logical scenario. Explain the full chain of reasoning.
metadata_add:
score: n+2
puzzles_solved: n+1
next_section_and_step: section_3:step_1
partial_understanding:
ai_feedback:
tokens_for_ai: You're getting there! Let's trace through what each statement implies step by step.
metadata_add:
hints_used: n+1
next_section_and_step: section_2:step_2
confused:
content_blocks:
- 'Let''s break it down:'
- 1. Assume Bob tells the truth
- 2. What does Alice's statement tell us about Carol?
- 3. What does Carol's statement tell us about Alice?
- 4. Do these work together?
metadata_add:
hints_used: n+1
next_section_and_step: section_2:step_2
limited_effort:
content_blocks:
- Take your time and work through each person's statement carefully.
next_section_and_step: section_2:step_2
asking_clarifying_questions:
ai_feedback:
tokens_for_ai: Answer their question and provide helpful hints about how to approach the problem.
counts_as_attempt: false
next_section_and_step: section_2:step_2
off_topic:
content_blocks:
- Let's focus on analyzing the logical consistency of the three statements.
next_section_and_step: section_2:step_2
- section_id: section_3
title: Knights and Knaves
steps:
- step_id: step_1
title: The Island of Knights and Knaves
content_blocks:
- '## The Island of Knights and Knaves'
- This is a classic logic puzzle type!
- ''
- '**The Rules:**'
- '- Knights ALWAYS tell the truth'
- '- Knaves ALWAYS lie'
- '- Everyone is either a knight or a knave'
- ''
- '**The Puzzle:**'
- You meet two people, A and B.
- ''
- '**Person A says:** ''At least one of us is a knave.'''
- ''
- What are A and B?
question: Is A a knight or a knave? Is B a knight or a knave? Explain your reasoning.
tokens_for_ai: "Solution:\n- If A is a knave (liar), then the statement \"at least one of us is a knave\" would be false,\n meaning both are knights. But A can't be both a knight and a knave - contradiction!\n- Therefore A must be a knight (truth-teller)\n- Since A tells the truth, \"at least one of us is a knave\" is true\n- Since A is a knight, B must be the knave\n\nAnswer: A is a knight, B is a knave\n\nCategorize as:\n- correct: Identifies A as knight and B as knave with reasonable explanation\n- partial_understanding: Gets one correct but not both, or right answer without clear reasoning\n- logical_error: Makes an error in the logical deduction\n- limited_effort: Too brief or gives up\n- asking_clarifying_questions: Asks for help\n- off_topic: Unrelated\n"
feedback_tokens_for_ai: 'This is a challenging puzzle! If they get stuck, suggest trying both possibilities:
"What if A is a knight? What if A is a knave?" and see which leads to a contradiction.
'
buckets:
- correct
- partial_understanding
- logical_error
- limited_effort
- asking_clarifying_questions
- off_topic
transitions:
correct:
ai_feedback:
tokens_for_ai: Outstanding! You've mastered proof by contradiction. This is advanced logical reasoning!
metadata_add:
score: n+3
puzzles_solved: n+1
next_section_and_step: section_3:step_2
partial_understanding:
ai_feedback:
tokens_for_ai: You're thinking in the right direction. Try assuming A is a knave and see if that leads to a contradiction.
metadata_add:
hints_used: n+1
next_section_and_step: section_3:step_1
logical_error:
ai_feedback:
tokens_for_ai: 'Let''s think through this carefully. Test both possibilities: what if A is a knight? What if A is a knave?'
metadata_add:
hints_used: n+1
next_section_and_step: section_3:step_1
limited_effort:
content_blocks:
- 'This is challenging! Try starting with: ''Assume A is a knight. Then what must be true?'''
metadata_add:
hints_used: n+1
next_section_and_step: section_3:step_1
asking_clarifying_questions:
ai_feedback:
tokens_for_ai: Answer their question helpfully and provide a hint about testing both possibilities.
counts_as_attempt: false
next_section_and_step: section_3:step_1
off_topic:
content_blocks:
- 'Let''s work through the knight and knave puzzle. Remember: knights always tell the truth, knaves always lie.'
next_section_and_step: section_3:step_1
- step_id: step_2
title: Advanced Knights and Knaves
content_blocks:
- '## Advanced Knights and Knaves'
- Ready for a harder one? Let's add a third person!
- ''
- 'You meet three people: X, Y, and Z.'
- ''
- '**X says:** ''All of us are knaves.'''
- '**Y says:** ''Exactly one of us is a knight.'''
- ''
- What can you determine about X, Y, and Z?
question: Identify whether X, Y, and Z are knights or knaves. Explain your reasoning.
tokens_for_ai: 'Solution:
- X says "all of us are knaves"
- If X were a knight (truth-teller), then "all are knaves" would be true, but X is a knight - contradiction!
- Therefore X must be a knave (liar)
- Since X is a knave, the statement "all of us are knaves" is false, so at least one is a knight
- Y says "exactly one of us is a knight"
- If Y is a knave, then "exactly one is a knight" is false, but we know at least one is a knight (not Y, not X)... so Z would be a knight
- If Y is a knight, then "exactly one is a knight" is true, and Y is that knight, so Z must be a knave
- Actually, if Y were a knave and Z were a knight, then we''d have exactly one knight (Z), making Y''s statement true - but knaves can''t tell the truth! Contradiction.
- Therefore Y must be a knight and Z must be a knave
Answer: X is a knave, Y is a knight, Z is a knave
Categorize as:
- correct: Correctly identifies all three with solid reasoning
- partial_understanding: Gets some right or reasoning is incomplete
- confused: Logic errors or contradictions in their answer
- limited_effort: Very brief or gives up
- asking_clarifying_questions: Asks for help
- off_topic: Unrelated
'
feedback_tokens_for_ai: 'This is quite challenging! Encourage their effort. If struggling, suggest working through
X first (easier), then systematically testing Y as knight vs knave.
'
buckets:
- correct
- partial_understanding
- confused
- limited_effort
- asking_clarifying_questions
- off_topic
transitions:
correct:
ai_feedback:
tokens_for_ai: Exceptional work! You've demonstrated mastery of complex logical deduction. This is university-level reasoning!
metadata_add:
score: n+5
puzzles_solved: n+1
next_section_and_step: section_4:step_1
partial_understanding:
ai_feedback:
tokens_for_ai: Good progress! Let's work through this systematically. Start with X - can X be a knight?
metadata_add:
hints_used: n+1
next_section_and_step: section_3:step_2
confused:
ai_feedback:
tokens_for_ai: Let's break this down step by step. First, what can we determine about X from their statement?
metadata_add:
hints_used: n+1
next_section_and_step: section_3:step_2
limited_effort:
content_blocks:
- This is a tough puzzle! Start by analyzing X's statement. Can someone truthfully say 'we are all liars'?
metadata_add:
hints_used: n+1
next_section_and_step: section_3:step_2
asking_clarifying_questions:
ai_feedback:
tokens_for_ai: Answer their question and provide systematic guidance on how to approach the puzzle.
counts_as_attempt: false
next_section_and_step: section_3:step_2
off_topic:
content_blocks:
- Let's focus on solving this three-person knight and knave puzzle.
next_section_and_step: section_3:step_2
- section_id: section_4
title: Reflection and Summary
steps:
- step_id: step_1
title: Congratulations!
content_blocks:
- '## Congratulations! 🎉'
- You've completed the Logic Puzzles activity!
- ''
- '**What you''ve learned:**'
- ✓ Basic deductive reasoning (if A then B)
- ✓ Contrapositives and logical equivalence
- ✓ Syllogisms and multi-step deduction
- ✓ Truth tables and consistency checking
- ✓ Proof by contradiction (Knights and Knaves)
- ''
- '**Why logical thinking matters:**'
- '- Programming and debugging require logical reasoning'
- '- Critical thinking helps evaluate arguments and claims'
- '- Problem-solving in math, science, and everyday life'
- '- Avoiding logical fallacies in discussions'
- ''
- '**Your journey:**'
- You've progressed from basic deductions to complex multi-person logic puzzles.
- These skills will serve you well in many areas of thinking and learning!
question: What was the most challenging puzzle for you, and what did you learn from it?
tokens_for_ai: 'This is a reflection question. Accept any thoughtful response about their learning experience.
Categorize as:
- thoughtful_reflection: Provides specific insights about their learning
- brief_reflection: Short but genuine reflection
- limited_effort: Very minimal response
- off_topic: Unrelated
'
feedback_tokens_for_ai: 'Provide personalized feedback on their journey through the activity. Acknowledge their
specific challenges and growth. Encourage continued practice with logical reasoning.
'
buckets:
- thoughtful_reflection
- brief_reflection
- limited_effort
- off_topic
transitions:
thoughtful_reflection:
ai_feedback:
tokens_for_ai: Provide thoughtful, personalized feedback on their learning journey and suggest how to continue developing logical thinking skills.
metadata_add:
activity_completed: 'true'
brief_reflection:
ai_feedback:
tokens_for_ai: Acknowledge their reflection and encourage them to keep practicing logical reasoning.
metadata_add:
activity_completed: 'true'
limited_effort:
ai_feedback:
tokens_for_ai: Thank them for participating and summarize key takeaways from the activity.
metadata_add:
activity_completed: 'true'
off_topic:
content_blocks:
- Let's reflect on your logic puzzle journey. Which puzzle challenged you most?
next_section_and_step: section_4:step_1