From 012638e1d893b1b7228f839441124a0a3ad2d693 Mon Sep 17 00:00:00 2001 From: Veronika Minina Date: Sun, 17 May 2026 13:16:41 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9A=D0=BB=D0=B5=D1=82=D0=BA=D0=B0=20=D0=BB?= =?UTF-8?q?=D0=B0=D0=B1=D0=B8=D1=80=D0=B8=D0=BD=D1=82=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MininaVD/docs2/data2/modelsCell.ipynb | 58 +++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 MininaVD/docs2/data2/modelsCell.ipynb diff --git a/MininaVD/docs2/data2/modelsCell.ipynb b/MininaVD/docs2/data2/modelsCell.ipynb new file mode 100644 index 0000000..b6b5547 --- /dev/null +++ b/MininaVD/docs2/data2/modelsCell.ipynb @@ -0,0 +1,58 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "3a6bb811-80ad-4ef5-95b6-0b7cffc6545e", + "metadata": {}, + "outputs": [], + "source": [ + "from dataclasses import dataclass\n", + "from typing import Optional\n", + "\n", + "@dataclass\n", + "class Cell:\n", + " \"\"\"Клетка лабиринта.\"\"\"\n", + " x: int\n", + " y: int\n", + " is_wall: bool = False\n", + " is_start: bool = False\n", + " is_exit: bool = False\n", + " weight: int = 1 # Для взвешенных лабиринтов (доп. задание)\n", + " \n", + " def is_passable(self) -> bool:\n", + " \"\"\"Проходима ли клетка.\"\"\"\n", + " return not self.is_wall\n", + " \n", + " def __hash__(self) -> int:\n", + " return hash((self.x, self.y))\n", + " \n", + " def __eq__(self, other) -> bool:\n", + " if not isinstance(other, Cell):\n", + " return False\n", + " return self.x == other.x and self.y == other.y" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python [conda env:base] *", + "language": "python", + "name": "conda-base-py" + }, + "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.13.9" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}