smalruby-editor 0.2.4-x86-mingw32 → 0.2.5-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of smalruby-editor might be problematic. Click here for more details.

Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +8 -0
  3. data/Guardfile +8 -1
  4. data/app/assets/javascripts/blocks/hardware.js.coffee.erb +11 -152
  5. data/app/assets/javascripts/msg/en_us.js +5 -5
  6. data/app/assets/javascripts/msg/ja.js +5 -5
  7. data/app/assets/javascripts/views/signin_modal_view.js.coffee.erb +0 -0
  8. data/app/controllers/sessions_controller.rb +0 -0
  9. data/app/helpers/sessions_helper.rb +4 -0
  10. data/app/models/concerns/ruby_to_block/block/hardware_operation.rb +11 -0
  11. data/app/models/concerns/ruby_to_block/block/{hardware_smalrubot_s1_led_turn_on_or_off.rb → hardware_smalrubot_action.rb} +8 -5
  12. data/app/models/concerns/ruby_to_block/block/hardware_smalrubot_action_with_sec.rb +25 -0
  13. data/app/models/concerns/ruby_to_block/block/{hardware_smalrubot_v3_motor_speed.rb → hardware_smalrubot_dc_motor_power_ratio.rb} +8 -5
  14. data/app/models/concerns/ruby_to_block/block/hardware_smalrubot_dc_motor_set_power_ratio.rb +23 -0
  15. data/app/models/concerns/ruby_to_block/block/{hardware_smalrubot_v3_led_turn_on_or_off.rb → hardware_smalrubot_led_turn_on_or_off.rb} +8 -5
  16. data/app/models/concerns/ruby_to_block/block/{hardware_smalrubot_s1_ir_photoreflector_value.rb → hardware_smalrubot_sensor_value.rb} +8 -6
  17. data/app/views/editor/_toolbox_default.html.haml +4 -7
  18. data/app/views/editor/index.html.haml +7 -18
  19. data/bin/spring +0 -0
  20. data/config/application.rb +1 -0
  21. data/lib/smalruby_editor/version.rb +1 -1
  22. data/public/assets/{application-eece3e01e35f8f689e2e282a168f6059.js → application-e64da116c4adad30e499acda9d657fb5.js} +9 -9
  23. data/public/assets/application-e64da116c4adad30e499acda9d657fb5.js.gz +0 -0
  24. data/public/assets/{manifest-93f591b19a2a69655db7b53fa00d6b17.json → manifest-beef6aec1f5553cda5a2fe11ef0774ea.json} +1 -1
  25. data/public/assets/msg/{en_us-3eb2f104a6bad9c60226ff7475013874.js → en_us-a3f6b99f4b54cfaeed42452de11ab02e.js} +1 -1
  26. data/public/assets/msg/en_us-a3f6b99f4b54cfaeed42452de11ab02e.js.gz +0 -0
  27. data/public/assets/msg/ja-9323664964a9b8ede99ae16c43db5827.js +1 -0
  28. data/public/assets/msg/ja-9323664964a9b8ede99ae16c43db5827.js.gz +0 -0
  29. data/smalruby-editor.gemspec +1 -1
  30. data/spec/acceptance/block_mode/blocks/hardware/smalrubot_s1_led_turn_on_or_off.feature +8 -8
  31. data/spec/acceptance/block_mode/blocks/hardware/{smalrubot_v3_motor_speed.feature → smalrubot_v3_dc_motor_power_ratio.feature} +12 -12
  32. data/spec/acceptance/block_mode/blocks/hardware/smalrubot_v3_led_turn_on_or_off.feature +8 -8
  33. data/spec/acceptance/block_mode/blocks/hardware/{smalrubot_s1_ir_photoreflector_value.feature → smalrubot_v3_sensor_value.feature} +7 -7
  34. data/spec/models/concerns/ruby_to_block/block/{hardware__smalrubot_s1_spec.rb → hardware__smalrubot_spec.rb} +88 -84
  35. data/spec/spec_helper.rb +0 -0
  36. data/spec/steps/base_steps.rb +0 -0
  37. data/spec/steps/text_editor_steps.rb +0 -0
  38. metadata +23 -36
  39. data/app/models/concerns/ruby_to_block/block/hardware_smalrubot_s1_action.rb +0 -13
  40. data/app/models/concerns/ruby_to_block/block/hardware_smalrubot_s1_action_with_sec.rb +0 -14
  41. data/app/models/concerns/ruby_to_block/block/hardware_smalrubot_s1_dc_motor_power_ratio.rb +0 -26
  42. data/app/models/concerns/ruby_to_block/block/hardware_smalrubot_s1_dc_motor_set_power_ratio.rb +0 -21
  43. data/app/models/concerns/ruby_to_block/block/hardware_smalrubot_v3_action.rb +0 -22
  44. data/app/models/concerns/ruby_to_block/block/hardware_smalrubot_v3_action_with_sec.rb +0 -24
  45. data/app/models/concerns/ruby_to_block/block/hardware_smalrubot_v3_light_sensor_value.rb +0 -28
  46. data/app/models/concerns/ruby_to_block/block/hardware_smalrubot_v3_motor_set_speed.rb +0 -21
  47. data/app/models/concerns/ruby_to_block/block/hardware_smalrubot_v3_touch_sensor_pressed_or_released.rb +0 -29
  48. data/public/assets/application-eece3e01e35f8f689e2e282a168f6059.js.gz +0 -0
  49. data/public/assets/msg/en_us-3eb2f104a6bad9c60226ff7475013874.js.gz +0 -0
  50. data/public/assets/msg/ja-8450d011b1f093dc4b6b7c467e5bcae4.js +0 -1
  51. data/public/assets/msg/ja-8450d011b1f093dc4b6b7c467e5bcae4.js.gz +0 -0
  52. data/spec/acceptance/block_mode/blocks/hardware/smalrubot_v3_light_sensor_value.feature +0 -92
  53. data/spec/acceptance/block_mode/blocks/hardware/smalrubot_v3_touch_sensor_pressed_or_released.feature +0 -108
  54. data/spec/models/concerns/ruby_to_block/block/hardware__smalrubot_v3_spec.rb +0 -433
