{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "957afb74",
   "metadata": {},
   "source": [
    "# 07-09 · Мини-проект — смайлик\n",
    "\n",
    "Практика к разделу [«Мини-проект — смайлик»](../../site/chapters/glava-07/07-09-mini-proekt-smajlik-itogi.html)."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "86022586",
   "metadata": {},
   "source": [
    "## Цель\n",
    "\n",
    "Собрать все приёмы главы в одном рисунке."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e36cb3be",
   "metadata": {},
   "source": [
    "## Настройка (выполнить один раз)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "fa68ba92",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-14T20:53:40.366954Z",
     "iopub.status.busy": "2026-08-14T20:53:40.366847Z",
     "iopub.status.idle": "2026-08-14T20:53:40.542168Z",
     "shell.execute_reply": "2026-08-14T20:53:40.541538Z"
    }
   },
   "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": "6bcb3f4a",
   "metadata": {},
   "source": [
    "## Рабочий пример"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "25af7a60",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-14T20:53:40.543212Z",
     "iopub.status.busy": "2026-08-14T20:53:40.543081Z",
     "iopub.status.idle": "2026-08-14T20:53:43.045282Z",
     "shell.execute_reply": "2026-08-14T20:53:43.044863Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Смайлик готов.\n"
     ]
    }
   ],
   "source": [
    "artist.reset()\n",
    "\n",
    "artist.fillcolor(\"yellow\")\n",
    "artist.begin_fill()\n",
    "artist.circle(100)\n",
    "artist.end_fill()\n",
    "\n",
    "artist.penup()\n",
    "artist.goto(-35, 120)\n",
    "artist.pendown()\n",
    "artist.dot(20, \"black\")\n",
    "artist.penup()\n",
    "artist.goto(35, 120)\n",
    "artist.pendown()\n",
    "artist.dot(20, \"black\")\n",
    "\n",
    "artist.penup()\n",
    "artist.goto(-50, 60)\n",
    "artist.setheading(-60)\n",
    "artist.pendown()\n",
    "artist.pensize(4)\n",
    "artist.circle(60, 120)\n",
    "\n",
    "print(\"Смайлик готов.\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "616c67e2",
   "metadata": {},
   "source": [
    "## Задание ★★ Самостоятельная задача\n",
    "\n",
    "Добавьте две розовые щёчки под глазами."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "e45bab27",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-14T20:53:43.046491Z",
     "iopub.status.busy": "2026-08-14T20:53:43.046353Z",
     "iopub.status.idle": "2026-08-14T20:53:43.381489Z",
     "shell.execute_reply": "2026-08-14T20:53:43.381009Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Румяные щёчки добавлены.\n"
     ]
    }
   ],
   "source": [
    "artist.penup()\n",
    "artist.goto(-55, 90)\n",
    "artist.pendown()\n",
    "artist.dot(15, \"pink\")\n",
    "\n",
    "artist.penup()\n",
    "artist.goto(55, 90)\n",
    "artist.pendown()\n",
    "artist.dot(15, \"pink\")\n",
    "\n",
    "print(\"Румяные щёчки добавлены.\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1ca34810",
   "metadata": {},
   "source": [
    "## Дополнительная задача ★★★\n",
    "\n",
    "Поменяйте выражение лица: разверните дугу улыбки, чтобы получились нахмуренные брови."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "f4b0c43e",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-14T20:53:43.382594Z",
     "iopub.status.busy": "2026-08-14T20:53:43.382479Z",
     "iopub.status.idle": "2026-08-14T20:53:45.563265Z",
     "shell.execute_reply": "2026-08-14T20:53:45.562816Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Хмурое лицо готово.\n"
     ]
    }
   ],
   "source": [
    "artist.reset()\n",
    "artist.fillcolor(\"yellow\")\n",
    "artist.begin_fill()\n",
    "artist.circle(100)\n",
    "artist.end_fill()\n",
    "\n",
    "artist.penup()\n",
    "artist.goto(-50, 20)\n",
    "artist.setheading(60)\n",
    "artist.pendown()\n",
    "artist.pensize(4)\n",
    "artist.circle(-60, 120)  # отрицательный радиус — дуга рисуется в другую сторону\n",
    "print(\"Хмурое лицо готово.\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e93a7fde",
   "metadata": {},
   "source": [
    "## Завершение (выполнить один раз, в самом конце)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "8b21789c",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-14T20:53:45.564395Z",
     "iopub.status.busy": "2026-08-14T20:53:45.564288Z",
     "iopub.status.idle": "2026-08-14T20:53:45.567731Z",
     "shell.execute_reply": "2026-08-14T20:53:45.567197Z"
    }
   },
   "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
}
