{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "06583c9e",
   "metadata": {},
   "source": [
    "# 10-08 · Спирали из дуг\n",
    "\n",
    "Практика к разделу [«Мини-проект — спирали из дуг»](../../site/chapters/glava-10/10-08-spirali-itogi.html)."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "9dc264bc",
   "metadata": {},
   "source": [
    "## Цель\n",
    "\n",
    "Нарисовать спираль с растущим радиусом."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1112952a",
   "metadata": {},
   "source": [
    "## Настройка (выполнить один раз)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "a5a31d92",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T20:14:37.993576Z",
     "iopub.status.busy": "2026-08-16T20:14:37.993438Z",
     "iopub.status.idle": "2026-08-16T20:14:38.181981Z",
     "shell.execute_reply": "2026-08-16T20:14:38.181257Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Окно Turtle готово.\n"
     ]
    }
   ],
   "source": [
    "import turtle\n",
    "\n",
    "screen = turtle.Screen()\n",
    "artist = turtle.Turtle()\n",
    "artist.speed(0)\n",
    "print(\"Окно Turtle готово.\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d83787b0",
   "metadata": {},
   "source": [
    "## Рабочий пример"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "d3973489",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T20:14:38.183339Z",
     "iopub.status.busy": "2026-08-16T20:14:38.183158Z",
     "iopub.status.idle": "2026-08-16T20:15:04.545382Z",
     "shell.execute_reply": "2026-08-16T20:15:04.544851Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Спираль готова, финальный радиус: 185\n"
     ]
    }
   ],
   "source": [
    "artist.reset()\n",
    "radius = 5\n",
    "\n",
    "for _ in range(60):\n",
    "    artist.circle(radius, 90)\n",
    "    radius += 3\n",
    "\n",
    "print(\"Спираль готова, финальный радиус:\", radius)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "cbb3d374",
   "metadata": {},
   "source": [
    "## Задание ★★ Самостоятельная задача\n",
    "\n",
    "Нарисуйте спираль из квадратов, увеличивающихся на каждом шаге."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "1cadff58",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T20:15:04.546458Z",
     "iopub.status.busy": "2026-08-16T20:15:04.546351Z",
     "iopub.status.idle": "2026-08-16T20:15:26.365906Z",
     "shell.execute_reply": "2026-08-16T20:15:26.365522Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Спираль из квадратов готова.\n"
     ]
    }
   ],
   "source": [
    "artist.reset()\n",
    "storona = 5\n",
    "\n",
    "for _ in range(30):\n",
    "    for _ in range(4):\n",
    "        artist.forward(storona)\n",
    "        artist.right(90)\n",
    "    artist.right(15)   # немного поворачиваем всю фигуру для эффекта спирали\n",
    "    storona += 3\n",
    "\n",
    "print(\"Спираль из квадратов готова.\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "22cf9241",
   "metadata": {},
   "source": [
    "## Завершение (выполнить один раз, в самом конце)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "5894f8d6",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T20:15:26.367052Z",
     "iopub.status.busy": "2026-08-16T20:15:26.366942Z",
     "iopub.status.idle": "2026-08-16T20:15:26.370220Z",
     "shell.execute_reply": "2026-08-16T20:15:26.369767Z"
    }
   },
   "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
}
