Repository navigation
feat: show Wondrous Tails odds now and after a reset beside a full-width board, mark finished lines and make clearing undoable (UX Phase 3c-B) - #67
Merged
Conversation
…he card fills up, now and after a reset - 原因:設計要列出「至少 1/2/3 條」並和「重置之後」並排比較;計算放在不碰 DOM 的模組才測得到,之後的任務再接上頁面 - 機率:貼了 k 張時,剩下的 9−k 張落在空格的每一種擺法(C(16−k, 9−k) 種)一樣可能;遞迴挑空格,挑滿 9 張就直接數連成幾條線,累加至少 1/2/3 條的擺法數;貼了超過 9 張丟 RangeError - 重置:只有貼 3~7 張時能重置(canReset);重置之後等於隨機的 9 張盤面,常數 6,688/1,208/24 ÷ 11,440 在載入時用同一個列舉算空盤面得到,不另外寫死 - 盤面:連成的線與它們的格子(completedLines)、剛好貼了 3 張的線缺的那一格(nearCells,9 張時不列)、一次給出畫面要畫的 analyze()、百分比格式 formatPercent() - 測試:新增 wondrous-tails-odds.test.js,釘住 11,440/6,688/1,208/24、六個例子盤面、重置的邊界、連線、差一張的格子與百分比格式 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…r count and a one-line description - 原因:天書改成答案在第一個畫面:說明只留一句、盤面用滿寬度、16 格改成按鈕;這個任務先換掉頁面骨架,所以這個 commit 之後頁面暫時不顯示機率,之後的任務再補上 - 頁面:說明只剩「點一格貼上貼紙,再點一次拿掉(最多 9 張)」;盤面卡的標題列寫「已貼 N/9 張」;16 格直接寫在 index.html,都是 <button>,用鍵盤的 Enter、空白鍵就能貼上與拿掉,不再自己聽 keydown - 拿掉:連線機率面板與建議文字、還原/重做(不再載入 state-history-manager.js)、紅色的「重置盤面」;貼滿 9 張時其他的空格改成不能點(disabled),不再跳「最多只能放置 9 個物件」的 toast,toggle() 自己也不讓第 10 張貼上去 - 版面:盤面用滿卡片的寬度(四欄一樣寬、格子正方形、間距 12px);已貼的格子不再設 box-shadow,不然會蓋掉共用的焦點外框,用鍵盤時看不到焦點在哪一格 - 翻譯:改 wondrous_tails_desc、新增 wondrous_tails_count,三語各拿掉 18 個不再用的鍵 - 測試:新增 wondrous-tails-page.test.js 與頁面替身 tests/helpers/wondrous-page.js(作法照 cactpot-page.js);design-system.test.js 的「格子都能用 Tab 鍵移動焦點」改成檢查天書的 16 個 <button> Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…eset next to the board - 原因:站長想知道連線機率的分布、自己決定要不要重置;上一個 commit 之後頁面不顯示機率,這個 commit 把 tails-odds.js 算出來的結果畫在盤面旁邊 - 機率卡:盤面卡後面多一張卡,表格每一列是「至少 1/2/3 條」,欄是「現在」與「重置之後」;重置之後只在貼 3~7 張時有數字,其他時候寫「—」;數字照 formatPercent()(0 寫 0%、≥ 99.995% 寫 100%、≥ 1% 一位小數、其他兩位小數) - 長條:每一列兩條,長度就是機率(寫「—」時長度 0),「現在」用主色、「重置之後」用灰色,數字與長條都不用好壞配色;長條 aria-hidden,名稱與數字照表格唸,table、tr、th、td 的 display 不動 - 版面:手機在盤面下面,名稱與長條左右排,放不下時長條換到名稱下面;電腦(768px 以上)兩欄,盤面 26rem、機率卡 22rem - 實作:render() 開頭呼叫 analyze(),張數也改用 view.placed;三列在建構子收好,重畫只改文字與長條長度;表頭與名稱是 data-i18n,三語各新增 5 個鍵 - 測試:頁面替身加 odds()、header();新增 0 張、3~7 張的邊界、例子盤面、貼滿 9 張、切換語言與版面的測試;另外補上 toggle() 自己擋盤面外的位置與第 10 張的測試(原本只靠格子的 disabled 擋下來,現在 render() 會呼叫 analyze(),超過 9 張會丟 RangeError) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ould finish one - 原因:盤面上看不出哪幾格已經連成線、貼哪一格就會連成;機率表只有數字,要自己在盤面上一條一條數 - 綠框:連成的線上每一格外面加 3px 的綠色 outline(離格子 3px);用 outline 而不是 box-shadow,才不會蓋掉共用的 .cell:focus-visible 用 box-shadow 畫的焦點外框,用鍵盤時連成的線上的格子也看得到焦點 - 虛線框:只差一張的空格(某條線剛好貼了 3 張)加 2px 的綠色虛線框,同一格補齊兩條線只標一次;顏色和連成的線一樣,意思是「貼了就連成」,不用草稿的黃色,它在白底上的對比只有約 2.2:1 - 貼滿 9 張時不標虛線框(空格不能再貼),拿掉一張後標回來;線斷掉時綠框跟著拿掉 - 螢幕閱讀器:格子名稱也寫出來,連成的線寫「第 N 格:已連成線」、差一張的空格寫「第 N 格:貼了就連成線」,三語各新增 2 個鍵;不加圖例 - 共用樣式:tools-common.css 的 .cell.suggested 註解拿掉「之後天書的連線」,天書不用它(它會把主色底換成淡綠色,看不出貼了貼紙),規則本身不動 - 測試:頁面替身加 doneCells()、nearCells();新增 7 個測試,涵蓋線上 4 格、只差一張、同一格補齊兩條線只標一次與兩種標示同時出現、9 張時不標、拿掉一張讓線斷掉、切換語言,以及樣式(綠框用 outline 且不含 box-shadow、虛線框用 --color-success、頁面沒有圖例) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…if that was a mistake - 原因:紅色的「重置盤面」跟遊戲的重置同名,按了卻只是清空工具上的盤面,而且按錯了救不回來 - 改名:叫「清空盤面」(Clear board、盤面をクリア),「重置」留給遊戲的重置(機率表的「重置之後」) - 一般按鈕:.btn.btn-sm,不再是紅色;放在盤面卡標題列的右邊、張數的對面,標題列本來就留了一顆小按鈕的高度,盤面不會跳動 - 空的時候不能按:盤面沒有貼紙、也沒有可以復原的盤面時 disabled(只有拿掉最後一張貼紙才會這樣,這時焦點在格子上) - 復原:清空時先存一份清空前的盤面,同一顆按鈕就地變成「復原」,再按一次放回去(9 張時其他空格不能點、連線框都和清空前一樣);不跳 toast,焦點留在按鈕上 - 貼新的一格:清空之後貼上或拿掉任何一張貼紙,就不能再復原,按鈕變回「清空盤面」 - 翻譯:新增 wondrous_tails_clear、wondrous_tails_restore,三語各 2 個鍵;兩種文字會切換,所以由 render() 寫,不用 data-i18n - 測試:頁面替身加 clearButton();新增 6 個測試,涵蓋按鈕的位置與一開始不能按、清空後變「復原」且焦點不動不跳 toast、復原後盤面與連線框和不能點的空格照原樣、貼新的一格後不能再復原、一張一張拿掉到空時不能按、切換語言 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…nd CLAUDE.md - 原因:天書奇談改版(UX 第 3c 階段 PR B)完成,更新修改紀錄與開發文件 - changelog:v2.25.0 - README:天書奇談的功能、測試數量與頁面替身 - CLAUDE.md:檔案統計、兩份新測試與頁面替身、天書奇談的說明 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
ff14-tw-treasure | 1ca17a8 | Oct 20 2026, 09:25 PM |
There was a problem hiding this comment.
🟡 Changes recommended
Mixed cached HTML and controller versions can prevent initialization, so deployment needs a cache-safe asset strategy.
1 open issue
What changed in this PR
Updates FF14.tw’s Wondrous Tails tool to show odds alongside the board, without API changes.
Changes:
- Extracts probability calculations into a DOM-independent module.
- Adds current/reset odds, line highlights, and undoable clearing.
- Updates translations, tests, and documentation.
| File | Description |
|---|---|
| tools/wondrous-tails/tails-odds.js | Calculates odds and line states. |
| tools/wondrous-tails/style.css | Adds responsive board and odds styling. |
| tools/wondrous-tails/script.js | Handles board interactions and rendering. |
| tools/wondrous-tails/index.html | Adds button cells and odds table. |
| tests/wondrous-tails-page.test.js | Covers interactions, translations, and layout rules. |
| tests/wondrous-tails-odds.test.js | Covers probability calculations. |
| tests/helpers/wondrous-page.js | Adds a page-testing helper. |
| tests/design-system.test.js | Checks board buttons’ keyboard accessibility. |
| README.md | Documents the redesigned tool. |
| CLAUDE.md | Updates architecture and testing documentation. |
| changelog.html | Adds release notes. |
| assets/js/i18n/translations/tools/wondrous-tails.js | Updates Chinese, English, and Japanese text. |
| assets/css/tools-common.css | Corrects a shared-style comment only. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

