{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "81dd72ef",
   "metadata": {},
   "source": [
    "# 07-03 · Фигуры без линий, окружности, точки\n",
    "\n",
    "Практика к разделу [«Фигуры без линий, окружности, точки»](../../site/chapters/glava-07/07-03-figury-bez-linij.html) (включает материал из «Ещё больше возможностей»)."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "9b8c6705",
   "metadata": {},
   "source": [
    "## Цель\n",
    "\n",
    "Освоить заливку, circle(), dot(), stamp(), hideturtle() и undo()."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ef33865e",
   "metadata": {},
   "source": [
    "## Настройка (выполнить один раз)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "0ddb16ec",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-14T20:53:20.974814Z",
     "iopub.status.busy": "2026-08-14T20:53:20.974675Z",
     "iopub.status.idle": "2026-08-14T20:53:21.152958Z",
     "shell.execute_reply": "2026-08-14T20:53:21.152508Z"
    }
   },
   "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": "4a3ccad1",
   "metadata": {},
   "source": [
    "## Рабочий пример — заливка"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "ce7f82d1",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-14T20:53:21.154008Z",
     "iopub.status.busy": "2026-08-14T20:53:21.153886Z",
     "iopub.status.idle": "2026-08-14T20:53:22.083208Z",
     "shell.execute_reply": "2026-08-14T20:53:22.082620Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Квадрат залит золотым цветом.\n"
     ]
    }
   ],
   "source": [
    "artist.reset()\n",
    "artist.fillcolor(\"gold\")\n",
    "artist.begin_fill()\n",
    "for _ in range(4):\n",
    "    artist.forward(100)\n",
    "    artist.right(90)\n",
    "artist.end_fill()\n",
    "print(\"Квадрат залит золотым цветом.\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "460bcfa8",
   "metadata": {},
   "source": [
    "## Эксперимент 1 — окружности"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "f11bc33d",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-14T20:53:22.084303Z",
     "iopub.status.busy": "2026-08-14T20:53:22.084183Z",
     "iopub.status.idle": "2026-08-14T20:53:23.293533Z",
     "shell.execute_reply": "2026-08-14T20:53:23.293062Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Позиция после окружности: (-0.00,0.00)\n"
     ]
    }
   ],
   "source": [
    "artist.reset()\n",
    "artist.circle(60)\n",
    "print(\"Позиция после окружности:\", artist.position())"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "9c94b02c",
   "metadata": {},
   "source": [
    "## Эксперимент 2 — точки разных цветов и размеров"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "ede3b6d1",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-14T20:53:23.294548Z",
     "iopub.status.busy": "2026-08-14T20:53:23.294437Z",
     "iopub.status.idle": "2026-08-14T20:53:23.577810Z",
     "shell.execute_reply": "2026-08-14T20:53:23.577395Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Три цветные точки нарисованы.\n"
     ]
    }
   ],
   "source": [
    "artist.reset()\n",
    "artist.penup()\n",
    "for i, цвет in enumerate([\"red\", \"green\", \"blue\"]):\n",
    "    artist.goto(i * 40, 0)\n",
    "    artist.dot(20, цвет)\n",
    "print(\"Три цветные точки нарисованы.\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "7f84d854",
   "metadata": {},
   "source": [
    "## Задание ★ Базовая практика\n",
    "\n",
    "Нарисуйте залитый зелёный круг радиусом 50."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "d5e3f357",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-14T20:53:23.578962Z",
     "iopub.status.busy": "2026-08-14T20:53:23.578840Z",
     "iopub.status.idle": "2026-08-14T20:53:24.713394Z",
     "shell.execute_reply": "2026-08-14T20:53:24.712979Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Зелёный круг готов.\n"
     ]
    }
   ],
   "source": [
    "artist.reset()\n",
    "artist.fillcolor(\"green\")\n",
    "artist.begin_fill()\n",
    "artist.circle(50)\n",
    "artist.end_fill()\n",
    "print(\"Зелёный круг готов.\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "456c125f",
   "metadata": {},
   "source": [
    "## Дополнительная задача ★★★ — stamp() и undo()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "dd8848d7",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-14T20:53:24.714686Z",
     "iopub.status.busy": "2026-08-14T20:53:24.714577Z",
     "iopub.status.idle": "2026-08-14T20:53:24.801095Z",
     "shell.execute_reply": "2026-08-14T20:53:24.800613Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Готово — попробуйте разное число undo().\n"
     ]
    }
   ],
   "source": [
    "artist.reset()\n",
    "artist.shape(\"circle\")\n",
    "artist.stamp()\n",
    "artist.forward(40)\n",
    "artist.stamp()\n",
    "artist.undo()  # отменяем последний stamp/движение\n",
    "print(\"Готово — попробуйте разное число undo().\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4a02e9bf",
   "metadata": {},
   "source": [
    "## Завершение (выполнить один раз, в самом конце)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "09611c51",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-14T20:53:24.802090Z",
     "iopub.status.busy": "2026-08-14T20:53:24.801969Z",
     "iopub.status.idle": "2026-08-14T20:53:24.805380Z",
     "shell.execute_reply": "2026-08-14T20:53:24.804914Z"
    }
   },
   "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
}
