{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "9783229c",
   "metadata": {},
   "source": [
    "# 19-21 · Game Over jako stan\n",
    "\n",
    "Praktyka do sekcji [„Game Over jako stan”"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f472abb1",
   "metadata": {},
   "source": [
    "## Cel\n",
    "\n",
    "Określić, które kolizje przenoszą grę do GAME_OVER."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "21aa4fa5",
   "metadata": {},
   "source": [
    "## Sprawa robocza"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "d6d01927",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-09-03T00:54:07.367487Z",
     "iopub.status.busy": "2026-09-03T00:54:07.367333Z",
     "iopub.status.idle": "2026-09-03T00:54:07.394957Z",
     "shell.execute_reply": "2026-09-03T00:54:07.394157Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "game_over\n",
      "running\n"
     ]
    }
   ],
   "source": [
    "def resolve_tick(head, status, *, wall_hit, self_hit):\n",
    "    if wall_hit or self_hit:\n",
    "        return \"game_over\"\n",
    "    return status\n",
    "\n",
    "print(resolve_tick((0, 0), \"running\", wall_hit=True, self_hit=False))\n",
    "print(resolve_tick((0, 0), \"running\", wall_hit=False, self_hit=False))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "7dafbc18",
   "metadata": {},
   "source": [
    "## Podstawowa praktyka zadań ★"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "a60531bc",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-09-03T00:54:07.396208Z",
     "iopub.status.busy": "2026-09-03T00:54:07.396075Z",
     "iopub.status.idle": "2026-09-03T00:54:07.398864Z",
     "shell.execute_reply": "2026-09-03T00:54:07.398357Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Любое из двух столкновений переводит игру в game_over.\n"
     ]
    }
   ],
   "source": [
    "assert resolve_tick((0, 0), \"running\", wall_hit=True, self_hit=False) == \"game_over\"\n",
    "assert resolve_tick((0, 0), \"running\", wall_hit=False, self_hit=True) == \"game_over\"\n",
    "assert resolve_tick((0, 0), \"running\", wall_hit=False, self_hit=False) == \"running\"\n",
    "print(\"Любое из двух столкновений переводит игру в game_over.\")"
   ]
  }
 ],
 "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
}
