{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "7e3e9eb3",
   "metadata": {},
   "source": [
    "# 12-03 · Choinka\n",
    "\n",
    "Praktyka do sekcji [„Projekt 12-3”"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f4430fcd",
   "metadata": {},
   "source": [
    "## Cel\n",
    "\n",
    "Narysuj choinkę z coraz mniejszych trójkątnych poziomów."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "04e94526",
   "metadata": {},
   "source": [
    "## Ustawienie (wykonać raz)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "95e2e884",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-17T16:39:02.964777Z",
     "iopub.status.busy": "2026-08-17T16:39:02.964657Z",
     "iopub.status.idle": "2026-08-17T16:39:03.117576Z",
     "shell.execute_reply": "2026-08-17T16:39:03.117131Z"
    }
   },
   "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": "8b38fa35",
   "metadata": {},
   "source": [
    "## Sprawa robocza"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "ecf5113b",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-17T16:39:03.118626Z",
     "iopub.status.busy": "2026-08-17T16:39:03.118497Z",
     "iopub.status.idle": "2026-08-17T16:39:06.926205Z",
     "shell.execute_reply": "2026-08-17T16:39:06.925695Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ёлка из 4 ярусов готова.\n"
     ]
    }
   ],
   "source": [
    "artist.reset()\n",
    "artist.pencolor(\"green\")\n",
    "artist.fillcolor(\"green\")\n",
    "\n",
    "yarusy = 4\n",
    "shirina = 120\n",
    "\n",
    "artist.penup()\n",
    "artist.goto(0, 100)\n",
    "artist.pendown()\n",
    "\n",
    "for yarus in range(yarusy):\n",
    "    artist.begin_fill()\n",
    "    artist.setheading(240)\n",
    "    artist.forward(shirina)\n",
    "    artist.setheading(0)\n",
    "    artist.forward(shirina)\n",
    "    artist.setheading(120)\n",
    "    artist.forward(shirina)\n",
    "    artist.end_fill()\n",
    "\n",
    "    artist.penup()\n",
    "    artist.setheading(270)\n",
    "    artist.forward(30)\n",
    "    artist.pendown()\n",
    "    shirina -= 20\n",
    "\n",
    "print(\"Ёлка из\", yarusy, \"ярусов готова.\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "fce5dca6",
   "metadata": {},
   "source": [
    "## Zadanie niezależne od zadania ★★\n",
    "\n",
    "Zmień liczbę poziomów na 6 i szerokość początkową na 150."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "79e2cdbb",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-17T16:39:06.927188Z",
     "iopub.status.busy": "2026-08-17T16:39:06.927083Z",
     "iopub.status.idle": "2026-08-17T16:39:12.652384Z",
     "shell.execute_reply": "2026-08-17T16:39:12.651806Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ёлка из 6 ярусов готова.\n"
     ]
    }
   ],
   "source": [
    "artist.reset()\n",
    "artist.pencolor(\"green\")\n",
    "artist.fillcolor(\"green\")\n",
    "\n",
    "yarusy = 6\n",
    "shirina = 150\n",
    "\n",
    "artist.penup()\n",
    "artist.goto(0, 130)\n",
    "artist.pendown()\n",
    "\n",
    "for yarus in range(yarusy):\n",
    "    artist.begin_fill()\n",
    "    artist.setheading(240)\n",
    "    artist.forward(shirina)\n",
    "    artist.setheading(0)\n",
    "    artist.forward(shirina)\n",
    "    artist.setheading(120)\n",
    "    artist.forward(shirina)\n",
    "    artist.end_fill()\n",
    "\n",
    "    artist.penup()\n",
    "    artist.setheading(270)\n",
    "    artist.forward(25)\n",
    "    artist.pendown()\n",
    "    shirina -= 20\n",
    "\n",
    "print(\"Ёлка из\", yarusy, \"ярусов готова.\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e26f3338",
   "metadata": {},
   "source": [
    "## Ukończenie (wykonaj raz, na samym końcu)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "16b2f270",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-17T16:39:12.653319Z",
     "iopub.status.busy": "2026-08-17T16:39:12.653215Z",
     "iopub.status.idle": "2026-08-17T16:39:12.656120Z",
     "shell.execute_reply": "2026-08-17T16:39:12.655683Z"
    }
   },
   "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
}
