Skip to content

Validating nested loops #334

@alecmolloy

Description

@alecmolloy

An issue as old as time, but still is wreaking havoc on some cool challenges i've been trying to do.

This validates totally fine:

{
    "id": "pattern",
    "title": "Pattern",
    "description": "Learn about color interactions and how shapes can affect our perception of color",
    "code": "",
    "startAt": 2,
    "steps": [
        {
            "hint": "",
            "solution": "for r in [0 .. 350] by 50"
        },
        {
            "hint": "",
            "solution": "    offset = random 0, 1, true"
        },
        {
            "hint": "",
            "solution": "    for i in [0 ... 2] by .1"
        },
        {
            "hint": "",
            "solution": "        arc r, i, i - .05",
        }
    ],
    "completion_text": "",
    "cover": "ozwaldboateng/pattern.png"
}

This does not:

{
    "id": "pattern",
    "title": "Pattern",
    "description": "Learn about color interactions and how shapes can affect our perception of color",
    "code": "",
    "startAt": 2,
    "steps": [
        {
            "hint": "",
            "solution": "for r in [0 .. 350] by 50"
        },
        {
            "hint": "",
            "solution": "    offset = random 0, 1, true"
        },
        {
            "hint": "",
            "solution": "    for i in [0 ... 2] by .1"
        },
        {
            "hint": "",
            "solution": "        arc r, i + offset, i - .05 + offset"
        }
    ],
    "completion_text": "",
    "cover": "ozwaldboateng/pattern.png"
}

The only difference between the two above JSON files is the inclusion of extra binary operators in the second example (adding an offset). Doing so in a nested loop reliably breaks validation for no clear reason.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions