{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "97d81c46",
   "metadata": {},
   "source": [
    "# 10-08 · Спирали из дуг\n",
    "\n",
    "Практика к разделу [«Мини-проект — спирали из дуг»](../../site/chapters/glava-10/10-08-spirali-itogi.html)."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "fcd398e8",
   "metadata": {},
   "source": [
    "## Цель\n",
    "\n",
    "Нарисовать спираль с растущим радиусом."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f64e80ff",
   "metadata": {},
   "source": [
    "## Настройка (выполнить один раз)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "8220cc07",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-14T20:54:48.573069Z",
     "iopub.status.busy": "2026-08-14T20:54:48.572938Z",
     "iopub.status.idle": "2026-08-14T20:54:48.741164Z",
     "shell.execute_reply": "2026-08-14T20:54:48.740694Z"
    }
   },
   "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": "2505bafb",
   "metadata": {},
   "source": [
    "## Рабочий пример"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "2a2dd234",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-14T20:54:48.742362Z",
     "iopub.status.busy": "2026-08-14T20:54:48.742234Z",
     "iopub.status.idle": "2026-08-14T20:55:14.868313Z",
     "shell.execute_reply": "2026-08-14T20:55:14.867793Z"
    }
   },
   "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": "304c68ef",
   "metadata": {},
   "source": [
    "## Задание ★★ Самостоятельная задача\n",
    "\n",
    "Нарисуйте спираль из квадратов, увеличивающихся на каждом шаге."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "7c8e0683",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-14T20:55:14.869265Z",
     "iopub.status.busy": "2026-08-14T20:55:14.869158Z",
     "iopub.status.idle": "2026-08-14T20:55:36.512009Z",
     "shell.execute_reply": "2026-08-14T20:55:36.511404Z"
    }
   },
   "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": "04fc8563",
   "metadata": {},
   "source": [
    "## Завершение (выполнить один раз, в самом конце)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "5d519882",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-14T20:55:36.513354Z",
     "iopub.status.busy": "2026-08-14T20:55:36.513216Z",
     "iopub.status.idle": "2026-08-14T20:55:36.518040Z",
     "shell.execute_reply": "2026-08-14T20:55:36.517426Z"
    }
   },
   "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
}
