{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "6de3ec53",
   "metadata": {},
   "source": [
    "# 07-22 · Координатная мишень\n",
    "\n",
    "Практика к разделу [«Мини-проект: координатная мишень»](../../site/chapters/glava-07/07-22-mini-proekt-mishen.html)."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "6bfbeff6",
   "metadata": {},
   "source": [
    "## Цель\n",
    "\n",
    "Собрать инфографику из колец, осей, случайных точек и подписи."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "54aea4ee",
   "metadata": {},
   "source": [
    "## Настройка (выполнить один раз)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "5559c6a1",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T15:17:04.362297Z",
     "iopub.status.busy": "2026-08-16T15:17:04.362188Z",
     "iopub.status.idle": "2026-08-16T15:17:04.534693Z",
     "shell.execute_reply": "2026-08-16T15:17:04.534151Z"
    }
   },
   "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": "8ec552dc",
   "metadata": {},
   "source": [
    "## Рабочий пример\n",
    "\n",
    "Два концентрических кольца."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "b85dfa3a",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T15:17:04.535650Z",
     "iopub.status.busy": "2026-08-16T15:17:04.535537Z",
     "iopub.status.idle": "2026-08-16T15:17:07.510869Z",
     "shell.execute_reply": "2026-08-16T15:17:07.510357Z"
    }
   },
   "outputs": [],
   "source": [
    "import random\n",
    "artist.reset()\n",
    "random.seed(1)\n",
    "for radius, color in [(100, \"#DC2626\"), (60, \"#FAFAFC\")]:\n",
    "    artist.penup()\n",
    "    artist.goto(0, -radius)\n",
    "    artist.pendown()\n",
    "    artist.fillcolor(color)\n",
    "    artist.begin_fill()\n",
    "    artist.circle(radius)\n",
    "    artist.end_fill()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "840efc04",
   "metadata": {},
   "source": [
    "## Задание ★★ Самостоятельная практика\n",
    "\n",
    "Добавьте третье, самое маленькое кольцо (радиус 25, цвет \"#DC2626\") и 4 случайные точки внутри мишени (random.seed(2))."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "2955f1be",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T15:17:07.511978Z",
     "iopub.status.busy": "2026-08-16T15:17:07.511857Z",
     "iopub.status.idle": "2026-08-16T15:17:08.858768Z",
     "shell.execute_reply": "2026-08-16T15:17:08.858226Z"
    }
   },
   "outputs": [],
   "source": [
    "artist.penup()\n",
    "artist.goto(0, -25)\n",
    "artist.pendown()\n",
    "artist.fillcolor(\"#DC2626\")\n",
    "artist.begin_fill()\n",
    "artist.circle(25)\n",
    "artist.end_fill()\n",
    "\n",
    "random.seed(2)\n",
    "artist.penup()\n",
    "for _ in range(4):\n",
    "    x = random.randint(-90, 90)\n",
    "    y = random.randint(-90, 90)\n",
    "    artist.goto(x, y)\n",
    "    artist.dot(10, \"#059669\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a1407949",
   "metadata": {},
   "source": [
    "## Завершение (выполнить один раз, в самом конце)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "0a323995",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T15:17:08.859938Z",
     "iopub.status.busy": "2026-08-16T15:17:08.859835Z",
     "iopub.status.idle": "2026-08-16T15:17:08.862873Z",
     "shell.execute_reply": "2026-08-16T15:17:08.862427Z"
    }
   },
   "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
}
