Skip to content

みほんに「きをかく」を足し、各みほんに絵文字をつける #45 - #47

Merged
temoki merged 2 commits into
mainfrom
feature/45-fractal-sample
Aug 11, 2026
Merged

みほんに「きをかく」を足し、各みほんに絵文字をつける #45#47
temoki merged 2 commits into
mainfrom
feature/45-fractal-sample

Conversation

@temoki

@temoki temoki commented Aug 11, 2026

Copy link
Copy Markdown
Owner

#45 の設計コメントで決めた 3 点(起動画面には出さない / 名前は「き」/ いろとふとさを含む)+ 絵文字つきラベルで実装しました。

入れたもの

  • SampleBlocks.fractalTree() — 再帰する木。ペン(みどり・2)→ はこ 🌟 = 70 → よぶ き → つくる き(もし 🌟 > 6 なら …)
  • SampleBlocksTests に決定的な期待値
  • 空状態に 4 つ目のボタン。あわせて 各みほんに絵文字(🟦 ⭐️ 🌀 🌳)
  • ja 文字列 1 件(Sample: Tree → サンプル: きをかく)

実測値

  • 157 コマンド(ペン 2 + 枝 31 本 × 5)、5 段、ネストの深さ 11(上限 30)
  • 最後のコマンドが forward(-70) = いちばん外側の呼び出しが自分の幹を戻りきる。はこ 1 個で足りることがこれで固定されます(関数ブロック(マイブロック) #14 がパラメータなしで妥当だった根拠)
  • ステップ上限 10,000 に対しても十分小さいので、みほん自体が上限に触れることはありません

絵文字の入れかた

絵文字はテキストではなく絵として扱っています。どの言語でも同じものなので Text(verbatim:) のアイコンとして渡し、文字列カタログには入れていませんLabel { Text(title) } icon: { Text(verbatim: emoji) })。ラベル自体は既存の 3 つも含めて SampleButton に集約しました。

確認

  • swift test 119 tests green、両ビルド green、swift format lint --strict clean
  • iPad ポートレート: 4 つが縦に並び、絵文字とタイトルの左端が揃う。下に余白も残る(レイアウト変更は不要でした)
  • macOS: 等幅のボタンが 4 つ、絵文字つきで中央揃え

ひとつ相談

絵文字が付いたことで 「サンプル:」の接頭辞が冗長に見えます(🌳 サンプル: きをかく)。絵文字がその役目を果たしているので、

  • 🟦 しかくをぬる
  • ⭐️ ほしをかく
  • 🌀 うずまきをかく
  • 🌳 きをかく

と短くする手もあります。既存 3 つの文字列を変えることになるので、この PR では触っていません。好みを聞かせてください。

Fixes #45

The empty workspace could start you on a square, a star or a spiral,
and none of them used a box, an if, or a block of your own — so the one
feature that needs seeing to be believed had no way in but building it
yourself. 🌳 is that way in: a block that calls itself, stopped by an if,
five levels and 31 branches.

It is also the argument for the shape #14 took. The box is scaled on the
way into each call and divided back out on the way out, so a single
global box is enough — the test pins that by checking the last command
is forward(-70), the outermost call retracing the trunk it drew. A first
release without parameters is not a compromise if this is what fits in
it.

Every sample now wears the picture it draws — 🟦 ⭐️ 🌀 🌳. The emoji is
artwork rather than text: it is the same in every language, so it goes
in as a verbatim icon and the string catalog never sees it.

Fixes #45
Four buttons that all began with 「サンプル:」 were four labels a child
had to read past to reach the word that differs. The word moves to a
caption above the list, where it is said once, and the names shorten to
しかくをぬる / ほしをかく / うずまきをかく / きをかく — each now telling
its own drawing apart from the first character.

The old keys retire rather than linger: they had no call site left, and
a string catalog full of stale entries is a worse record than none.
@temoki

temoki commented Aug 11, 2026

Copy link
Copy Markdown
Owner Author

🌳 を押して木が描けることを @temoki が確認済み。#45 の受け入れ条件はこれで全部埋まりました(未チェック 0 件)。

  • swift test 119 tests green / 両ビルド green / swift format lint --strict clean
  • 「サンプル」を見出しに移してラベルを短縮(4 つの名前が 1 文字目から違うようになりました)

@temoki
temoki merged commit 005ff04 into main Aug 11, 2026
6 checks passed
@temoki
temoki deleted the feature/45-fractal-sample branch August 11, 2026 02:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

「みほん」にフラクタルの木を足す(じぶんのブロックの見本)

1 participant