{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "03440a8b",
   "metadata": {},
   "source": [
    "# 06-10 · Kierunek i kąt\n",
    "\n",
    "Praktyka do sekcji [„Kierunek i kąt”"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f4ed132e",
   "metadata": {},
   "source": [
    "## Cel\n",
    "\n",
    "Rozróżnić pozycję i kurs żółwia; odnieść stopnie do kierunków głównych kierunków."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "6b72b513",
   "metadata": {},
   "source": [
    "## Ustawienie (wykonać raz)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "e936992b",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T13:58:08.674582Z",
     "iopub.status.busy": "2026-08-16T13:58:08.674293Z",
     "iopub.status.idle": "2026-08-16T13:58:08.850295Z",
     "shell.execute_reply": "2026-08-16T13:58:08.849854Z"
    }
   },
   "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": "81104576",
   "metadata": {},
   "source": [
    "## Sprawa robocza\n",
    "\n",
    "Cztery kursy z jednego punktu."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "0ae3adca",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T13:58:08.851342Z",
     "iopub.status.busy": "2026-08-16T13:58:08.851215Z",
     "iopub.status.idle": "2026-08-16T13:58:09.861802Z",
     "shell.execute_reply": "2026-08-16T13:58:09.861345Z"
    }
   },
   "outputs": [],
   "source": [
    "artist.reset()\n",
    "for angle in [0, 90, 180, 270]:\n",
    "    artist.setheading(angle)\n",
    "    artist.forward(80)\n",
    "    artist.backward(80)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d771dbc2",
   "metadata": {},
   "source": [
    "## Eksperyment 1\n",
    "\n",
    "Przewidź kurs po tych komendach, a następnie sprawdź heading()."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "2cf2036d",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T13:58:09.863144Z",
     "iopub.status.busy": "2026-08-16T13:58:09.863037Z",
     "iopub.status.idle": "2026-08-16T13:58:10.085927Z",
     "shell.execute_reply": "2026-08-16T13:58:10.085448Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "315.0\n"
     ]
    }
   ],
   "source": [
    "artist.reset()\n",
    "artist.left(45)\n",
    "artist.right(90)\n",
    "print(artist.heading())"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2e012e98",
   "metadata": {},
   "source": [
    "## Podstawowa praktyka zadań ★\n",
    "\n",
    "Obróć żółwia tak, aby jego kurs był ściśle 225°, używając dowolnych left()/right() z początkowego kursu 0°, i wydaj artist.heading()."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "8b4ef602",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T13:58:10.086884Z",
     "iopub.status.busy": "2026-08-16T13:58:10.086775Z",
     "iopub.status.idle": "2026-08-16T13:58:10.390573Z",
     "shell.execute_reply": "2026-08-16T13:58:10.390089Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "225.0\n"
     ]
    }
   ],
   "source": [
    "artist.reset()\n",
    "artist.left(225)\n",
    "print(artist.heading())"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f95b7fd0",
   "metadata": {},
   "source": [
    "## Ukończenie (wykonaj raz, na samym końcu)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "6b4cc6a7",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T13:58:10.391560Z",
     "iopub.status.busy": "2026-08-16T13:58:10.391449Z",
     "iopub.status.idle": "2026-08-16T13:58:10.394398Z",
     "shell.execute_reply": "2026-08-16T13:58:10.393915Z"
    }
   },
   "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
}
