{
  "format": "tokbit",
  "version": 1,
  "name": "Hádej číslo se 7 pokusy",
  "main": [
    {
      "id": "u1",
      "kind": "declare",
      "name": "tajne",
      "type": "int",
      "init": "randint(1, 100)"
    },
    {
      "id": "u2",
      "kind": "declare",
      "name": "tip",
      "type": "int",
      "init": "0"
    },
    {
      "id": "u3",
      "kind": "declare",
      "name": "pokusy",
      "type": "int",
      "init": "0"
    },
    {
      "id": "u4",
      "kind": "output",
      "values": "\"Myslím si číslo od 1 do 100.\""
    },
    {
      "id": "u5",
      "kind": "while",
      "condition": "tip != tajne and pokusy < 7",
      "body": [
        {
          "id": "u6",
          "kind": "input",
          "target": "tip",
          "prompt": "Tvůj tip:"
        },
        {
          "id": "u7",
          "kind": "assign",
          "target": "pokusy",
          "value": "pokusy + 1"
        },
        {
          "id": "u8",
          "kind": "if",
          "condition": "tip < tajne",
          "then": [
            {
              "id": "u9",
              "kind": "output",
              "values": "\"Víc.\""
            }
          ],
          "else": [
            {
              "id": "u10",
              "kind": "if",
              "condition": "tip > tajne",
              "then": [
                {
                  "id": "u11",
                  "kind": "output",
                  "values": "\"Míň.\""
                }
              ],
              "else": []
            }
          ]
        }
      ],
      "comment": "Opakuje se, dokud tip není správný; počet kol předem nevíme."
    },
    {
      "id": "u12",
      "kind": "if",
      "condition": "tip == tajne",
      "then": [
        {
          "id": "u13",
          "kind": "output",
          "values": "\"Uhodl jsi! Počet pokusů:\", pokusy"
        }
      ],
      "else": [
        {
          "id": "u14",
          "kind": "output",
          "values": "\"Došly ti pokusy. Myslel jsem si\", tajne"
        }
      ]
    }
  ],
  "functions": [],
  "comment": "Řešení úlohy „Jen sedm pokusů“: Hráč má jen 7 pokusů. Když neuhodne, program napíše, jaké číslo to bylo. (Úloha z Hodiny s Tokbitem.)",
  "screen": "fit"
}
