{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "15bcace8",
   "metadata": {},
   "source": [
    "# 17-10 · command vs bind — что выбирать\n",
    "\n",
    "Практика к разделу [«command vs bind — что выбирать»](../../site/chapters/glava-17/17-10-command-vs-bind.html)."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "fd0f609f",
   "metadata": {},
   "source": [
    "## Цель\n",
    "\n",
    "Для трёх сценариев игры выбрать правильный инструмент: command= или bind()."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c405f06f",
   "metadata": {},
   "source": [
    "## Рабочий пример"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "7723de53",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-09-03T10:12:42.438110Z",
     "iopub.status.busy": "2026-09-03T10:12:42.437925Z",
     "iopub.status.idle": "2026-09-03T10:12:42.466787Z",
     "shell.execute_reply": "2026-09-03T10:12:42.466234Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "клик по клетке — основной ход -> command\n",
      "наведение мыши — превью -> bind\n",
      "клавиши 1-9 — управление -> bind\n"
     ]
    }
   ],
   "source": [
    "def choose_tool(scenario):\n",
    "    if scenario == \"клик по клетке — основной ход\":\n",
    "        return \"command\"\n",
    "    if scenario in (\"наведение мыши — превью\", \"клавиши 1-9 — управление\"):\n",
    "        return \"bind\"\n",
    "    return \"неизвестно\"\n",
    "\n",
    "for scenario in [\"клик по клетке — основной ход\", \"наведение мыши — превью\", \"клавиши 1-9 — управление\"]:\n",
    "    print(scenario, \"->\", choose_tool(scenario))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "bc1f44b1",
   "metadata": {},
   "source": [
    "## Задание ★ Базовая практика"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "8e144e3b",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-09-03T10:12:42.468504Z",
     "iopub.status.busy": "2026-09-03T10:12:42.468337Z",
     "iopub.status.idle": "2026-09-03T10:12:42.471279Z",
     "shell.execute_reply": "2026-09-03T10:12:42.470716Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "command bind bind\n"
     ]
    }
   ],
   "source": [
    "vybor_hod_po_kletke = \"command\"\n",
    "vybor_hover_effekt = \"bind\"\n",
    "vybor_klavishi_1_9 = \"bind\"\n",
    "\n",
    "print(vybor_hod_po_kletke, vybor_hover_effekt, vybor_klavishi_1_9)"
   ]
  }
 ],
 "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
}
