Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • CreatiCode
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

CreatiCode Scratch Forum

  1. CreatiCode Forum
  2. Knowledge Base
  3. Tools
  4. CreatiCode XO (AI Assistant) - Debugging

CreatiCode XO (AI Assistant) - Debugging

Scheduled Pinned Locked Moved Tools
1 Posts 1 Posters 1.2k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • CreatiCodeI Offline
    CreatiCodeI Offline
    CreatiCode
    wrote on last edited by admin
    #1

    Introduction

     
    One area where almost every student struggles is debugging, and teachers often do not have time to help every student with it.

    XO can fill the gap by assisting each student to diagnose their program and brainstorm how to fix it.

    To understand how XO can help in the debugging process, please read “how to debug” to understand debugging in general. Otherwise, you may not use XO most productively to help you debug.

    Important Note: Do not rely solely on XO to fix all issues in your code. The most effective debugging methods often require running the program and observing the outcome. However, XO can not execute your code, so it has to work with you to understand where the problem is. Additionally, the current version of XO has limited capabilities in logical reasoning and error detection. Consequently, the primary responsibility for identifying issues rests with you, and XO should serve merely as a supporting tool.

     
     

    Explain “Expected vs Actual” to XO

     

    As you may already know, debugging is all about finding out why the actual outcome of the program is different from our expectations.

    A common mistake when using XO for debugging is failing to explain this difference. Beginners tend to say these to XO: “It is not working”, “What’s wrong”, “Check my code”, or “Help me debug”. These requests are not helpful since XO doesn’t know what outcome you are expecting..

    Also, XO can only read your code (as opposed to running it), so it does not know what you actually observe when the program runs. When it is not clear what’s the issue, XO will ask for clarification:

    50c778e5-5512-4f9c-8ba5-c653a524a955-image.png

     

    It is recommended that you always include these 2 parts when starting a debug request:

    • What I expect the program to do
    • What I observe when the program runs

    Here are some good examples:

    • I expect the Dog to say 1 to 10, but it only says 1 to 8
    • I am trying to move the clone to a random position, but I see that it always appears in the same position
    • I thought the list would contain 10 numbers, but when I ran it, I only got 1 number

    Sometimes, XO can infer the expected outcome based on your description, so you may omit that part. For example:

    • The chatbot never responds to my question -> implying we expect the chatbot to respond in a short time
    • The sprite doesn’t move, why? -> implying we expect it to move
    • The 3D table’s top is not connected with its legs -> implying we expect the table top to connect with the legs.

     
     

    XO can find common bugs

     

    For small and common coding mistakes, XO can spot them right away. For example, here is a simple program with a variable initialization bug. The “set counter to 1” block should not be inside the loop. XO not only points out the issue, but also suggests how to fix it.

    b89dea2d-abbb-42e8-ab89-d633171fdda5-image.png

     
     

    Issues in New Block Usage

     

    The CreatiCode playground offers many new blocks compared to MIT Scratch, and XO understands all of them, so it can point out issues associated with their usage. For example, here is a common issue in 3D programs about loading a 3D model:

    79e25caa-0fe7-4c37-a998-d66872342160-image.png

     
     

    Narrow Down the Problem’s Scope with XO’s help

     

    For more complex issues in larger projects, it is likely that XO may not see the issue either. In these situations, you need to identify where the issue is, and XO can help you in this search.

    If you’re not sure which parts of your code to look at first, explain the problem clearly to XO, and XO can suggest the best place to start looking.

    As a practice, we will make a buggy program intentionally, then practice finding it. First, please open the following project and remix it:

    play.creaticode.com/projects/6616a1a7564fc287b0e9b879

     

    Next, modify this block towards the bottom to set the y speed to -450 instead of 450, which will be the bug we try to find.

    4693e956-7925-4ade-b56c-69c15358ceb8-image.png

     
    Then you can ask XO to help locate the issue like this: The cube is not jumping up. Where should I look into?

    XO will suggest a few relevant places:

    93a7c6dc-96e8-418f-967c-7459a7f2c8f4-image.png

     
    You can then ask follow-up questions about any of these suggestions.

     
     

    Ask XO how to add logging

     

    Logging is another commonly used debugging technique. If you are not sure where to add the print blocks or what to print, you can also ask XO to help you.

    For example, suppose we have a simple program with a small bug like this:
     
    c2be2eed-3de8-443c-a281-026b4becaa7b-image.png

     
    We can tell XO this: I want to add print blocks to help me debug

    As a result, XO will suggest where and how to add the new print block:

    aa9b2c0f-28dc-4e06-8ada-37de8f2c9212-image.png

     
     

    Debugging in the Socratic Mode

     

    When XO is not in the Socratic mode, it will try its best to tell you what and where the bug is if it can find it. When it does not know the answer, it will suggest what you can do to search for the bug.

    This is very helpful when you are stuck on a problem for a long time and there is no one to help you. However, your brain is not getting trained to identify or search for the bug yourself, so you don’t learn this skill when you rely on XO all the time.

    When XO is put in the Socratic mode, it will refrain from telling you the bug directly, even if it already knows about it. Instead, you will be in charge of searching for the bug and fixing it, and XO will serve as an assistant in this process.

    Therefore, it is strongly recommended that you learn to debug issues in the following way:

    1. Start debugging the issue yourself, without XO’s help
    2. If you are stuck, ask XO to help in the Socratic mode
    3. If you still can not find the answer, ask XO to help in the non-Socratic mode.
    1 Reply Last reply
    0
    • CreatiCodeI CreatiCode pinned this topic on

    Hello! It looks like you're interested in this conversation, but you don't have an account yet.

    Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

    With your input, this post could be even better 💗

    Register Login
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • CreatiCode