{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "5ebaf9e4",
   "metadata": {},
   "source": [
    "# 17-13 · Model stanu gry\n",
    "\n",
    "Praktyka do sekcji [„Model stanu gry”"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "281682aa",
   "metadata": {},
   "source": [
    "## Cel\n",
    "\n",
    "Symuluj stan gry za pomocą słownika — bez pojedynczego widżetu."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c0a2498a",
   "metadata": {},
   "source": [
    "## Sprawa robocza"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "6d3440ae",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-09-03T10:12:49.805970Z",
     "iopub.status.busy": "2026-09-03T10:12:49.805820Z",
     "iopub.status.idle": "2026-09-03T10:12:49.822426Z",
     "shell.execute_reply": "2026-09-03T10:12:49.821957Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{'board': ['', '', '', '', '', '', '', '', ''], 'current_player': 'X', 'game_over': False, 'winner': None, 'winning_line': None, 'score_x': 0, 'score_o': 0}\n"
     ]
    }
   ],
   "source": [
    "def new_state():\n",
    "    return {\n",
    "        \"board\": [\"\"] * 9,\n",
    "        \"current_player\": \"X\",\n",
    "        \"game_over\": False,\n",
    "        \"winner\": None,\n",
    "        \"winning_line\": None,\n",
    "        \"score_x\": 0,\n",
    "        \"score_o\": 0,\n",
    "    }\n",
    "\n",
    "state = new_state()\n",
    "print(state)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "dad8a619",
   "metadata": {},
   "source": [
    "## Podstawowa praktyka zadań ★"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "3fddd07f",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-09-03T10:12:49.824719Z",
     "iopub.status.busy": "2026-09-03T10:12:49.824531Z",
     "iopub.status.idle": "2026-09-03T10:12:49.827793Z",
     "shell.execute_reply": "2026-09-03T10:12:49.827287Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Начальное состояние верно.\n"
     ]
    }
   ],
   "source": [
    "assert len(state[\"board\"]) == 9\n",
    "assert all(cell == \"\" for cell in state[\"board\"])\n",
    "assert state[\"current_player\"] == \"X\"\n",
    "assert state[\"game_over\"] is False\n",
    "print(\"Начальное состояние верно.\")"
   ]
  }
 ],
 "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
}
