{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "894f3dd4",
   "metadata": {},
   "source": [
    "# 06-17 · Debugowanie Turtle\n",
    "\n",
    "Praktyka do sekcji [„Debugowanie Turtle”"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3d5e4616",
   "metadata": {},
   "source": [
    "## Cel\n",
    "\n",
    "Znajdowanie i naprawianie typowych błędów w kodzie Turtle."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "8c89be50",
   "metadata": {},
   "source": [
    "## Ustawienie (wykonać raz)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "0f1af9fe",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T13:58:34.399784Z",
     "iopub.status.busy": "2026-08-16T13:58:34.399647Z",
     "iopub.status.idle": "2026-08-16T13:58:34.580599Z",
     "shell.execute_reply": "2026-08-16T13:58:34.580057Z"
    }
   },
   "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": "c3928c64",
   "metadata": {},
   "source": [
    "## Typowy błąd\n",
    "\n",
    "Ten kod miał rysować kwadrat, ale zapomniałem o jednym obrotie — okazało się, że to nie jest kwadrat."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "22455116",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T13:58:34.582268Z",
     "iopub.status.busy": "2026-08-16T13:58:34.582091Z",
     "iopub.status.idle": "2026-08-16T13:58:35.152644Z",
     "shell.execute_reply": "2026-08-16T13:58:35.152138Z"
    }
   },
   "outputs": [],
   "source": [
    "artist.reset()\n",
    "artist.forward(80)\n",
    "artist.right(90)\n",
    "artist.forward(80)\n",
    "artist.right(90)\n",
    "artist.forward(80)\n",
    "# tu przegapiłem jeden zakręt!\n",
    "artist.forward(80)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1b9314d6",
   "metadata": {},
   "source": [
    "## Podstawowa praktyka zadań ★\n",
    "\n",
    "Popraw powyższy kod, aby uzyskać prawdziwy kwadrat (dodaj brakujący right(90))."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "2427154c",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T13:58:35.153707Z",
     "iopub.status.busy": "2026-08-16T13:58:35.153589Z",
     "iopub.status.idle": "2026-08-16T13:58:35.848401Z",
     "shell.execute_reply": "2026-08-16T13:58:35.847746Z"
    }
   },
   "outputs": [],
   "source": [
    "artist.reset()\n",
    "artist.forward(80)\n",
    "artist.right(90)\n",
    "artist.forward(80)\n",
    "artist.right(90)\n",
    "artist.forward(80)\n",
    "artist.right(90)\n",
    "artist.forward(80)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "096525ff",
   "metadata": {},
   "source": [
    "## Ukończenie (wykonaj raz, na samym końcu)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "e683963f",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T13:58:35.849480Z",
     "iopub.status.busy": "2026-08-16T13:58:35.849359Z",
     "iopub.status.idle": "2026-08-16T13:58:35.852324Z",
     "shell.execute_reply": "2026-08-16T13:58:35.851835Z"
    }
   },
   "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
}