摘要
這是 UX 改版第 3c 階段的 PR B:天書奇談改成「答案在第一個畫面」。只改網站,沒有改 API。
另外:
docs/superpowers/specs/2026-10-20-ux-phase3c-minigames-design.md(未 commit;站長 10/20 核准;3c-B 是 §2 B1–B7、§6.3、§6.5)變更
tools/wondrous-tails/tails-odds.js,0f78fb2):WondrousTailsOdds,不碰 DOM。3cafa94):index.html,都是<button>,鍵盤用 Enter 或空白鍵。disabled,不再跳 toast;toggle()自己也擋第 10 張。state-history-manager.js)和紅色的重置。box-shadow:main 上這條規則會蓋掉共用的焦點外框,用鍵盤時看不到焦點在哪一格(Chrome 確認過)。tests/helpers/wondrous-page.js。49512f5):8847deb):outline(offset 3px,不蓋掉焦點外框)。d26c50d):1ca17a8):修改紀錄 v2.25.0、README、CLAUDE.md。和設計、計畫不同之處
--color-warning)在白底上的對比只有約 2.2:1;綠色和連成的線是同一個意思。toggle()不會讓「復原」消失:計畫寫「一開始就清掉可復原的盤面」,但照字面寫的話,清空之後的盤面會救不回來。實作者發現這點,審查者用突變確認過。驗證
node --test從 1134 個增加到 1174 個,6 個 commit 每個單獨跑都通過(1144、1153、1160、1167、1174、1174)。1ca17a8沒有意見。Copilot 開 1 則:部署時新舊 HTML/JS 混用。照 3b 決定的作法用 Cloudflare 的設定處理,不改程式;設定已改好,已回覆並 resolve。合併前待確認
max-age=600(原本 JS/CSS 是 4 小時)。改設定之前存進瀏覽器的舊檔最晚 08:14 UTC(台灣時間 16:14)過期;在那之後合併,新舊檔案錯開的時間最多大約 10 分鐘。後續(不在本 PR)
width: 100%大約可以加長一倍。aria-live。toggle()不清掉復原、空盤面呼叫clearOrRestore()。LINES有沒有凍結、表格的結構、CSS 的載入順序。🤖 Generated with Claude Code