@@ -1,13 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- module RubyToBlock
3
- module Block
4
- class HardwareSmalrubotS1Action < HardwareSmalrubotV3Action
5
- # rubocop:disable LineLength
6
- blocknize '^\s*' + CHAR_RE +
7
- 'smalrubot_s1\.' + ACTION_RE +
8
- '\s*$',
9
- statement: true, inline: true
10
- # rubocop:enable LineLength
11
- end
12
- end
13
- end
@@ -1,14 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- module RubyToBlock
3
- module Block
4
- class HardwareSmalrubotS1ActionWithSec < HardwareSmalrubotV3ActionWithSec
5
- # rubocop:disable LineLength
6
- blocknize '^\s*' + CHAR_RE +
7
- 'smalrubot_s1\.' + ACTION_RE +
8
- '\(\s*sec:\s*(\d+(?:\.\d+)?)\)' +
9
- '\s*$',
10
- statement: true, inline: true
11
- # rubocop:enable LineLength
12
- end
13
- end
14
- end
@@ -1,26 +0,0 @@
1
- module RubyToBlock
2
- module Block
3
- class HardwareSmalrubotS1DcMotorPowerRatio < Value
4
- include CharacterOperation
5
- include HardwareOperation
6
-
7
- blocknize '^\s*' + CHAR_RE +
8
- 'smalrubot_s1\.' +
9
- LOR_RE + '_dc_motor_power_ratio\s*$',
10
- value: true
11
-
12
- def self.process_match_data(md, context)
13
- md2 = regexp.match(md[type])
14
-
15
- character = get_character(context, md2[1])
16
- return false if context.receiver && context.receiver != character
17
-
18
- block = new(fields: { LOR: md2[2] })
19
- context.add_value(block)
20
- block.character = character
21
-
22
- true
23
- end
24
- end
25
- end
26
- end
@@ -1,21 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- module RubyToBlock
3
- module Block
4
- class HardwareSmalrubotS1DcMotorSetPowerRatio < CharacterMethodCall
5
- include HardwareOperation
6
-
7
- blocknize '^\s*' + CHAR_RE +
8
- 'smalrubot_s1\.' +
9
- LOR_RE + '_dc_motor_power_ratio\s*=\s*(\S+)\s*$',
10
- statement: true, inline: true
11
-
12
- def self.process_match_data(md, context)
13
- md2 = regexp.match(md[type])
14
- add_character_method_call_block(context, md2[1],
15
- new(fields: { LOR: md2[2] }),
16
- SPEED: md2[3])
17
- true
18
- end
19
- end
20
- end
21
- end
@@ -1,22 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- module RubyToBlock
3
- module Block
4
- class HardwareSmalrubotV3Action < CharacterMethodCall
5
- include HardwareOperation
6
-
7
- # rubocop:disable LineLength
8
- blocknize '^\s*' + CHAR_RE +
9
- 'smalrubot_v3\.' + ACTION_RE +
10
- '\s*$',
11
- statement: true, inline: true
12
- # rubocop:enable LineLength
13
-
14
- def self.process_match_data(md, context)
15
- md2 = regexp.match(md[type])
16
- add_character_method_call_block(context, md2[1],
17
- new(fields: { ACTION: md2[2] }))
18
- true
19
- end
20
- end
21
- end
22
- end
@@ -1,24 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- module RubyToBlock
3
- module Block
4
- class HardwareSmalrubotV3ActionWithSec < CharacterMethodCall
5
- include HardwareOperation
6
-
7
- # rubocop:disable LineLength
8
- blocknize '^\s*' + CHAR_RE +
9
- 'smalrubot_v3\.' + ACTION_RE +
10
- '\(\s*sec:\s*(\d+(?:\.\d+)?)\)' +
11
- '\s*$',
12
- statement: true, inline: true
13
- # rubocop:enable LineLength
14
-
15
- def self.process_match_data(md, context)
16
- md2 = regexp.match(md[type])
17
- add_character_method_call_block(context, md2[1],
18
- new(fields: { ACTION: md2[2] }),
19
- SEC: md2[3])
20
- true
21
- end
22
- end
23
- end
24
- end
@@ -1,28 +0,0 @@
1
- module RubyToBlock
2
- module Block
3
- class HardwareSmalrubotV3LightSensorValue < Value
4
- include CharacterOperation
5
-
6
- # rubocop:disable LineLength
7
- blocknize '^\s*' + CHAR_RE +
8
- 'smalrubot_v3\.' +
9
- 'light_sensor\.value' +
10
- '\s*$',
11
- value: true
12
- # rubocop:enable LineLength
13
-
14
- def self.process_match_data(md, context)
15
- md2 = regexp.match(md[type])
16
-
17
- character = get_character(context, md2[1])
18
- return false if context.receiver && context.receiver != character
19
-
20
- block = new
21
- context.add_value(block)
22
- block.character = character
23
-
24
- true
25
- end
26
- end
27
- end
28
- end
@@ -1,21 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- module RubyToBlock
3
- module Block
4
- class HardwareSmalrubotV3MotorSetSpeed < CharacterMethodCall
5
- include HardwareOperation
6
-
7
- blocknize '^\s*' + CHAR_RE +
8
- 'smalrubot_v3\.' +
9
- LOR_RE + '_motor_speed\s*=\s*(\S+)\s*$',
10
- statement: true, inline: true
11
-
12
- def self.process_match_data(md, context)
13
- md2 = regexp.match(md[type])
14
- add_character_method_call_block(context, md2[1],
15
- new(fields: { LOR: md2[2] }),
16
- SPEED: md2[3])
17
- true
18
- end
19
- end
20
- end
21
- end
@@ -1,29 +0,0 @@
1
- module RubyToBlock
2
- module Block
3
- class HardwareSmalrubotV3TouchSensorPressedOrReleased < Value
4
- include CharacterOperation
5
- include HardwareOperation
6
-
7
- # rubocop:disable LineLength
8
- blocknize '^\s*' + CHAR_RE +
9
- 'smalrubot_v3\.' +
10
- LOR_RE + '_touch_sensor\.' + POR_RE + '\?' +
11
- '\s*$',
12
- value: true
13
- # rubocop:enable LineLength
14
-
15
- def self.process_match_data(md, context)
16
- md2 = regexp.match(md[type])
17
-
18
- character = get_character(context, md2[1])
19
- return false if context.receiver && context.receiver != character
20
-
21
- block = new(fields: { LOR: md2[2], POR: md2[3] })
22
- context.add_value(block)
23
- block.character = character
24
-
25
- true
26
- end
27
- end
28
- end
29
- end
@@ -1 +0,0 @@
1
- goog.provide("Blockly.Msg.ja.smalruby"),goog.require("Blockly.Msg"),Blockly.Msg.COMMON_TURN_ON="オンにする",Blockly.Msg.COMMON_TURN_OFF="オフにする",Blockly.Msg.COMMON_FORWARD="進める",Blockly.Msg.COMMON_BACKWARD="バックさせる",Blockly.Msg.COMMON_TURN_LEFT="左に曲げる",Blockly.Msg.COMMON_TURN_RIGHT="右に曲げる",Blockly.Msg.COMMON_STOP="止める",Blockly.Msg.COMMON_ERROR="エラー",Blockly.Msg.COLOUR_RED="赤色",Blockly.Msg.COLOUR_GREEN="緑色",Blockly.Msg.COLOUR_BLUE="青色",Blockly.Msg.COLOUR_WHITE="白色",Blockly.Msg.SMALRUBY_WILL_DISAPPER_YOUR_PROGRAM="作成中のプログラムが消えてしまうよ!",Blockly.Msg.VIEWS_MAIN_MENU_VIEW_COMMON_LINES="行",Blockly.Msg.VIEWS_MAIN_MENU_VIEW_COMMON_LETTERS="文字",Blockly.Msg.VIEWS_MAIN_MENU_VIEW_COMMON_COMMA="、",Blockly.Msg.VIEWS_MAIN_MENU_VIEW_COMMON_CONFIRM_OVERWRITE="前に{$filename}という名前でセーブしているけど本当にセーブしますか?\nセーブすると前に作成したプログラムは消えてしまうよ!",Blockly.Msg.VIEWS_MAIN_MENU_VIEW_BLOCK_MODE_BLOCKUI_TITLE="プログラムの変換中",Blockly.Msg.VIEWS_MAIN_MENU_VIEW_BLOCK_MODE_BLOCKUI_MESSAGE="プログラムをブロックに変換しています。",Blockly.Msg.VIEWS_MAIN_MENU_VIEW_BLOCK_MODE_ERROR="ブロックへの変換に失敗しました",Blockly.Msg.VIEWS_MAIN_MENU_VIEW_RUN_BLOCKUI_TITLE="プログラムの実行中",Blockly.Msg.VIEWS_MAIN_MENU_VIEW_RUN_BLOCKUI_MESSAGE="プログラムの画面に切り替えてください。",Blockly.Msg.VIEWS_MAIN_MENU_VIEW_RUN_BLOCKUI_NOTICE="プログラムをセーブ・チェックしてから実行するよ♪<br>Escキーを押すとプログラムが終わります。",Blockly.Msg.VIEWS_MAIN_MENU_VIEW_RUN_ERROR_CANT_RUN="プログラムを実行できませんでした",Blockly.Msg.VIEWS_MAIN_MENU_VIEW_RUN_ERROR_CANCEL_TO_RUN="プログラムの実行をキャンセルしました",Blockly.Msg.VIEWS_MAIN_MENU_VIEW_DOWNLOAD_BLOCKUI_TITLE="プログラムのダウンロード中",Blockly.Msg.VIEWS_MAIN_MENU_VIEW_DOWNLOAD_BLOCKUI_MESSAGE="プログラムをダウンロードしています。",Blockly.Msg.VIEWS_MAIN_MENU_VIEW_DOWNLOAD_SUCCEEDED="ダウンロードしました。<br>ダウンロードしたプログラムは、Windowsだと「ruby {$filename}」、Macだと「rsdl {$filename}」で実行できます。",Blockly.Msg.VIEWS_MAIN_MENU_VIEW_DOWNLOAD_ERROR="ダウンロードできませんでした",Blockly.Msg.VIEWS_MAIN_MENU_VIEW_LOAD_CONFIRM="まだセーブしていないのでロードするとプログラムが消えてしまうよ!\nそれでもロードしますか?",Blockly.Msg.VIEWS_MAIN_MENU_VIEW_SAVE_ERROR_NO_NAME="セーブする前にプログラムに名前をつけてね!",Blockly.Msg.VIEWS_MAIN_MENU_VIEW_SAVE_BLOCKUI_TITLE="プログラムのセーブ中",Blockly.Msg.VIEWS_MAIN_MENU_VIEW_SAVE_BLOCKUI_MESSAGE="プログラムをセーブしています。",Blockly.Msg.VIEWS_MAIN_MENU_VIEW_SAVE_BLOCKUI_NOTICE="プログラムの名前は「{$filename}」です。<br>プログラムはホームディレクトリにセーブします。<br>",Blockly.Msg.VIEWS_MAIN_MENU_VIEW_SAVE_ERROR_MESSAGE="セーブできませんでした",Blockly.Msg.VIEWS_MAIN_MENU_VIEW_SAVE_CANCELED="セーブをキャンセルしました",Blockly.Msg.VIEWS_MAIN_MENU_VIEW_SAVE_SUCCEEDED="セーブしました",Blockly.Msg.VIEWS_MAIN_MENU_VIEW_CHECK_BLOCKUI_TITLE="プログラムのチェック中",Blockly.Msg.VIEWS_MAIN_MENU_VIEW_CHECK_BLOCKUI_MESSAGE="プログラムの文法をチェックしています。",Blockly.Msg.VIEWS_MAIN_MENU_VIEW_CHECK_BLOCKUI_NOTICE="このチェックは簡易的なものですので、<br>プログラムを動かすとエラーが見つかるかもしれません。",Blockly.Msg.VIEWS_MAIN_MENU_VIEW_CHECK_SUCCEEDED="チェックしました",Blockly.Msg.VIEWS_MAIN_MENU_VIEW_CHECK_SUCCEEDED_NOTICE="ただし、プログラムを動かすとエラーが見つかるかもしれません。",Blockly.Msg.VIEWS_MAIN_MENU_VIEW_CHECK_ERROR="チェックできませんでした",Blockly.Msg.VIEWS_MAIN_MENU_VIEW_SIGNOUT_SUCCEEDED="ログアウトしました",Blockly.Msg.VIEWS_MAIN_MENU_VIEW_SIGNOUT_ERROR="ログアウトに失敗しました",Blockly.Msg.VIEWS_MAIN_MENU_VIEW_LOAD_ERROR="{$filename}{$error}",Blockly.Msg.VIEWS_MAIN_MENU_VIEW_LOAD_SUCCEEDED="ロードしました",Blockly.Msg.VIEWS_LOAD_MODAL_VIEW_ERROR="ロードに失敗しました",Blockly.Msg.VIEWS_SIGNIN_MODAL_VIEW_SIGNED_IN="ログインしました",Blockly.Msg.VIEWS_SIGNIN_MODAL_VIEW_ERROR="ログインに失敗しました",Blockly.Msg.BLOCKS_MOTION_MOVE="■%1歩動かす",Blockly.Msg.BLOCKS_MOTION_TURN_RIGHT_DEGREES="■時計回りに%1度回す",Blockly.Msg.BLOCKS_MOTION_TURN_LEFT_DEGREES="■反時計回りに%1度回す",Blockly.Msg.BLOCKS_MOTION_POINT_IN_DIRECTION="■%1 度に向ける",Blockly.Msg.BLOCKS_MOTION_POINT_TOWARDS_MOUSE="■マウスポインターへ向ける",Blockly.Msg.BLOCKS_MOTION_POINT_TOWARDS_CHARACTER="■%1 へ向ける",Blockly.Msg.BLOCKS_MOTION_SET_X_Y="■x座標を %1 、y座標を %2 にする",Blockly.Msg.BLOCKS_MOTION_GO_TO_MOUSE="■マウスポインターへ行く",Blockly.Msg.BLOCKS_MOTION_GO_TO_CHARACTER="■%1 へ行く",Blockly.Msg.BLOCKS_MOTION_CHANGE_X_BY="■x座標を %1 ずつ変える",Blockly.Msg.BLOCKS_MOTION_SET_X="■x座標を %1 にする",Blockly.Msg.BLOCKS_MOTION_CHANGE_Y_BY="■y座標を %1 ずつ変える",Blockly.Msg.BLOCKS_MOTION_SET_Y="■y座標を %1 にする",Blockly.Msg.BLOCKS_MOTION_TURN_IF_REACH_WALL="■もし端に着いたら、跳ね返る",Blockly.Msg.BLOCKS_MOTION_TURN="■跳ね返る",Blockly.Msg.BLOCKS_MOTION_TURN_XY_X="水平(x)",Blockly.Msg.BLOCKS_MOTION_TURN_XY_Y="垂直(y)",Blockly.Msg.BLOCKS_MOTION_TURN_XY="■%1 方向に跳ね返る",Blockly.Msg.BLOCKS_MOTION_SET_ROTATION_STYLE_LEFT_RIGHT="左右のみ",Blockly.Msg.BLOCKS_MOTION_SET_ROTATION_STYLE_NONE="回転しない",Blockly.Msg.BLOCKS_MOTION_SET_ROTATION_STYLE_FREE="自由に回転",Blockly.Msg.BLOCKS_MOTION_SET_ROTATION_STYLE="■回転方法を %1 にする",Blockly.Msg.BLOCKS_MOTION_SELF_X="■x座標",Blockly.Msg.BLOCKS_MOTION_SELF_Y="■y座標",Blockly.Msg.BLOCKS_MOTION_SELF_ANGLE="■向き",Blockly.Msg.BLOCKS_EVENTS_ON_START="♣実行ボタンがクリックされたとき",Blockly.Msg.BLOCKS_EVENTS_ON_KEY_PUSH_OR_DOWN="♣キーボードの %1 が %2 のとき",Blockly.Msg.BLOCKS_EVENTS_ON_CLICK="♣キャラクターがクリックされたとき",Blockly.Msg.BLOCKS_EVENTS_ON_HIT="♣%1 にぶつかったとき",Blockly.Msg.BLOCKS_SENSING_K_UP="↑",Blockly.Msg.BLOCKS_SENSING_K_DOWN="↓",Blockly.Msg.BLOCKS_SENSING_K_LEFT="←",Blockly.Msg.BLOCKS_SENSING_K_RIGHT="→",Blockly.Msg.BLOCKS_SENSING_K_SPACE="スペース",Blockly.Msg.BLOCKS_SENSING_PRESSED="押された",Blockly.Msg.BLOCKS_SENSING_PUSH=Blockly.Msg.BLOCKS_SENSING_PRESSED,Blockly.Msg.BLOCKS_SENSING_UP=Blockly.Msg.BLOCKS_SENSING_PRESSED,Blockly.Msg.BLOCKS_SENSING_HOLD_PRESSED="押され続けている",Blockly.Msg.BLOCKS_SENSING_HOLD_DOWN=Blockly.Msg.BLOCKS_SENSING_HOLD_PRESSED,Blockly.Msg.BLOCKS_SENSING_M_LBUTTON="左ボタン",Blockly.Msg.BLOCKS_SENSING_M_MBUTTON="中ボタン",Blockly.Msg.BLOCKS_SENSING_M_RBUTTON="右ボタン",Blockly.Msg.BLOCKS_SENSING_RELEASED="離された",Blockly.Msg.BLOCKS_SENSING_UP=Blockly.Msg.BLOCKS_SENSING_RELEASED,Blockly.Msg.BLOCKS_SENSING_REACH_WALL="◎端に触れた",Blockly.Msg.BLOCKS_SENSING_INPUT_KEY_PUSH_OR_DOWN_PREFIX="◎キーボードの",Blockly.Msg.BLOCKS_SENSING_INPUT_KEY_PUSH_OR_DOWN_MIDDLE="が",Blockly.Msg.BLOCKS_SENSING_INPUT_KEY_PUSH_OR_DOWN_SUFFIX="",Blockly.Msg.BLOCKS_SENSING_INPUT_MOUSE_PUSH_OR_DOWN_PREFIX="◎マウスの",Blockly.Msg.BLOCKS_SENSING_INPUT_MOUSE_PUSH_OR_DOWN_MIDDLE="が",Blockly.Msg.BLOCKS_SENSING_INPUT_MOUSE_PUSH_OR_DOWN_SUFFIX="",Blockly.Msg.BLOCKS_SENSING_INPUT_MOUSE_POS_X="◎マウスのx座標",Blockly.Msg.BLOCKS_SENSING_INPUT_MOUSE_POS_Y="◎マウスのy座標",Blockly.Msg.BLOCKS_SENSING_HIT_PREFIX="◎",Blockly.Msg.BLOCKS_SENSING_HIT_SUFFIX="に触れた",Blockly.Msg.BLOCKS_SENSING_CHARACTER_PROPERTY_X="x座標",Blockly.Msg.BLOCKS_SENSING_CHARACTER_PROPERTY_Y="y座標",Blockly.Msg.BLOCKS_SENSING_CHARACTER_PROPERTY_ANGLE="向き",Blockly.Msg.BLOCKS_SENSING_CHARACTER_PROPERTY_COSTUME_INDEX="コスチューム番号",Blockly.Msg.BLOCKS_SENSING_CHARACTER_PROPERTY_COSTUME="コスチューム名",Blockly.Msg.BLOCKS_SENSING_CHARACTER_PROPERTY_SCALE="大きさ",Blockly.Msg.BLOCKS_SENSING_CHARACTER_PROPERTY_VOLUME="ボリューム",Blockly.Msg.BLOCKS_SENSING_CHARACTER_PROPERTY="◎%1 の %2",Blockly.Msg.BLOCKS_SENSING_TIME_NOW_YEAR="年",Blockly.Msg.BLOCKS_SENSING_TIME_NOW_MONTH="月",Blockly.Msg.BLOCKS_SENSING_TIME_NOW_DAY="日",Blockly.Msg.BLOCKS_SENSING_TIME_NOW_WDAY="曜日",Blockly.Msg.BLOCKS_SENSING_TIME_NOW_HOUR="時",Blockly.Msg.BLOCKS_SENSING_TIME_NOW_MIN="分",Blockly.Msg.BLOCKS_SENSING_TIME_NOW_SEC="秒",Blockly.Msg.BLOCKS_SENSING_TIME_NOW="◎現在の %1",Blockly.Msg.BLOCKS_SENSING_DAYS_SINCE_2000="◎2000年からの日数",Blockly.Msg.BLOCKS_CONTROL_SLEEP="◆%1秒待つ",Blockly.Msg.BLOCKS_CONTROL_LOOP="◆ずっと",Blockly.Msg.BLOCKS_CONTROL_LOOP_END="を繰り返す",Blockly.Msg.BLOCKS_CONTROL_BREAK="◆繰り返しから脱出する",Blockly.Msg.BLOCKS_CONTROL_NEXT="◆以降の処理を飛ばして、次の回の処理を開始する",Blockly.Msg.BLOCKS_CONTROL_REDO="◆以降の処理を飛ばして、もう一度同じ処理をやり直す",Blockly.Msg.BLOCKS_CONTROL_IF="◆もし",Blockly.Msg.BLOCKS_CONTROL_THEN="ならば",Blockly.Msg.BLOCKS_CONTROL_ELSE="でなければ",Blockly.Msg.BLOCKS_CONTROL_TIMES="◆%1回繰り返す",Blockly.Msg.BLOCKS_CONTROL_AWAIT_UNTIL="◆%1まで待つ",Blockly.Msg.BLOCKS_CONTROL_UNTIL="◆%1まで",Blockly.Msg.BLOCKS_CONTROL_AWAIT="◆ほんの少し待つ",Blockly.Msg.BLOCKS_RUBY_STATEMENT="♠文",Blockly.Msg.BLOCKS_RUBY_EXPRESSION="♠式",Blockly.Msg.BLOCKS_RUBY_COMMENT="♠コメント",Blockly.Msg.BLOCKS_RUBY_P="♠p %1",Blockly.Msg.BLOCKS_FIELD_CHARACTER_NO_CHARACTER="キャラクターなし",Blockly.Msg.BLOCKS_SOUND_PRESET_SOUNDS="♪%1",Blockly.Msg.BLOCKS_SOUND_PRESET_SOUNDS_PIANO_DO="ピアノのド",Blockly.Msg.BLOCKS_SOUND_PRESET_SOUNDS_PIANO_RE="ピアノのレ",Blockly.Msg.BLOCKS_SOUND_PRESET_SOUNDS_PIANO_MI="ピアノのミ",Blockly.Msg.BLOCKS_SOUND_PRESET_SOUNDS_PIANO_FA="ピアノのファ",Blockly.Msg.BLOCKS_SOUND_PRESET_SOUNDS_PIANO_SO="ピアノのソ",Blockly.Msg.BLOCKS_SOUND_PRESET_SOUNDS_PIANO_RA="ピアノのラ",Blockly.Msg.BLOCKS_SOUND_PRESET_SOUNDS_PIANO_SI="ピアノのシ",Blockly.Msg.BLOCKS_SOUND_PRESET_SOUNDS_PIANO_DO_2="ピアノの高いド",Blockly.Msg.BLOCKS_SOUND_PLAY="♪%1 の音を鳴らす",Blockly.Msg.BLOCKS_LOOKS_SAY="★%1 と言う",Blockly.Msg.BLOCKS_LOOKS_THINK="★%1 と考える",Blockly.Msg.BLOCKS_LOOKS_SAY_WITH_SECOND="★%1 と %2 秒と言う",Blockly.Msg.BLOCKS_LOOKS_THINK_WITH_SECOND="★%1 と %2 秒と考える",Blockly.Msg.BLOCKS_LOOKS_SHOW="★表示する",Blockly.Msg.BLOCKS_LOOKS_HIDE="★隠す",Blockly.Msg.BLOCKS_LOOKS_VANISH="★消滅する",Blockly.Msg.BLOCKS_HARDWARE_LED_TURN_ON="★LED %1 をオンにする",Blockly.Msg.BLOCKS_HARDWARE_LED_TURN_OFF="★LED %1 をオフにする",Blockly.Msg.BLOCKS_HARDWARE_ANODE="アノード",Blockly.Msg.BLOCKS_HARDWARE_CATHODE="カソード",Blockly.Msg.BLOCKS_HARDWARE_LEFT=" 左",Blockly.Msg.BLOCKS_HARDWARE_RIGHT="右",Blockly.Msg.BLOCKS_HARDWARE_INIT_HARDWARE="♠ハードウェアを準備する",Blockly.Msg.BLOCKS_HARDWARE_RGB_LED_SET_COLOR="★RGB LED %1 コモン %2 を %3 にする",Blockly.Msg.BLOCKS_HARDWARE_RGB_LED_TURN_OFF="★RGB LED %1 コモン %2 をオフにする",Blockly.Msg.BLOCKS_HARDWARE_SEVEN_SEGMENT_DISPLAY_SHOW="★7セグディスプレイに %1 を表示する",Blockly.Msg.BLOCKS_HARDWARE_SEVEN_SEGMENT_DISPLAY_OFF="★7セグディスプレイをオフにする",Blockly.Msg.BLOCKS_HARDWARE_LCD_PUTS="★LCDに %1 を表示する",Blockly.Msg.BLOCKS_HARDWARE_LCD_CLEAR="★LCDをクリアする",Blockly.Msg.BLOCKS_HARDWARE_SERVO_SET_POSITION="■サーボ %1 を %2 度(5~180)にする",Blockly.Msg.BLOCKS_HARDWARE_TWO_WHEEL_DRIVE_CAR_FORWARD="■2WD車 %1 を進める",Blockly.Msg.BLOCKS_HARDWARE_TWO_WHEEL_DRIVE_CAR_BACKWARD="■2WD車 %1 をバックさせる",Blockly.Msg.BLOCKS_HARDWARE_TWO_WHEEL_DRIVE_CAR_TURN_LEFT="■2WD車 %1 を左に曲げる",Blockly.Msg.BLOCKS_HARDWARE_TWO_WHEEL_DRIVE_CAR_TURN_RIGHT="■2WD車 %1 を右に曲げる",Blockly.Msg.BLOCKS_HARDWARE_TWO_WHEEL_DRIVE_CAR_STOP="■2WD車 %1 を止める",Blockly.Msg.BLOCKS_HARDWARE_TWO_WHEEL_DRIVE_CAR_RUN="■2WD車 %2 を %3 秒 %1",Blockly.Msg.BLOCKS_HARDWARE_TWO_WHEEL_DRIVE_CAR_COMMANDS="■%1",Blockly.Msg.BLOCKS_HARDWARE_TWO_WHEEL_DRIVE_CAR_COMMANDS_FORWARD="進める",Blockly.Msg.BLOCKS_HARDWARE_TWO_WHEEL_DRIVE_CAR_COMMANDS_BACKWARD="バックさせる",Blockly.Msg.BLOCKS_HARDWARE_TWO_WHEEL_DRIVE_CAR_COMMANDS_TURN_LEFT="左に曲げる",Blockly.Msg.BLOCKS_HARDWARE_TWO_WHEEL_DRIVE_CAR_COMMANDS_TURN_RIGHT="右に曲げる",Blockly.Msg.BLOCKS_HARDWARE_TWO_WHEEL_DRIVE_CAR_COMMANDS_STOP="止める",Blockly.Msg.BLOCKS_HARDWARE_TWO_WHEEL_DRIVE_CAR_SET_SPEED="■2WD車 %1 の %2 の速度(%)を %3 にする",Blockly.Msg.BLOCKS_HARDWARE_TWO_WHEEL_DRIVE_CAR_SPEED="◎2WD車 %1 の %2 の速度(%)",Blockly.Msg.BLOCKS_HARDWARE_MOTOR_DRIVER_FORWARD="正転させる",Blockly.Msg.BLOCKS_HARDWARE_MOTOR_DRIVER_BACKWARD="逆転させる",Blockly.Msg.BLOCKS_HARDWARE_MOTOR_DRIVER_STOP="止める",Blockly.Msg.BLOCKS_HARDWARE_MOTOR_DRIVER="■(モータードライバ %1 で)モーターを %2",Blockly.Msg.BLOCKS_HARDWARE_MOTOR_DRIVER_SET_SPEED="■(モータードライバ %1 の)モーターの速度を %2 にする",Blockly.Msg.BLOCKS_HARDWARE_MOTOR_DRIVER_SPEED="◎(モータードライバ %1 の)モーターの速度(%)",Blockly.Msg.BLOCKS_HARDWARE_BUTTON_PRESSED_OR_RELEASED="◎ボタン %1 が %2 ?",Blockly.Msg.BLOCKS_HARDWARE_SENSOR_VALUE="◎センサー %1",Blockly.Msg.BLOCKS_HARDWARE_SMALRUBOT_V3_LED_TURN_ON_OR_OFF="★スモウルボットV3の %1 LEDを %2",Blockly.Msg.BLOCKS_HARDWARE_SMALRUBOT_V3_MOTOR_SPEED="◎スモウルボットV3の %1 モーターの速度(%)",Blockly.Msg.BLOCKS_HARDWARE_SMALRUBOT_V3_MOTOR_SET_SPEED="■スモウルボットV3の %1 モーターの速度を %2 (%) にする",Blockly.Msg.BLOCKS_HARDWARE_SMALRUBOT_V3_ACTION="■スモウルボットV3を %1",Blockly.Msg.BLOCKS_HARDWARE_SMALRUBOT_V3_ACTION_WITH_SEC="■スモウルボットV3を %2 秒 %1",Blockly.Msg.BLOCKS_HARDWARE_SMALRUBOT_V3_TOUCH_SENSOR_PRESSED_OR_RELEASED="◎スモウルボットV3の %1 のタッチセンサーが %2 ?",Blockly.Msg.BLOCKS_HARDWARE_SMALRUBOT_V3_LIGHT_SENSOR_VALUE="◎スモウルボットV3の光センサー",Blockly.Msg.BLOCKS_HARDWARE_SMALRUBOT_S1_LED_TURN_ON_OR_OFF="★スモウルボットS1の %1 LEDを %2",Blockly.Msg.BLOCKS_HARDWARE_SMALRUBOT_S1_ACTION="■スモウルボットS1を %1",Blockly.Msg.BLOCKS_HARDWARE_SMALRUBOT_S1_ACTION_WITH_SEC="■スモウルボットS1を %2 秒 %1",Blockly.Msg.BLOCKS_HARDWARE_SMALRUBOT_S1_IR_PHOTOREFLECTOR_VALUE="◎スモウルボットS1の %1 のセンサー",Blockly.Msg.BLOCKS_HARDWARE_SMALRUBOT_S1_DC_MOTOR_POWER_RATIO="◎スモウルボットS1の %1 DCモーターの速度(%)",Blockly.Msg.BLOCKS_HARDWARE_SMALRUBOT_S1_DC_MOTOR_SET_POWER_RATIO="■スモウルボットS1の %1 DCモーターの速度を %2 (%) にする",Blockly.Msg.BLOCKS_OPERATORS_ADD="%1+%2",Blockly.Msg.BLOCKS_OPERATORS_MINUS="%1ー%2",Blockly.Msg.BLOCKS_OPERATORS_MULTIPLY="%1×%2",Blockly.Msg.BLOCKS_OPERATORS_DIVIDE="%1÷%2",Blockly.Msg.BLOCKS_OPERATORS_COMPARE_LT="%1<%2",Blockly.Msg.BLOCKS_OPERATORS_COMPARE_LTE="%1≦%2",Blockly.Msg.BLOCKS_OPERATORS_COMPARE_EQ="%1=%2",Blockly.Msg.BLOCKS_OPERATORS_COMPARE_GTE="%1≧%2",Blockly.Msg.BLOCKS_OPERATORS_COMPARE_GT="%1>%2",Blockly.Msg.BLOCKS_OPERATORS_RAND="%1から%2までの乱数",Blockly.Msg.BLOCKS_OPERATORS_AND="%1かつ%2",Blockly.Msg.BLOCKS_OPERATORS_OR="%1または%2",Blockly.Msg.BLOCKS_OPERATORS_NOT="%1ではない",Blockly.Msg.BLOCKS_OPERATORS_INDEX_OF="%1の%2番目",Blockly.Msg.BLOCKS_OPERATORS_LENGTH="%1の長さ",Blockly.Msg.BLOCKS_OPERATORS_MODULO="%1を%2で割った余り",Blockly.Msg.BLOCKS_OPERATORS_ROUND="%1を四捨五入",Blockly.Msg.BLOCKS_OPERATORS_MATH_METHOD="%1の%2",Blockly.Msg.BLOCKS_OPERATORS_MATH_METHOD_ABS="絶対値",Blockly.Msg.BLOCKS_OPERATORS_MATH_METHOD_FLOOR="切り上げ",Blockly.Msg.BLOCKS_OPERATORS_MATH_METHOD_CEIL="切り下げ",Blockly.Msg.BLOCKS_OPERATORS_MATH_METHOD_SQRT="平方根",Blockly.Msg.BLOCKS_OPERATORS_MATH_METHOD_SIN="sin",Blockly.Msg.BLOCKS_OPERATORS_MATH_METHOD_COS="cos",Blockly.Msg.BLOCKS_OPERATORS_MATH_METHOD_TAN="tan",Blockly.Msg.BLOCKS_OPERATORS_MATH_METHOD_ASIN="asin",Blockly.Msg.BLOCKS_OPERATORS_MATH_METHOD_ACOS="acos",Blockly.Msg.BLOCKS_OPERATORS_MATH_METHOD_ATAN="atan",Blockly.Msg.BLOCKS_OPERATORS_MATH_METHOD_LN="log",Blockly.Msg.BLOCKS_OPERATORS_MATH_METHOD_LOG="log10",Blockly.Msg.BLOCKS_OPERATORS_MATH_METHOD_E_SQUARE="e ^",Blockly.Msg.BLOCKS_OPERATORS_MATH_METHOD_10_SQUARE="10 ^",Blockly.Msg.BLOCKS_OPERATORS_TRUE="真",Blockly.Msg.BLOCKS_OPERATORS_FALSE="偽",Blockly.Msg.BLOCKS_PEN_DOWN_PEN="●ペンを下ろす",Blockly.Msg.BLOCKS_PEN_UP_PEN="●ペンを上げる",Blockly.Msg.BLOCKS_PEN_SET_PEN_COLOR="●ペンの色を%1にする",Blockly.Msg.VARIABLES_SET_TITLE="☼セット",Blockly.Msg.VARIABLES_GET_TITLE="☼";
@@ -1,92 +0,0 @@
1
- # encoding: utf-8
2
- # language: en
3
- @javascript
4
- Feature: hardware_smalrubot_v3_light_sensor_value block
5
- Scenario: ブロックのみ配置する
6
- Given "ブロック" タブを表示する
7
-
8
- When 次のブロックを配置する:
9
- """
10
- %block{:type => "hardware_smalrubot_v3_light_sensor_value", :x => "0", :y => "0"}
11
- """
12
- And ブロックからソースコードを生成する
13
-
14
- Then テキストエディタのプログラムは "" であること
15
-
16
- Scenario: 文とブロックを配置する
17
- Given "ブロック" タブを表示する
18
-
19
- When 次のブロックを配置する:
20
- """
21
- %block{:type => "ruby_p", :x => "0", :y => "0", :inline => "true" }
22
- %value{:name => "ARG"}
23
- %block{:type => "hardware_smalrubot_v3_light_sensor_value", :x => "0", :y => "0"}
24
- """
25
- And ブロックからソースコードを生成する
26
-
27
- Then テキストエディタのプログラムは以下であること:
28
- """
29
- require "smalruby"
30
-
31
- p("")
32
-
33
- """
34
-
35
- Scenario: キャラクターとブロックを配置する
36
- Given "ブロック" タブを表示する
37
- And 次のキャラクターを追加する:
38
- | name | costumes | x | y | angle |
39
- | car1 | car1.png | 0 | 0 | 0 |
40
-
41
- When 次のブロックを配置する:
42
- """
43
- %block{:type => "character_new", :x => "21", :y => "15"}
44
- %field{:name => "NAME"}<
45
- car1
46
- %statement{:name => "DO"}
47
- %block{:type => "ruby_p", :x => "0", :y => "0", :inline => "true" }
48
- %value{:name => "ARG"}
49
- %block{:type => "hardware_smalrubot_v3_light_sensor_value", :x => "0", :y => "0"}
50
- """
51
- And ブロックからソースコードを生成する
52
-
53
- Then テキストエディタのプログラムは以下であること:
54
- """
55
- require "smalruby"
56
-
57
- car1 = Character.new(costume: "car1.png", x: 0, y: 0, angle: 0)
58
- p(car1.smalrubot_v3.light_sensor.value)
59
-
60
- """
61
-
62
- Scenario: キャラクターとイベントとブロックを配置する
63
- Given "ブロック" タブを表示する
64
- And 次のキャラクターを追加する:
65
- | name | costumes | x | y | angle |
66
- | car1 | car1.png | 0 | 0 | 0 |
67
-
68
- When 次のブロックを配置する:
69
- """
70
- %block{:type => "character_new", :x => "21", :y => "15"}
71
- %field{:name => "NAME"}<
72
- car1
73
- %statement{:name => "DO"}
74
- %block{:type => "events_on_start"}
75
- %statement{:name => "DO"}
76
- %block{:type => "ruby_p", :x => "0", :y => "0", :inline => "true" }
77
- %value{:name => "ARG"}
78
- %block{:type => "hardware_smalrubot_v3_light_sensor_value", :x => "0", :y => "0"}
79
- """
80
- And ブロックからソースコードを生成する
81
-
82
- Then テキストエディタのプログラムは以下であること:
83
- """
84
- require "smalruby"
85
-
86
- car1 = Character.new(costume: "car1.png", x: 0, y: 0, angle: 0)
87
-
88
- car1.on(:start) do
89
- p(smalrubot_v3.light_sensor.value)
90
- end
91
-
92
- """
@@ -1,108 +0,0 @@
1
- # encoding: utf-8
2
- # language: en
3
- @javascript
4
- Feature: hardware_smalrubot_v3_touch_sensor_pressed_or_released block
5
- Scenario: ブロックのみ配置する
6
- Given "ブロック" タブを表示する
7
-
8
- When 次のブロックを配置する:
9
- """
10
- %block{:type => "hardware_smalrubot_v3_touch_sensor_pressed_or_released", :x => "0", :y => "0"}
11
- %field{:name => "LOR"}<
12
- right
13
- %field{:name => "POR"}<
14
- pressed
15
- """
16
- And ブロックからソースコードを生成する
17
-
18
- Then テキストエディタのプログラムは "" であること
19
-
20
- Scenario: 文とブロックを配置する
21
- Given "ブロック" タブを表示する
22
-
23
- When 次のブロックを配置する:
24
- """
25
- %block{:type => "ruby_p", :x => "0", :y => "0", :inline => "true" }
26
- %value{:name => "ARG"}
27
- %block{:type => "hardware_smalrubot_v3_touch_sensor_pressed_or_released", :x => "0", :y => "0"}
28
- %field{:name => "LOR"}<
29
- right
30
- %field{:name => "POR"}<
31
- pressed
32
- """
33
- And ブロックからソースコードを生成する
34
-
35
- Then テキストエディタのプログラムは以下であること:
36
- """
37
- require "smalruby"
38
-
39
- p("")
40
-
41
- """
42
-
43
- Scenario: キャラクターとブロックを配置する
44
- Given "ブロック" タブを表示する
45
- And 次のキャラクターを追加する:
46
- | name | costumes | x | y | angle |
47
- | car1 | car1.png | 0 | 0 | 0 |
48
-
49
- When 次のブロックを配置する:
50
- """
51
- %block{:type => "character_new", :x => "21", :y => "15"}
52
- %field{:name => "NAME"}<
53
- car1
54
- %statement{:name => "DO"}
55
- %block{:type => "ruby_p", :x => "0", :y => "0", :inline => "true" }
56
- %value{:name => "ARG"}
57
- %block{:type => "hardware_smalrubot_v3_touch_sensor_pressed_or_released", :x => "0", :y => "0"}
58
- %field{:name => "LOR"}<
59
- right
60
- %field{:name => "POR"}<
61
- pressed
62
- """
63
- And ブロックからソースコードを生成する
64
-
65
- Then テキストエディタのプログラムは以下であること:
66
- """
67
- require "smalruby"
68
-
69
- car1 = Character.new(costume: "car1.png", x: 0, y: 0, angle: 0)
70
- p(car1.smalrubot_v3.right_touch_sensor.pressed?)
71
-
72
- """
73
-
74
- Scenario: キャラクターとイベントとブロックを配置する
75
- Given "ブロック" タブを表示する
76
- And 次のキャラクターを追加する:
77
- | name | costumes | x | y | angle |
78
- | car1 | car1.png | 0 | 0 | 0 |
79
-
80
- When 次のブロックを配置する:
81
- """
82
- %block{:type => "character_new", :x => "21", :y => "15"}
83
- %field{:name => "NAME"}<
84
- car1
85
- %statement{:name => "DO"}
86
- %block{:type => "events_on_start"}
87
- %statement{:name => "DO"}
88
- %block{:type => "ruby_p", :x => "0", :y => "0", :inline => "true" }
89
- %value{:name => "ARG"}
90
- %block{:type => "hardware_smalrubot_v3_touch_sensor_pressed_or_released", :x => "0", :y => "0"}
91
- %field{:name => "LOR"}<
92
- left
93
- %field{:name => "POR"}<
94
- released
95
- """
96
- And ブロックからソースコードを生成する
97
-
98
- Then テキストエディタのプログラムは以下であること:
99
- """
100
- require "smalruby"
101
-
102
- car1 = Character.new(costume: "car1.png", x: 0, y: 0, angle: 0)
103
-
104
- car1.on(:start) do
105
- p(smalrubot_v3.left_touch_sensor.released?)
106
- end
107
-
108
- """
@@ -1,433 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- require 'spec_helper'
3
- require_relative 'shared/block_examples'
4
-
5
- # rubocop:disable EmptyLines, LineLength
6
-
7
- describe RubyToBlock::Block, 'Smalrubot v3 blocks', to_blocks: true do
8
- parts = <<-EOS
9
- require "smalruby"
10
-
11
- init_hardware
12
- car1 = Character.new(costume: "car1.png", x: 0, y: 0, angle: 0)
13
-
14
- car1.on(:start) do
15
- smalrubot_v3.forward
16
- smalrubot_v3.backward
17
- smalrubot_v3.turn_left
18
- smalrubot_v3.turn_right
19
- smalrubot_v3.stop
20
-
21
- smalrubot_v3.forward(sec: 0.5)
22
- smalrubot_v3.backward(sec: 0.4)
23
- smalrubot_v3.turn_left(sec: 0.3)
24
- smalrubot_v3.turn_right(sec: 0.2)
25
- smalrubot_v3.stop(sec: 0.1)
26
-
27
- p(smalrubot_v3.left_touch_sensor.pressed?)
28
- p(smalrubot_v3.left_touch_sensor.released?)
29
- p(smalrubot_v3.right_touch_sensor.pressed?)
30
- p(smalrubot_v3.right_touch_sensor.released?)
31
-
32
- p(smalrubot_v3.light_sensor.value)
33
-
34
- smalrubot_v3.red_led.turn_on
35
- smalrubot_v3.green_led.turn_off
36
-
37
- p(smalrubot_v3.left_motor_speed)
38
- p(smalrubot_v3.right_motor_speed)
39
-
40
- smalrubot_v3.left_motor_speed = 10
41
- smalrubot_v3.right_motor_speed = 90
42
- end
43
- car1.smalrubot_v3.forward
44
- car1.smalrubot_v3.backward
45
- car1.smalrubot_v3.turn_left
46
- car1.smalrubot_v3.turn_right
47
- car1.smalrubot_v3.stop
48
-
49
- car1.smalrubot_v3.forward(sec: 0.5)
50
- car1.smalrubot_v3.backward(sec: 0.4)
51
- car1.smalrubot_v3.turn_left(sec: 0.3)
52
- car1.smalrubot_v3.turn_right(sec: 0.2)
53
- car1.smalrubot_v3.stop(sec: 0.1)
54
-
55
- p(car1.smalrubot_v3.left_touch_sensor.pressed?)
56
- p(car1.smalrubot_v3.left_touch_sensor.released?)
57
- p(car1.smalrubot_v3.right_touch_sensor.pressed?)
58
- p(car1.smalrubot_v3.right_touch_sensor.released?)
59
-
60
- p(car1.smalrubot_v3.light_sensor.value)
61
-
62
- car1.smalrubot_v3.red_led.turn_on
63
- car1.smalrubot_v3.green_led.turn_off
64
-
65
- p(car1.smalrubot_v3.left_motor_speed)
66
- p(car1.smalrubot_v3.right_motor_speed)
67
-
68
- car1.smalrubot_v3.left_motor_speed = 10
69
- car1.smalrubot_v3.right_motor_speed = 90
70
- EOS
71
- describe compact_source_code(parts) do
72
- _parts = parts
73
- let(:data) { _parts }
74
-
75
- it '結果が正しいこと' do
76
- should eq_block_xml(<<-XML)
77
- <character name="car1" x="0" y="0" angle="0" costumes="car1.png" />
78
- <block type="hardware_init_hardware" />
79
- <block type="character_new">
80
- <field name="NAME">car1</field>
81
- <statement name="DO">
82
- <block type="events_on_start">
83
- <statement name="DO">
84
- <block type="hardware_smalrubot_v3_action" inline="true">
85
- <field name="ACTION">forward</field>
86
- <next>
87
- <block type="hardware_smalrubot_v3_action" inline="true">
88
- <field name="ACTION">backward</field>
89
- <next>
90
- <block type="hardware_smalrubot_v3_action" inline="true">
91
- <field name="ACTION">turn_left</field>
92
- <next>
93
- <block type="hardware_smalrubot_v3_action" inline="true">
94
- <field name="ACTION">turn_right</field>
95
- <next>
96
- <block type="hardware_smalrubot_v3_action" inline="true">
97
- <field name="ACTION">stop</field>
98
- <next>
99
- <block type="hardware_smalrubot_v3_action_with_sec" inline="true">
100
- <field name="ACTION">forward</field>
101
- <value name="SEC">
102
- <block type="math_number">
103
- <field name="NUM">0.5</field>
104
- </block>
105
- </value>
106
- <next>
107
- <block type="hardware_smalrubot_v3_action_with_sec" inline="true">
108
- <field name="ACTION">backward</field>
109
- <value name="SEC">
110
- <block type="math_number">
111
- <field name="NUM">0.4</field>
112
- </block>
113
- </value>
114
- <next>
115
- <block type="hardware_smalrubot_v3_action_with_sec" inline="true">
116
- <field name="ACTION">turn_left</field>
117
- <value name="SEC">
118
- <block type="math_number">
119
- <field name="NUM">0.3</field>
120
- </block>
121
- </value>
122
- <next>
123
- <block type="hardware_smalrubot_v3_action_with_sec" inline="true">
124
- <field name="ACTION">turn_right</field>
125
- <value name="SEC">
126
- <block type="math_number">
127
- <field name="NUM">0.2</field>
128
- </block>
129
- </value>
130
- <next>
131
- <block type="hardware_smalrubot_v3_action_with_sec" inline="true">
132
- <field name="ACTION">stop</field>
133
- <value name="SEC">
134
- <block type="math_number">
135
- <field name="NUM">0.1</field>
136
- </block>
137
- </value>
138
- <next>
139
- <block type="ruby_p" inline="true">
140
- <value name="ARG">
141
- <block type="hardware_smalrubot_v3_touch_sensor_pressed_or_released">
142
- <field name="LOR">left</field>
143
- <field name="POR">pressed</field>
144
- </block>
145
- </value>
146
- <next>
147
- <block type="ruby_p" inline="true">
148
- <value name="ARG">
149
- <block type="hardware_smalrubot_v3_touch_sensor_pressed_or_released">
150
- <field name="LOR">left</field>
151
- <field name="POR">released</field>
152
- </block>
153
- </value>
154
- <next>
155
- <block type="ruby_p" inline="true">
156
- <value name="ARG">
157
- <block type="hardware_smalrubot_v3_touch_sensor_pressed_or_released">
158
- <field name="LOR">right</field>
159
- <field name="POR">pressed</field>
160
- </block>
161
- </value>
162
- <next>
163
- <block type="ruby_p" inline="true">
164
- <value name="ARG">
165
- <block type="hardware_smalrubot_v3_touch_sensor_pressed_or_released">
166
- <field name="LOR">right</field>
167
- <field name="POR">released</field>
168
- </block>
169
- </value>
170
- <next>
171
- <block type="ruby_p" inline="true">
172
- <value name="ARG">
173
- <block type="hardware_smalrubot_v3_light_sensor_value" />
174
- </value>
175
- <next>
176
- <block type="hardware_smalrubot_v3_led_turn_on_or_off" inline="true">
177
- <field name="COLOUR">red</field>
178
- <field name="OOO">turn_on</field>
179
- <next>
180
- <block type="hardware_smalrubot_v3_led_turn_on_or_off" inline="true">
181
- <field name="COLOUR">green</field>
182
- <field name="OOO">turn_off</field>
183
- <next>
184
- <block type="ruby_p" inline="true">
185
- <value name="ARG">
186
- <block type="hardware_smalrubot_v3_motor_speed">
187
- <field name="LOR">left</field>
188
- </block>
189
- </value>
190
- <next>
191
- <block type="ruby_p" inline="true">
192
- <value name="ARG">
193
- <block type="hardware_smalrubot_v3_motor_speed">
194
- <field name="LOR">right</field>
195
- </block>
196
- </value>
197
- <next>
198
- <block type="hardware_smalrubot_v3_motor_set_speed" inline="true">
199
- <field name="LOR">left</field>
200
- <value name="SPEED">
201
- <block type="math_number">
202
- <field name="NUM">10</field>
203
- </block>
204
- </value>
205
- <next>
206
- <block type="hardware_smalrubot_v3_motor_set_speed" inline="true">
207
- <field name="LOR">right</field>
208
- <value name="SPEED">
209
- <block type="math_number">
210
- <field name="NUM">90</field>
211
- </block>
212
- </value>
213
- </block>
214
- </next>
215
- </block>
216
- </next>
217
- </block>
218
- </next>
219
- </block>
220
- </next>
221
- </block>
222
- </next>
223
- </block>
224
- </next>
225
- </block>
226
- </next>
227
- </block>
228
- </next>
229
- </block>
230
- </next>
231
- </block>
232
- </next>
233
- </block>
234
- </next>
235
- </block>
236
- </next>
237
- </block>
238
- </next>
239
- </block>
240
- </next>
241
- </block>
242
- </next>
243
- </block>
244
- </next>
245
- </block>
246
- </next>
247
- </block>
248
- </next>
249
- </block>
250
- </next>
251
- </block>
252
- </next>
253
- </block>
254
- </statement>
255
- <next>
256
- <block type="hardware_smalrubot_v3_action" inline="true">
257
- <field name="ACTION">forward</field>
258
- <next>
259
- <block type="hardware_smalrubot_v3_action" inline="true">
260
- <field name="ACTION">backward</field>
261
- <next>
262
- <block type="hardware_smalrubot_v3_action" inline="true">
263
- <field name="ACTION">turn_left</field>
264
- <next>
265
- <block type="hardware_smalrubot_v3_action" inline="true">
266
- <field name="ACTION">turn_right</field>
267
- <next>
268
- <block type="hardware_smalrubot_v3_action" inline="true">
269
- <field name="ACTION">stop</field>
270
- <next>
271
- <block type="hardware_smalrubot_v3_action_with_sec" inline="true">
272
- <field name="ACTION">forward</field>
273
- <value name="SEC">
274
- <block type="math_number">
275
- <field name="NUM">0.5</field>
276
- </block>
277
- </value>
278
- <next>
279
- <block type="hardware_smalrubot_v3_action_with_sec" inline="true">
280
- <field name="ACTION">backward</field>
281
- <value name="SEC">
282
- <block type="math_number">
283
- <field name="NUM">0.4</field>
284
- </block>
285
- </value>
286
- <next>
287
- <block type="hardware_smalrubot_v3_action_with_sec" inline="true">
288
- <field name="ACTION">turn_left</field>
289
- <value name="SEC">
290
- <block type="math_number">
291
- <field name="NUM">0.3</field>
292
- </block>
293
- </value>
294
- <next>
295
- <block type="hardware_smalrubot_v3_action_with_sec" inline="true">
296
- <field name="ACTION">turn_right</field>
297
- <value name="SEC">
298
- <block type="math_number">
299
- <field name="NUM">0.2</field>
300
- </block>
301
- </value>
302
- <next>
303
- <block type="hardware_smalrubot_v3_action_with_sec" inline="true">
304
- <field name="ACTION">stop</field>
305
- <value name="SEC">
306
- <block type="math_number">
307
- <field name="NUM">0.1</field>
308
- </block>
309
- </value>
310
- <next>
311
- <block type="ruby_p" inline="true">
312
- <value name="ARG">
313
- <block type="hardware_smalrubot_v3_touch_sensor_pressed_or_released">
314
- <field name="LOR">left</field>
315
- <field name="POR">pressed</field>
316
- </block>
317
- </value>
318
- <next>
319
- <block type="ruby_p" inline="true">
320
- <value name="ARG">
321
- <block type="hardware_smalrubot_v3_touch_sensor_pressed_or_released">
322
- <field name="LOR">left</field>
323
- <field name="POR">released</field>
324
- </block>
325
- </value>
326
- <next>
327
- <block type="ruby_p" inline="true">
328
- <value name="ARG">
329
- <block type="hardware_smalrubot_v3_touch_sensor_pressed_or_released">
330
- <field name="LOR">right</field>
331
- <field name="POR">pressed</field>
332
- </block>
333
- </value>
334
- <next>
335
- <block type="ruby_p" inline="true">
336
- <value name="ARG">
337
- <block type="hardware_smalrubot_v3_touch_sensor_pressed_or_released">
338
- <field name="LOR">right</field>
339
- <field name="POR">released</field>
340
- </block>
341
- </value>
342
- <next>
343
- <block type="ruby_p" inline="true">
344
- <value name="ARG">
345
- <block type="hardware_smalrubot_v3_light_sensor_value" />
346
- </value>
347
- <next>
348
- <block type="hardware_smalrubot_v3_led_turn_on_or_off" inline="true">
349
- <field name="COLOUR">red</field>
350
- <field name="OOO">turn_on</field>
351
- <next>
352
- <block type="hardware_smalrubot_v3_led_turn_on_or_off" inline="true">
353
- <field name="COLOUR">green</field>
354
- <field name="OOO">turn_off</field>
355
- <next>
356
- <block type="ruby_p" inline="true">
357
- <value name="ARG">
358
- <block type="hardware_smalrubot_v3_motor_speed">
359
- <field name="LOR">left</field>
360
- </block>
361
- </value>
362
- <next>
363
- <block type="ruby_p" inline="true">
364
- <value name="ARG">
365
- <block type="hardware_smalrubot_v3_motor_speed">
366
- <field name="LOR">right</field>
367
- </block>
368
- </value>
369
- <next>
370
- <block type="hardware_smalrubot_v3_motor_set_speed" inline="true">
371
- <field name="LOR">left</field>
372
- <value name="SPEED">
373
- <block type="math_number">
374
- <field name="NUM">10</field>
375
- </block>
376
- </value>
377
- <next>
378
- <block type="hardware_smalrubot_v3_motor_set_speed" inline="true">
379
- <field name="LOR">right</field>
380
- <value name="SPEED">
381
- <block type="math_number">
382
- <field name="NUM">90</field>
383
- </block>
384
- </value>
385
- </block>
386
- </next>
387
- </block>
388
- </next>
389
- </block>
390
- </next>
391
- </block>
392
- </next>
393
- </block>
394
- </next>
395
- </block>
396
- </next>
397
- </block>
398
- </next>
399
- </block>
400
- </next>
401
- </block>
402
- </next>
403
- </block>
404
- </next>
405
- </block>
406
- </next>
407
- </block>
408
- </next>
409
- </block>
410
- </next>
411
- </block>
412
- </next>
413
- </block>
414
- </next>
415
- </block>
416
- </next>
417
- </block>
418
- </next>
419
- </block>
420
- </next>
421
- </block>
422
- </next>
423
- </block>
424
- </next>
425
- </block>
426
- </next>
427
- </block>
428
- </statement>
429
- </block>
430
- XML
431
- end
432
- end
433
- end