Skip to content

Conversation

@takaokouji
Copy link

@takaokouji takaokouji commented Jan 16, 2026

Summary

MicroBit More拡張機能のIssue #20 に関する以下の実装を行いました:

  1. 日本語ラベルの修正(前回のコミット)
  2. 傾き・ピン接続ブロックとRubyの相互変換(今回のコミット)

Implementation Details

Task 3A: Label changes (previous commit)

  • Changed tilt gesture labels from "へ傾いた" to "に傾いた" pattern
  • Updated both ja.js and ja-Hira.js locale files

Ruby Conversion (this commit)

Block to Ruby Conversions

ブロック Ruby
ピン [0] がつながったとき microbit_more.when_pin_connected(0)
[動いた] とき microbit_more.when("moved")
[どれかの向きに傾いた] とき microbit_more.when("tilted_any")
[前/後ろ/左/右に傾いた] とき microbit_more.when("tilted_front/back/left/right")
[どれかの向き] に傾いた microbit_more.tilted?("any")
[前] 方向の傾き microbit_more.tilt_angle("front")

Snippet Updates

  • microbit_more.button_pressed?: description を「ボタン [A▼] が押された」に修正
  • microbit_more.when: デフォルト値を "shake" → "moved" に変更、description を「[動いた▼] とき」に修正
  • 新規追加: when_pin_connected, tilted?, tilt_angle

Test Coverage

  • Unit tests: test/unit/lib/ruby-generator/microbit_more.test.js
  • Unit tests: test/unit/lib/ruby-to-blocks-converter/microbit_more.test.js
  • Integration test: test/integration/ruby-tab/extension_microbit_more.test.js
# Run tests
docker compose run --rm gui bash -c "cd /app/gui/smalruby3-gui && npm exec jest test/unit/lib/ruby-generator/microbit_more.test.js test/unit/lib/ruby-to-blocks-converter/microbit_more.test.js"
docker compose run --rm gui bash -c "cd /app/gui/smalruby3-gui && npm run build && npm exec jest test/integration/ruby-tab/extension_microbit_more.test.js"

Related

Fixes smalruby/smalruby3-develop#20

🤖 Generated with Claude Code

takaokouji and others added 2 commits January 16, 2026 17:45
…nsion

Update Japanese translations for tilt gestures to use "に" instead of "へ":
- "上へ傾いた" → "上に傾いた"
- "下へ傾いた" → "下に傾いた"
- "左へ傾いた" → "左に傾いた"
- "右へ傾いた" → "右に傾いた"

This aligns the MicroBit More extension labels with the original microbit
extension for consistency.

Refs smalruby/smalruby3-develop#20

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Implement bidirectional conversion between MicroBit More blocks and Ruby:

Block to Ruby conversions:
- whenPinConnected: microbit_more.when_pin_connected(pin)
- whenGesture(MOVED): microbit_more.when("moved")
- whenGesture(TILTED): microbit_more.when("tilted_any")
- whenGesture(TILT_UP/DOWN/LEFT/RIGHT): microbit_more.when("tilted_front/back/left/right")
- isTilted: microbit_more.tilted?(direction)
- getTiltAngle: microbit_more.tilt_angle(direction)

Ruby to Block conversions:
- All above conversions work bidirectionally

Snippet updates:
- Updated button_pressed? description to match block label
- Changed default gesture from "shake" to "moved"
- Added snippets for when_pin_connected, tilted?, tilt_angle

Fixes #20

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@takaokouji takaokouji changed the title feat: update MicroBit More tilt gesture labels (Issue #20 Task 3A) feat: add MicroBit More tilt/pin Ruby conversion (Issue #20) Jan 16, 2026
- Updated package-lock.json to reference latest scratch-vm changes
- Ensures compatibility with recent scratch-vm modifications

🤖 Generated with [Gemini Code](https://gemini.google.com/code)

Co-Authored-By: Gemini <noreply@google.com>
@takaokouji takaokouji merged commit c99137e into develop Jan 16, 2026
3 checks passed
@takaokouji takaokouji deleted the feature/issue-20-tilt-blocks branch January 16, 2026 21:53
github-actions bot pushed a commit that referenced this pull request Jan 16, 2026
…-20-tilt-blocks

feat: add MicroBit More tilt/pin Ruby conversion (Issue #20)
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.

MicrobitMore拡張機能の命令ブロックをMicrobit拡張機能と合わせる

2 participants