{
  "format": "tokbit",
  "version": 1,
  "name": "Kreslení šipkami",
  "main": [
    {
      "id": "u1",
      "kind": "call",
      "call": "cls()"
    },
    {
      "id": "u2",
      "kind": "call",
      "call": "color(WHITE)"
    },
    {
      "id": "u3",
      "kind": "call",
      "call": "at(0, 0)"
    },
    {
      "id": "u4",
      "kind": "output",
      "values": "\"Šipky hýbou hvězdičkou, mezerník konec.\"",
      "newline": false
    },
    {
      "id": "u5",
      "kind": "call",
      "call": "color(YELLOW)"
    },
    {
      "id": "u6",
      "kind": "declare",
      "name": "x",
      "type": "int",
      "init": "20"
    },
    {
      "id": "u7",
      "kind": "declare",
      "name": "y",
      "type": "int",
      "init": "12"
    },
    {
      "id": "u8",
      "kind": "declare",
      "name": "k",
      "type": "str",
      "init": "\"\""
    },
    {
      "id": "u9",
      "kind": "while",
      "condition": "k != \" \"",
      "body": [
        {
          "id": "u10",
          "kind": "call",
          "call": "at(x, y)"
        },
        {
          "id": "u11",
          "kind": "output",
          "values": "\"*\"",
          "newline": false
        },
        {
          "id": "u12",
          "kind": "call",
          "call": "sleep(50)"
        },
        {
          "id": "u13",
          "kind": "assign",
          "target": "k",
          "value": "key()",
          "comment": "key() nečeká: vrátí stisknutou klávesu, nebo prázdný text."
        },
        {
          "id": "u14",
          "kind": "if",
          "condition": "k == \"left\" and x > 0",
          "then": [
            {
              "id": "u15",
              "kind": "assign",
              "target": "x",
              "value": "x - 1"
            }
          ],
          "else": []
        },
        {
          "id": "u16",
          "kind": "if",
          "condition": "k == \"right\" and x < 39",
          "then": [
            {
              "id": "u17",
              "kind": "assign",
              "target": "x",
              "value": "x + 1"
            }
          ],
          "else": []
        },
        {
          "id": "u18",
          "kind": "if",
          "condition": "k == \"up\" and y > 2",
          "then": [
            {
              "id": "u19",
              "kind": "assign",
              "target": "y",
              "value": "y - 1"
            }
          ],
          "else": []
        },
        {
          "id": "u20",
          "kind": "if",
          "condition": "k == \"down\" and y < 24",
          "then": [
            {
              "id": "u21",
              "kind": "assign",
              "target": "y",
              "value": "y + 1"
            }
          ],
          "else": []
        }
      ]
    },
    {
      "id": "u22",
      "kind": "call",
      "call": "color(WHITE)"
    },
    {
      "id": "u23",
      "kind": "call",
      "call": "at(0, 1)"
    }
  ],
  "functions": [],
  "comment": "Řešení úlohy „Kreslení stopou“: Ať hvězdička za sebou nechává stopu, takže se šipkami dá kreslit. Co stačí z programu odebrat?"
}
