{
  "nbformat": 4,
  "nbformat_minor": 5,
  "metadata": {
    "colab": {
      "provenance": [],
      "toc_visible": true
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3"
    },
    "language_info": {
      "name": "python",
      "version": "3.10"
    }
  },
  "cells": [
    {
      "cell_type": "markdown",
      "id": "w1-header",
      "metadata": {},
      "source": [
        "# Week 1（12/2）｜抽卡運勢小工具\n",
        "\n",
        "> 開始前先點上方 **「複製到雲端硬碟（Copy to Drive）」**。"
      ]
    },
    {
      "cell_type": "markdown",
      "id": "w1-engine-md",
      "metadata": {},
      "source": [
        "## 0. 載入卡片工具\n",
        "先按左邊 ▶️ 執行一次。"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "id": "w1-engine-code",
      "metadata": {
        "cellView": "form"
      },
      "outputs": [],
      "source": [
        "#@title 點左邊 ▶️ 載入卡片工具\n",
        "import html as _html\n",
        "import random\n",
        "from IPython.display import display, HTML\n",
        "\n",
        "_FONT = \"-apple-system, BlinkMacSystemFont, 'Noto Sans TC', 'Microsoft JhengHei', sans-serif\"\n",
        "\n",
        "def _esc(val) -> str:\n",
        "    return _html.escape(str(val))\n",
        "\n",
        "def show_drink_sticker(name: str, drink: str, sugar: str, ice: str):\n",
        "    \"\"\"畫出一張像飲料杯身點單的貼紙卡片\"\"\"\n",
        "    code = f\"#{random.randint(101, 999)}\"\n",
        "    markup = f\"\"\"\n",
        "    <div style=\"font-family:{_FONT};max-width:300px;background:#FFFDF5;color:#2C241B;\n",
        "                border:2px dashed #C7B299;border-radius:14px;padding:16px 18px;\n",
        "                box-shadow:0 8px 20px rgba(0,0,0,0.12);margin:8px 0;\">\n",
        "      <div style=\"display:flex;justify-content:space-between;align-items:center;\n",
        "                  border-bottom:1.5px solid #E5D9C3;padding-bottom:8px;margin-bottom:10px;\">\n",
        "        <span style=\"font-weight:800;font-size:15px;letter-spacing:1px;\">🧋 黎明茶行</span>\n",
        "        <span style=\"background:#2C241B;color:#FFFDF5;font-size:12px;font-weight:700;\n",
        "                     padding:2px 8px;border-radius:6px;\">{code}</span>\n",
        "      </div>\n",
        "      <div style=\"font-size:12px;color:#7A6A58;margin-bottom:4px;\">點單貴賓：<b>{_esc(name)}</b></div>\n",
        "      <div style=\"font-size:22px;font-weight:900;color:#1F1A14;margin:8px 0 10px 0;line-height:1.3;\">\n",
        "        {_esc(drink)}\n",
        "      </div>\n",
        "      <div style=\"display:flex;gap:8px;margin-bottom:12px;\">\n",
        "        <span style=\"background:#FFE8C2;color:#8A4B08;font-size:12px;font-weight:700;\n",
        "                     padding:4px 10px;border-radius:999px;\">🍯 {_esc(sugar)}</span>\n",
        "        <span style=\"background:#D9F0FF;color:#0B5394;font-size:12px;font-weight:700;\n",
        "                     padding:4px 10px;border-radius:999px;\">🧊 {_esc(ice)}</span>\n",
        "      </div>\n",
        "      <div style=\"border-top:1.5px dashed #D7C7B2;padding-top:8px;font-size:11px;\n",
        "                  color:#8C7B68;display:flex;justify-content:space-between;\">\n",
        "        <span>▌▌█▌█▌▌██▌█</span>\n",
        "        <span>祝你今天喝得開心 ✨</span>\n",
        "      </div>\n",
        "    </div>\n",
        "    \"\"\"\n",
        "    display(HTML(markup))\n",
        "\n",
        "def show_fortune_card(name: str, level: str, score: int, lucky_color: str, lucky_item: str, message: str):\n",
        "    \"\"\"畫出一張立體質感的今日運勢卡\"\"\"\n",
        "    safe_score = max(0, min(100, int(score))) if str(score).isdigit() else 88\n",
        "    markup = f\"\"\"\n",
        "    <div style=\"font-family:{_FONT};max-width:340px;\n",
        "                background:linear-gradient(145deg,#1E1B4B 0%,#312E81 55%,#4C1D95 100%);\n",
        "                color:#FFFFFF;border:3px solid #FBBF24;border-radius:20px;padding:20px;\n",
        "                box-shadow:0 12px 28px rgba(49,46,129,0.35);margin:8px 0;\">\n",
        "      <div style=\"display:flex;justify-content:space-between;align-items:center;margin-bottom:12px;\">\n",
        "        <span style=\"font-size:12px;letter-spacing:1.5px;color:#FDE68A;font-weight:700;\">🔮 DAILY FORTUNE CARD</span>\n",
        "        <span style=\"background:rgba(255,255,255,0.16);padding:3px 10px;border-radius:999px;font-size:12px;\">\n",
        "          👤 {_esc(name)}\n",
        "        </span>\n",
        "      </div>\n",
        "      <div style=\"text-align:center;background:rgba(255,255,255,0.10);border:1px solid rgba(253,230,138,0.35);\n",
        "                  border-radius:14px;padding:16px 12px;margin-bottom:14px;\">\n",
        "        <div style=\"font-size:32px;font-weight:900;color:#FDE68A;letter-spacing:2px;\">{_esc(level)}</div>\n",
        "        <div style=\"margin-top:10px;font-size:12px;color:#E0E7FF;\">幸運指數 {safe_score} / 100</div>\n",
        "        <div style=\"background:rgba(255,255,255,0.2);height:8px;border-radius:999px;margin:6px 16px 0 16px;overflow:hidden;\">\n",
        "          <div style=\"width:{safe_score}%;height:100%;background:linear-gradient(90deg,#F59E0B,#FDE047);border-radius:999px;\"></div>\n",
        "        </div>\n",
        "      </div>\n",
        "      <div style=\"display:flex;gap:8px;justify-content:center;flex-wrap:wrap;margin-bottom:14px;\">\n",
        "        <span style=\"background:rgba(255,255,255,0.15);padding:5px 12px;border-radius:10px;font-size:12px;\">\n",
        "          🎨 幸運色：<b>{_esc(lucky_color)}</b>\n",
        "        </span>\n",
        "        <span style=\"background:rgba(255,255,255,0.15);padding:5px 12px;border-radius:10px;font-size:12px;\">\n",
        "          🎁 幸運物：<b>{_esc(lucky_item)}</b>\n",
        "        </span>\n",
        "      </div>\n",
        "      <div style=\"background:rgba(15,23,42,0.45);border-left:3px solid #FBBF24;\n",
        "                  border-radius:8px;padding:10px 12px;font-size:13px;line-height:1.5;color:#F8FAFC;\">\n",
        "        💬 {_esc(message)}\n",
        "      </div>\n",
        "    </div>\n",
        "    \"\"\"\n",
        "    display(HTML(markup))\n",
        "\n",
        "_GACHA_THEMES = {\n",
        "    \"SSR\": {\n",
        "        \"bg\": \"linear-gradient(145deg,#FFF7CC 0%,#FDE047 35%,#F97316 100%)\",\n",
        "        \"border\": \"#F59E0B\",\n",
        "        \"pill_bg\": \"#7C2D12\",\n",
        "        \"pill_fg\": \"#FEF08A\",\n",
        "        \"text\": \"#431407\",\n",
        "        \"sub\": \"#7C2D12\",\n",
        "        \"stars\": \"★★★★★\",\n",
        "        \"icon\": \"🌈\",\n",
        "        \"score\": 100,\n",
        "        \"glow\": \"0 0 18px rgba(250,204,21,0.75)\",\n",
        "    },\n",
        "    \"SR\": {\n",
        "        \"bg\": \"linear-gradient(145deg,#F3E8FF 0%,#C084FC 55%,#7E22CE 100%)\",\n",
        "        \"border\": \"#A855F7\",\n",
        "        \"pill_bg\": \"#3B0764\",\n",
        "        \"pill_fg\": \"#F5D0FE\",\n",
        "        \"text\": \"#FFFFFF\",\n",
        "        \"sub\": \"#F3E8FF\",\n",
        "        \"stars\": \"★★★★☆\",\n",
        "        \"icon\": \"🔥\",\n",
        "        \"score\": 85,\n",
        "        \"glow\": \"0 6px 16px rgba(147,51,234,0.35)\",\n",
        "    },\n",
        "    \"R\": {\n",
        "        \"bg\": \"linear-gradient(145deg,#E0F2FE 0%,#60A5FA 65%,#2563EB 100%)\",\n",
        "        \"border\": \"#3B82F6\",\n",
        "        \"pill_bg\": \"#1E3A8A\",\n",
        "        \"pill_fg\": \"#DBEAFE\",\n",
        "        \"text\": \"#FFFFFF\",\n",
        "        \"sub\": \"#EFF6FF\",\n",
        "        \"stars\": \"★★★☆☆\",\n",
        "        \"icon\": \"💎\",\n",
        "        \"score\": 70,\n",
        "        \"glow\": \"0 4px 12px rgba(37,99,235,0.25)\",\n",
        "    },\n",
        "    \"N\": {\n",
        "        \"bg\": \"linear-gradient(145deg,#F1F5F9 0%,#CBD5E1 100%)\",\n",
        "        \"border\": \"#94A3B8\",\n",
        "        \"pill_bg\": \"#334155\",\n",
        "        \"pill_fg\": \"#F1F5F9\",\n",
        "        \"text\": \"#1E293B\",\n",
        "        \"sub\": \"#475569\",\n",
        "        \"stars\": \"★★☆☆☆\",\n",
        "        \"icon\": \"🍀\",\n",
        "        \"score\": 55,\n",
        "        \"glow\": \"0 3px 8px rgba(15,23,42,0.12)\",\n",
        "    },\n",
        "}\n",
        "\n",
        "def run_gacha(player_name: str, draw_mode: str, rarity_weights: dict, card_pool: dict):\n",
        "    \"\"\"執行單抽或十連抽（含保底），並畫出遊戲風格的抽卡結算畫面\"\"\"\n",
        "    draw_count = 10 if \"十連抽\" in str(draw_mode) else 1\n",
        "\n",
        "    def _pick(guarantee_sr_plus: bool = False):\n",
        "        if guarantee_sr_plus:\n",
        "            rarities = [\"SSR\", \"SR\"]\n",
        "            weights = [rarity_weights.get(\"SSR\", 5), rarity_weights.get(\"SR\", 20)]\n",
        "        else:\n",
        "            rarities = list(rarity_weights.keys())\n",
        "            weights = list(rarity_weights.values())\n",
        "        if sum(weights) <= 0:\n",
        "            weights = [1] * len(rarities)\n",
        "        r = random.choices(rarities, weights=weights, k=1)[0]\n",
        "        return r, random.choice(card_pool[r])\n",
        "\n",
        "    results = []\n",
        "    for i in range(draw_count):\n",
        "        has_sr_plus = any(r in (\"SSR\", \"SR\") for r, _, _ in results)\n",
        "        pity = (draw_count == 10 and i == 9 and not has_sr_plus)\n",
        "        r, card = _pick(guarantee_sr_plus=pity)\n",
        "        results.append((r, card, pity))\n",
        "\n",
        "    counts = {r: sum(1 for x, _, _ in results if x == r) for r in [\"SSR\", \"SR\", \"R\", \"N\"]}\n",
        "    avg_score = round(sum(_GACHA_THEMES[r][\"score\"] for r, _, _ in results) / len(results), 1)\n",
        "\n",
        "    if counts[\"SSR\"] >= 2:\n",
        "        rank_title = \"👑 傳說級天選歐洲皇\"\n",
        "    elif counts[\"SSR\"] == 1:\n",
        "        rank_title = \"🌟 閃耀歐洲人\"\n",
        "    elif counts[\"SR\"] >= 3 or (draw_count == 1 and counts[\"SR\"] == 1):\n",
        "        rank_title = \"✨ 氣運不錯的幸運兒\"\n",
        "    elif counts[\"R\"] >= 1:\n",
        "        rank_title = \"🙂 穩紮穩打亞洲代表\"\n",
        "    else:\n",
        "        rank_title = \"🗿 尊榮非洲酋長\"\n",
        "\n",
        "    cards_html = []\n",
        "    is_single = (draw_count == 1)\n",
        "    card_width = \"300px\" if is_single else \"158px\"\n",
        "\n",
        "    for idx, (r, card, pity) in enumerate(results, 1):\n",
        "        t = _GACHA_THEMES[r]\n",
        "        pity_badge = (\n",
        "            \"<span style='background:#DC2626;color:#FFF;font-size:10px;padding:1px 6px;\"\n",
        "            \"border-radius:999px;margin-left:4px;'>🛡️保底</span>\"\n",
        "            if pity else \"\"\n",
        "        )\n",
        "        desc_block = (\n",
        "            f\"<div style='margin-top:8px;font-size:12px;line-height:1.45;color:{t['sub']};\"\n",
        "            f\"background:rgba(255,255,255,0.22);padding:8px;border-radius:8px;'>{_esc(card['desc'])}</div>\"\n",
        "            if (is_single or r == \"SSR\")\n",
        "            else f\"<div style='margin-top:6px;font-size:11px;line-height:1.35;color:{t['sub']};opacity:0.92;'>{_esc(card['desc'][:22])}…</div>\"\n",
        "        )\n",
        "        cards_html.append(f\"\"\"\n",
        "        <div style=\"width:{card_width};background:{t['bg']};border:2.5px solid {t['border']};\n",
        "                    border-radius:14px;padding:12px;box-shadow:{t['glow']};\n",
        "                    display:flex;flex-direction:column;justify-content:space-between;box-sizing:border-box;\">\n",
        "          <div>\n",
        "            <div style=\"display:flex;justify-content:space-between;align-items:center;margin-bottom:6px;\">\n",
        "              <span style=\"background:{t['pill_bg']};color:{t['pill_fg']};font-size:11px;font-weight:800;\n",
        "                           padding:2px 8px;border-radius:999px;\">{r}</span>\n",
        "              <span style=\"font-size:11px;color:{t['sub']};font-weight:700;\">#{idx}{pity_badge}</span>\n",
        "            </div>\n",
        "            <div style=\"font-size:{'36px' if is_single else '26px'};text-align:center;margin:4px 0;\">{t['icon']}</div>\n",
        "            <div style=\"text-align:center;font-size:11px;color:{t['sub']};letter-spacing:1px;\">{t['stars']}</div>\n",
        "            <div style=\"text-align:center;font-size:{'18px' if is_single else '14px'};font-weight:900;\n",
        "                        color:{t['text']};margin-top:4px;line-height:1.3;\">{_esc(card['name'])}</div>\n",
        "          </div>\n",
        "          {desc_block}\n",
        "        </div>\n",
        "        \"\"\")\n",
        "\n",
        "    board = f\"\"\"\n",
        "    <div style=\"font-family:{_FONT};background:#0F172A;color:#F8FAFC;border-radius:18px;\n",
        "                padding:18px;max-width:860px;box-shadow:0 12px 30px rgba(15,23,42,0.4);margin:8px 0;\">\n",
        "      <div style=\"display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap;\n",
        "                  gap:8px;border-bottom:1px solid #334155;padding-bottom:12px;margin-bottom:14px;\">\n",
        "        <div style=\"font-size:18px;font-weight:900;color:#FDE047;\">🎴 {_esc(player_name)} 的運勢抽卡結果</div>\n",
        "        <div style=\"font-size:12px;background:#1E293B;color:#CBD5E1;padding:4px 12px;border-radius:999px;\">\n",
        "          模式：{_esc(draw_mode)}\n",
        "        </div>\n",
        "      </div>\n",
        "      <div style=\"display:flex;flex-wrap:wrap;gap:10px;justify-content:{'center' if is_single else 'flex-start'};\">\n",
        "        {''.join(cards_html)}\n",
        "      </div>\n",
        "      <div style=\"margin-top:14px;background:#1E293B;border-radius:12px;padding:12px 14px;\n",
        "                  display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap;gap:8px;\">\n",
        "        <div style=\"font-size:13px;color:#E2E8F0;\">\n",
        "          📊 <b>SSR ×{counts['SSR']}</b> ｜ SR ×{counts['SR']} ｜ R ×{counts['R']} ｜ N ×{counts['N']}\n",
        "          （平均 {avg_score} 分）\n",
        "        </div>\n",
        "        <div style=\"font-size:14px;font-weight:800;color:#FDE047;\">🏅 {rank_title}</div>\n",
        "      </div>\n",
        "    </div>\n",
        "    \"\"\"\n",
        "    display(HTML(board))\n",
        "\n",
        "def show_clear_badge(name: str, message: str):\n",
        "    \"\"\"第 3 關修好後顯示破關徽章卡\"\"\"\n",
        "    markup = f\"\"\"\n",
        "    <div style=\"font-family:{_FONT};max-width:340px;\n",
        "                background:linear-gradient(135deg,#065F46 0%,#059669 60%,#34D399 100%);\n",
        "                color:#FFFFFF;border:3px solid #FDE047;border-radius:18px;padding:18px 20px;\n",
        "                box-shadow:0 10px 24px rgba(5,150,105,0.35);text-align:center;margin:8px 0;\">\n",
        "      <div style=\"font-size:40px;margin-bottom:4px;\">🏆</div>\n",
        "      <div style=\"font-size:12px;letter-spacing:2px;color:#FEF08A;font-weight:800;\">DEBUG CLEAR</div>\n",
        "      <div style=\"font-size:20px;font-weight:900;margin:6px 0;\">{_esc(name)} 破關成功</div>\n",
        "      <div style=\"background:rgba(0,0,0,0.22);border-radius:10px;padding:8px 12px;font-size:13px;margin-top:8px;\">\n",
        "        {_esc(message)}\n",
        "      </div>\n",
        "    </div>\n",
        "    \"\"\"\n",
        "    display(HTML(markup))\n",
        "\n",
        "display(HTML(f\"\"\"\n",
        "<div style=\"font-family:{_FONT};display:inline-block;background:#DCFCE7;color:#166534;\n",
        "            border:1.5px solid #4ADE80;border-radius:999px;padding:6px 16px;font-weight:700;font-size:14px;\">\n",
        "  ✅ 卡片工具已載入，可以往下執行。\n",
        "</div>\n",
        "\"\"\"))"
      ]
    },
    {
      "cell_type": "markdown",
      "id": "w1-m1-md",
      "metadata": {},
      "source": [
        "## 1. 手搖飲貼紙\n",
        "在右邊改成你的名字，並在 `drinks` 裡多加 1 杯飲料，按 ▶️ 執行。"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "id": "w1-m1-code",
      "metadata": {},
      "outputs": [],
      "source": [
        "#@title 手搖飲貼紙\n",
        "my_name = \"同學\" #@param {type:\"string\"}\n",
        "\n",
        "# 試著在清單多加 1 杯你愛喝的飲料\n",
        "drinks = [\n",
        "    \"珍珠奶茶\",\n",
        "    \"四季春青茶\",\n",
        "    \"多多綠茶\",\n",
        "    \"烏龍鮮奶茶\",\n",
        "    \"百香雙響炮\",\n",
        "]\n",
        "\n",
        "sugars = [\"無糖\", \"微糖\", \"半糖\", \"正常糖\"]\n",
        "ices = [\"去冰\", \"微冰\", \"少冰\"]\n",
        "\n",
        "show_drink_sticker(\n",
        "    name=my_name,\n",
        "    drink=random.choice(drinks),\n",
        "    sugar=random.choice(sugars),\n",
        "    ice=random.choice(ices),\n",
        ")"
      ]
    },
    {
      "cell_type": "markdown",
      "id": "w1-m2-md",
      "metadata": {},
      "source": [
        "## 2. 運勢卡填空\n",
        "把程式碼裡兩個 `\"___\"` 換成自己的內容，按 ▶️ 產生卡片。"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "id": "w1-m2-code",
      "metadata": {},
      "outputs": [],
      "source": [
        "#@title 運勢卡填空\n",
        "my_name = \"同學\" #@param {type:\"string\"}\n",
        "level = \"🌟 大吉\" #@param [\"🌟 大吉\", \"✨ 中吉\", \"🍀 小吉\", \"🔥 超級歐皇\"]\n",
        "score = 95 #@param {type:\"slider\", min:0, max:100, step:1}\n",
        "lucky_color = \"燦爛金\" #@param {type:\"string\"}\n",
        "\n",
        "# 把下面的 \"___\" 換成自己的內容\n",
        "lucky_item = \"___\"\n",
        "message = \"___\"\n",
        "\n",
        "show_fortune_card(my_name, level, score, lucky_color, lucky_item, message)"
      ]
    },
    {
      "cell_type": "markdown",
      "id": "w1-m3-md",
      "metadata": {},
      "source": [
        "## 3. 十連抽運勢機\n",
        "先按 ▶️ 抽一次，接著試著改兩個地方：\n",
        "1. 把 `\"SSR\": 5` 改成 `\"SSR\": 80`\n",
        "2. 在 `CARD_POOL` 的 `\"SSR\"` 裡多加一張自己的卡"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "id": "w1-m3-code",
      "metadata": {},
      "outputs": [],
      "source": [
        "#@title 十連抽運勢機\n",
        "player_name = \"小明\" #@param {type:\"string\"}\n",
        "draw_mode = \"十連抽（保底 SR 以上）\" #@param [\"單抽\", \"十連抽（保底 SR 以上）\"]\n",
        "\n",
        "# 改動 1：把 \"SSR\": 5 改成 80\n",
        "RARITY_WEIGHTS = {\n",
        "    \"SSR\": 5,\n",
        "    \"SR\": 20,\n",
        "    \"R\": 45,\n",
        "    \"N\": 30,\n",
        "}\n",
        "\n",
        "# 改動 2：在 \"SSR\" 裡多加一張自己的卡\n",
        "CARD_POOL = {\n",
        "    \"SSR\": [\n",
        "        {\"name\": \"早八奇蹟準時卡\", \"desc\": \"不管鬧鐘響幾次，今天都能準時出現！\"},\n",
        "        {\"name\": \"老師提前下課卡\", \"desc\": \"今天提早收工不是夢！\"},\n",
        "        {\"name\": \"發票中獎歐皇卡\", \"desc\": \"今天買東西或抽獎特別容易遇到驚喜！\"},\n",
        "    ],\n",
        "    \"SR\": [\n",
        "        {\"name\": \"手搖飲免排隊卡\", \"desc\": \"別人大排長龍，你一到就輪到你！\"},\n",
        "        {\"name\": \"神隊友降臨卡\", \"desc\": \"分組報告遇到超罩夥伴！\"},\n",
        "        {\"name\": \"出門一路綠燈卡\", \"desc\": \"公車捷運剛好進站，通勤超順！\"},\n",
        "    ],\n",
        "    \"R\": [\n",
        "        {\"name\": \"微糖少冰剛剛好卡\", \"desc\": \"平穩舒服的一天。\"},\n",
        "        {\"name\": \"手機電量超持久卡\", \"desc\": \"續航力滿滿，今天穩穩把事做完！\"},\n",
        "        {\"name\": \"午休秒睡回血卡\", \"desc\": \"小睡 15 分鐘就滿血復活！\"},\n",
        "    ],\n",
        "    \"N\": [\n",
        "        {\"name\": \"襪子少一隻卡\", \"desc\": \"可能會遇到一點小烏龍，笑一笑就過了！\"},\n",
        "        {\"name\": \"想吃的剛好賣完卡\", \"desc\": \"換個口味試試看！\"},\n",
        "        {\"name\": \"滑手機忘記時間卡\", \"desc\": \"滑完這支影片就去做正事吧！\"},\n",
        "    ],\n",
        "}\n",
        "\n",
        "run_gacha(player_name, draw_mode, RARITY_WEIGHTS, CARD_POOL)"
      ]
    },
    {
      "cell_type": "markdown",
      "id": "w1-m4-md",
      "metadata": {},
      "source": [
        "## 4. Debug 練習（直接用 AI 修）\n",
        "下面 3 格都有 Bug。按 ▶️ 出現紅字後，直接點 **「解釋錯誤（Explain error）」**，或把程式碼和錯誤訊息貼給 AI 問怎麼改。"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "id": "w1-m4-bug1",
      "metadata": {},
      "outputs": [],
      "source": [
        "#@title 第 1 關\n",
        "lucky_card = \"大吉：今天寫程式一次就過！\n",
        "print(\"你抽到了：\", lucky_card)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "id": "w1-m4-bug2",
      "metadata": {},
      "outputs": [],
      "source": [
        "#@title 第 2 關\n",
        "import random\n",
        "\n",
        "fortune_pool = [\"大吉\", \"中吉\", \"小吉\"]\n",
        "result = random.choice(fortunepool)\n",
        "print(\"今日抽卡結果：\", result)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "id": "w1-m4-bug3",
      "metadata": {},
      "outputs": [],
      "source": [
        "#@title 第 3 關（修好會出現破關卡）\n",
        "my_name = \"同學\"\n",
        "clear_score = 100\n",
        "msg = \"恭喜破關！獲得 \" + clear_score + \" 分！\"\n",
        "\n",
        "show_clear_badge(my_name, msg)"
      ]
    },
    {
      "cell_type": "markdown",
      "id": "w1-m4-hints",
      "metadata": {},
      "source": [
        "<details>\n",
        "<summary>提示</summary>\n",
        "\n",
        "- 第 1 關：字串尾巴少了一個 `\"`。\n",
        "- 第 2 關：`fortune_pool` 和 `fortunepool` 差了一個底線 `_`。\n",
        "- 第 3 關：文字不能直接 `+` 數字，改成 `f\"恭喜破關！獲得 {clear_score} 分！\"`。\n",
        "\n",
        "</details>"
      ]
    },
    {
      "cell_type": "markdown",
      "id": "w1-m5-md",
      "metadata": {},
      "source": [
        "## 5. 用 AI 做一個新的卡片工具\n",
        "把下面任一段 Prompt 貼給 ChatGPT / Gemini（或自己換主題），把產出的程式碼貼到下面這格執行。\n",
        "\n",
        "- **塔羅三張牌**：「寫一段能在 Google Colab 跑的 Python（只用內建套件和 IPython.display.HTML），不重複抽 3 張塔羅牌（過去／現在／未來）含正逆位解讀，用橫排卡片畫出來。」\n",
        "- **電影／動漫推薦**：「寫一段能在 Google Colab 跑的 Python（只用內建套件和 IPython.display.HTML），隨機推薦 1 部片並畫成電影票根卡片，最上方片單加中文註解讓我改。」\n",
        "- **聚會抽籤機**：「寫一段能在 Google Colab 跑的 Python（只用內建套件和 IPython.display.HTML），最上方可填朋友名單，隨機抽 1 個人和 1 個挑戰任務，畫成一張任務卡。」\n",
        "\n",
        "跑出第一版後，再對 AI 追問 1～2 次改版（例如：換成暗黑／粉紅配色、加上 `#@param` 選單、或改成連抽 3 張）。"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "id": "w1-m5-code",
      "metadata": {},
      "outputs": [],
      "source": [
        "#@title 把 AI 產出的程式碼貼在這裡\n",
        "# 把這行刪掉，貼上 AI 寫的程式碼後按 ▶️"
      ]
    }
  ]
}