{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "894f3dd4",
   "metadata": {},
   "source": [
    "# 06-17 · Отладка Turtle\n",
    "\n",
    "Практика к разделу [«Отладка Turtle»](../../site/chapters/glava-06/06-17-otladka-turtle.html)."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3d5e4616",
   "metadata": {},
   "source": [
    "## Цель\n",
    "\n",
    "Найти и исправить типичные ошибки в коде Turtle."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "8c89be50",
   "metadata": {},
   "source": [
    "## Настройка (выполнить один раз)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "0f1af9fe",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T13:58:34.399784Z",
     "iopub.status.busy": "2026-08-16T13:58:34.399647Z",
     "iopub.status.idle": "2026-08-16T13:58:34.580599Z",
     "shell.execute_reply": "2026-08-16T13:58:34.580057Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Окно Turtle готово.\n"
     ]
    }
   ],
   "source": [
    "import turtle\n",
    "\n",
    "screen = turtle.Screen()\n",
    "artist = turtle.Turtle()\n",
    "artist.pensize(3)\n",
    "artist.pencolor(\"#5B24F9\")\n",
    "print(\"Окно Turtle готово.\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c3928c64",
   "metadata": {},
   "source": [
    "## Типичная ошибка\n",
    "\n",
    "Этот код должен был нарисовать квадрат, но забыл один поворот — получается не квадрат."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "22455116",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T13:58:34.582268Z",
     "iopub.status.busy": "2026-08-16T13:58:34.582091Z",
     "iopub.status.idle": "2026-08-16T13:58:35.152644Z",
     "shell.execute_reply": "2026-08-16T13:58:35.152138Z"
    }
   },
   "outputs": [],
   "source": [
    "artist.reset()\n",
    "artist.forward(80)\n",
    "artist.right(90)\n",
    "artist.forward(80)\n",
    "artist.right(90)\n",
    "artist.forward(80)\n",
    "# пропущен поворот здесь!\n",
    "artist.forward(80)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1b9314d6",
   "metadata": {},
   "source": [
    "## Задание ★ Базовая практика\n",
    "\n",
    "Исправьте код выше так, чтобы получился настоящий квадрат (допишите пропущенный right(90))."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "2427154c",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T13:58:35.153707Z",
     "iopub.status.busy": "2026-08-16T13:58:35.153589Z",
     "iopub.status.idle": "2026-08-16T13:58:35.848401Z",
     "shell.execute_reply": "2026-08-16T13:58:35.847746Z"
    }
   },
   "outputs": [],
   "source": [
    "artist.reset()\n",
    "artist.forward(80)\n",
    "artist.right(90)\n",
    "artist.forward(80)\n",
    "artist.right(90)\n",
    "artist.forward(80)\n",
    "artist.right(90)\n",
    "artist.forward(80)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "096525ff",
   "metadata": {},
   "source": [
    "## Завершение (выполнить один раз, в самом конце)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "e683963f",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T13:58:35.849480Z",
     "iopub.status.busy": "2026-08-16T13:58:35.849359Z",
     "iopub.status.idle": "2026-08-16T13:58:35.852324Z",
     "shell.execute_reply": "2026-08-16T13:58:35.851835Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Окно Turtle закрыто.\n"
     ]
    }
   ],
   "source": [
    "screen.bye()\n",
    "print(\"Окно Turtle закрыто.\")"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Cartesian Python 3.14",
   "language": "python",
   "name": "cartesian-python314"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.14.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
