{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "ff584e9a",
   "metadata": {},
   "source": [
    "# 07-04 · Дуги\n",
    "\n",
    "Практика к разделу [«Дуги»](../../site/chapters/glava-07/07-04-dugi.html)."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "fa6c7f62",
   "metadata": {},
   "source": [
    "## Цель\n",
    "\n",
    "Нарисовать дуги разного размера с помощью параметра extent."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "555ef5e7",
   "metadata": {},
   "source": [
    "## Настройка (выполнить один раз)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "e39b3e6f",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-14T20:53:25.541496Z",
     "iopub.status.busy": "2026-08-14T20:53:25.541350Z",
     "iopub.status.idle": "2026-08-14T20:53:25.710858Z",
     "shell.execute_reply": "2026-08-14T20:53:25.710382Z"
    }
   },
   "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": "372d74a4",
   "metadata": {},
   "source": [
    "## Рабочий пример"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "4065abad",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-14T20:53:25.712117Z",
     "iopub.status.busy": "2026-08-14T20:53:25.711992Z",
     "iopub.status.idle": "2026-08-14T20:53:26.452123Z",
     "shell.execute_reply": "2026-08-14T20:53:26.451747Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Позиция после полукруга: (0.00,160.00)\n"
     ]
    }
   ],
   "source": [
    "artist.reset()\n",
    "artist.circle(80, 180)\n",
    "print(\"Позиция после полукруга:\", artist.position())"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "9b3d857a",
   "metadata": {},
   "source": [
    "## Эксперимент 1\n",
    "\n",
    "Попробуйте extent = 90, 270 и 360 (полная окружность) на том же радиусе."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "895eb9e0",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-14T20:53:26.453398Z",
     "iopub.status.busy": "2026-08-14T20:53:26.453241Z",
     "iopub.status.idle": "2026-08-14T20:53:29.299224Z",
     "shell.execute_reply": "2026-08-14T20:53:29.298737Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "extent=90: финальная позиция (80.00,80.00)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "extent=270: финальная позиция (-80.00,80.00)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "extent=360: финальная позиция (0.00,0.00)\n"
     ]
    }
   ],
   "source": [
    "for extent in [90, 270, 360]:\n",
    "    artist.reset()\n",
    "    artist.circle(80, extent)\n",
    "    print(f\"extent={extent}: финальная позиция {artist.position()}\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "6df0dd05",
   "metadata": {},
   "source": [
    "## Задание ★ Базовая практика\n",
    "\n",
    "Нарисуйте купол домика: дугу 180° радиусом 60, затем прямую вниз с обеих сторон."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "a779ad30",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-14T20:53:29.300273Z",
     "iopub.status.busy": "2026-08-14T20:53:29.300158Z",
     "iopub.status.idle": "2026-08-14T20:53:30.125459Z",
     "shell.execute_reply": "2026-08-14T20:53:30.124948Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Купол с одной стеной готов.\n"
     ]
    }
   ],
   "source": [
    "artist.reset()\n",
    "artist.circle(60, 180)\n",
    "artist.left(90)\n",
    "artist.forward(60)\n",
    "print(\"Купол с одной стеной готов.\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a582d1a3",
   "metadata": {},
   "source": [
    "## Завершение (выполнить один раз, в самом конце)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "a203b7fe",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-14T20:53:30.126450Z",
     "iopub.status.busy": "2026-08-14T20:53:30.126332Z",
     "iopub.status.idle": "2026-08-14T20:53:30.129938Z",
     "shell.execute_reply": "2026-08-14T20:53:30.129412Z"
    }
   },
   "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
}
