Langkau ke kandungan

    Bug Garden

    Debugging Umur 7–9

    Trace long robot programs on bigger grids and find the one step that sends the robot the wrong way.

    • Umur 7–9
    • 3 misi
    • Permulaan → Semakin mahir → Cabaran

    Every programmer writes bugs — the skill is finding them. Year 3 coders debug longer robot programs on bigger grids, tracing each step to find the one arrow that sends the robot the wrong way.

    Apa yang akan dipelajari anak anda

    • Trace a long program step by step
    • Find the one step that stops a program working
    • Say what the step should be instead

    Trace, don’t guess

    With six or seven steps, guessing rarely works. Put a finger on the start and follow each arrow in turn. The moment the robot goes somewhere it shouldn’t, you’ve found the bug.

    Contoh soalan

    Berikut ialah beberapa soalan seperti dalam misi pertama. Bolehkah anda menjawabnya?

    1. 1. The robot should reach the star, but one step has a bug. Which step is wrong?

      • Step 1
      • Step 2
      • Step 3
      • Step 4
      Tunjuk jawapan

      Jawapan: Step 2. Step 2 should be ↑ instead of ↓. Fix that one arrow and the robot reaches the star!

    2. 2. The robot should reach the star, but one step has a bug. Which step is wrong?

      • Step 1
      • Step 2
      • Step 3
      • Step 5
      Tunjuk jawapan

      Jawapan: Step 5. Step 5 should be → instead of ↓. Fix that one arrow and the robot reaches the star!

    3. 3. The robot should reach the star, but one step has a bug. Which step is wrong?

      • Step 1
      • Step 2
      • Step 3
      • Step 4
      Tunjuk jawapan

      Jawapan: Step 1. Step 1 should be → instead of ↑. Fix that one arrow and the robot reaches the star!

    4. 4. Match each kind of bug to its meaning.

      • logic error
      • syntax error
      • infinite loop
      • a typo in the code
      • the program never stops
      • runs but gives the wrong answer
      Tunjuk jawapan

      Jawapan: infinite loop → the program never stops · logic error → runs but gives the wrong answer · syntax error → a typo in the code. Different bugs need different fixes.

    Tip untuk orang dewasa

    • Write directions to a room in your house with one deliberate mistake, and ask your child to find it.
    • Praise careful checking more than speed.