{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "cc11c806",
   "metadata": {},
   "source": [
    "# 21-01 · Импорт и инициализация\n",
    "\n",
    "Практика к разделу [«Игра «Космический шутер»»](../../site/chapters/glava-21/21-01-igra-import-init.html)."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "419068f4",
   "metadata": {},
   "source": [
    "## Цель\n",
    "\n",
    "Подключить нужные модули и настроить экран, часы и шрифт для новой игры."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "78622a54",
   "metadata": {},
   "source": [
    "## Рабочий пример"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "cb445823",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-14T20:59:29.813904Z",
     "iopub.status.busy": "2026-08-14T20:59:29.813726Z",
     "iopub.status.idle": "2026-08-14T20:59:30.005462Z",
     "shell.execute_reply": "2026-08-14T20:59:30.004792Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "pygame-ce 2.5.8 (SDL 2.32.10, Python 3.14.6)\n",
      "Экран создан: (500, 600)\n",
      "Тип шрифта: <class 'pygame.font.Font'>\n"
     ]
    }
   ],
   "source": [
    "import random\n",
    "\n",
    "import pygame\n",
    "\n",
    "SHIRINA, VYSOTA = 500, 600\n",
    "FPS = 60\n",
    "\n",
    "pygame.init()\n",
    "screen = pygame.display.set_mode((SHIRINA, VYSOTA))\n",
    "pygame.display.set_caption(\"Космический шутер\")\n",
    "clock = pygame.time.Clock()\n",
    "shrift = pygame.font.SysFont(None, 32)\n",
    "\n",
    "print(\"Экран создан:\", screen.get_size())\n",
    "print(\"Тип шрифта:\", type(shrift))\n",
    "pygame.quit()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3c1202fa",
   "metadata": {},
   "source": [
    "## Проверка результата"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "2f224778",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-14T20:59:30.006813Z",
     "iopub.status.busy": "2026-08-14T20:59:30.006608Z",
     "iopub.status.idle": "2026-08-14T20:59:30.149009Z",
     "shell.execute_reply": "2026-08-14T20:59:30.148421Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Верно: размер экрана совпадает с задуманным.\n"
     ]
    }
   ],
   "source": [
    "pygame.init()\n",
    "screen = pygame.display.set_mode((500, 600))\n",
    "assert screen.get_size() == (500, 600)\n",
    "print(\"Верно: размер экрана совпадает с задуманным.\")\n",
    "pygame.quit()"
   ]
  }
 ],
 "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
}
