smalruby-editor 0.1.24 → 0.2.0
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.
- checksums.yaml +4 -4
- data/Guardfile +9 -0
- data/app/assets/javascripts/blocks/hardware.js.coffee.erb +147 -62
- data/app/assets/javascripts/blocks/sensing.js.coffee.erb +4 -0
- data/app/assets/javascripts/msg/en_us.js +34 -12
- data/app/assets/javascripts/msg/ja.js +35 -15
- data/app/helpers/editor_helper.rb +2 -1
- data/app/models/concerns/ruby_to_block/block/{hardware_button_down_or_up.rb → hardware_button_pressed_or_released.rb} +3 -3
- data/app/models/concerns/ruby_to_block/block/{hardware_led_on.rb → hardware_led_turn_off.rb} +2 -2
- data/app/models/concerns/ruby_to_block/block/{hardware_led_off.rb → hardware_led_turn_on.rb} +2 -2
- data/app/models/concerns/ruby_to_block/block/hardware_operation.rb +2 -0
- data/app/models/concerns/ruby_to_block/block/{hardware_rgb_led_on.rb → hardware_rgb_led_set_color.rb} +2 -2
- data/app/models/concerns/ruby_to_block/block/{hardware_rgb_led_off.rb → hardware_rgb_led_turn_off.rb} +2 -2
- data/app/models/concerns/ruby_to_block/block/hardware_smalrubot_v3_action.rb +22 -0
- data/app/models/concerns/ruby_to_block/block/hardware_smalrubot_v3_action_with_sec.rb +24 -0
- data/app/models/concerns/ruby_to_block/block/hardware_smalrubot_v3_led_turn_on_or_off.rb +22 -0
- data/app/models/concerns/ruby_to_block/block/hardware_smalrubot_v3_light_sensor_value.rb +28 -0
- data/app/models/concerns/ruby_to_block/block/hardware_smalrubot_v3_touch_sensor_pressed_or_released.rb +29 -0
- data/app/models/concerns/ruby_to_block/block/hardware_two_wheel_drive_car_commands.rb +3 -1
- data/app/views/editor/_toolbox.html.haml +30 -17
- data/app/views/layouts/application.html.erb +3 -1
- data/config/locales/en.yml +1 -0
- data/config/locales/ja.yml +1 -0
- data/lib/smalruby_editor/blockly_message_helper.rb +2 -1
- data/lib/smalruby_editor/version.rb +1 -1
- data/lib/tasks/release.rake +0 -0
- data/smalruby-editor.gemspec +1 -1
- data/spec/acceptance/block_mode/blocks/hardware/{button_down_or_up.feature → button_pressed_or_released.feature} +15 -15
- data/spec/acceptance/block_mode/blocks/hardware/led_turn_off.feature +67 -0
- data/spec/acceptance/block_mode/blocks/hardware/led_turn_on.feature +67 -0
- data/spec/acceptance/block_mode/blocks/hardware/rgb_led_set_color.feature +79 -0
- data/spec/acceptance/block_mode/blocks/hardware/{button_not_use_pullup.feature → rgb_led_turn_off.feature} +30 -18
- data/spec/acceptance/block_mode/blocks/hardware/smalrubot_v3_action.feature +107 -0
- data/spec/acceptance/block_mode/blocks/hardware/smalrubot_v3_action_with_sec.feature +151 -0
- data/spec/acceptance/block_mode/blocks/hardware/smalrubot_v3_led_turn_on_or_off.feature +73 -0
- data/spec/acceptance/block_mode/blocks/hardware/smalrubot_v3_light_sensor_value.feature +92 -0
- data/spec/acceptance/block_mode/blocks/hardware/smalrubot_v3_motor_speed.feature +116 -0
- data/spec/acceptance/block_mode/blocks/hardware/smalrubot_v3_touch_sensor_pressed_or_released.feature +108 -0
- data/spec/models/concerns/ruby_to_block/block/hardware_spec.rb +359 -36
- data/spec/models/concerns/ruby_to_block_spec.rb +8 -8
- data/spec/steps/block_mode_steps.rb +8 -0
- metadata +43 -35
- data/app/models/concerns/ruby_to_block/block/hardware_button_not_use_pullup.rb +0 -18
- data/app/models/concerns/ruby_to_block/block/hardware_on_button_down_or_up.rb +0 -19
- data/app/models/concerns/ruby_to_block/block/hardware_on_sensor_change.rb +0 -17
- data/spec/acceptance/block_mode/blocks/hardware/led_off.feature +0 -75
- data/spec/acceptance/block_mode/blocks/hardware/led_on.feature +0 -75
- data/spec/acceptance/block_mode/blocks/hardware/on_button_down_or_up.feature +0 -87
- data/spec/acceptance/block_mode/blocks/hardware/on_sensor_change.feature +0 -81
- data/spec/acceptance/block_mode/blocks/hardware/rgb_led_off.feature +0 -81
- data/spec/acceptance/block_mode/blocks/hardware/rgb_led_on.feature +0 -87
@@ -423,13 +423,13 @@ frog1 = Character.new(costume: "frog1.png", x: 261, y: 191, angle: 0)
|
|
423
423
|
|
424
424
|
frog1.on(:click) do
|
425
425
|
say(message: "ライトをぴかっとさせるでよ♪")
|
426
|
-
rgb_led_anode("D3").
|
426
|
+
rgb_led_anode("D3").color = [51, 51, 255]
|
427
427
|
sleep(1)
|
428
|
-
rgb_led_anode("D3").
|
428
|
+
rgb_led_anode("D3").color = [255, 255, 153]
|
429
429
|
sleep(1)
|
430
|
-
rgb_led_anode("D3").
|
430
|
+
rgb_led_anode("D3").color = [255, 0, 0]
|
431
431
|
sleep(1)
|
432
|
-
rgb_led_anode("D3").
|
432
|
+
rgb_led_anode("D3").turn_off
|
433
433
|
say(message: "")
|
434
434
|
end
|
435
435
|
EOS
|
@@ -453,7 +453,7 @@ end
|
|
453
453
|
</block>
|
454
454
|
</value>
|
455
455
|
<next>
|
456
|
-
<block type="
|
456
|
+
<block type="hardware_rgb_led_set_color">
|
457
457
|
<field name="AC">anode</field>
|
458
458
|
<field name="PIN">D3</field>
|
459
459
|
<field name="COLOUR">#3333ff</field>
|
@@ -465,7 +465,7 @@ end
|
|
465
465
|
</block>
|
466
466
|
</value>
|
467
467
|
<next>
|
468
|
-
<block type="
|
468
|
+
<block type="hardware_rgb_led_set_color">
|
469
469
|
<field name="AC">anode</field>
|
470
470
|
<field name="PIN">D3</field>
|
471
471
|
<field name="COLOUR">#ffff99</field>
|
@@ -477,7 +477,7 @@ end
|
|
477
477
|
</block>
|
478
478
|
</value>
|
479
479
|
<next>
|
480
|
-
<block type="
|
480
|
+
<block type="hardware_rgb_led_set_color">
|
481
481
|
<field name="AC">anode</field>
|
482
482
|
<field name="PIN">D3</field>
|
483
483
|
<field name="COLOUR">#ff0000</field>
|
@@ -489,7 +489,7 @@ end
|
|
489
489
|
</block>
|
490
490
|
</value>
|
491
491
|
<next>
|
492
|
-
<block type="
|
492
|
+
<block type="hardware_rgb_led_turn_off">
|
493
493
|
<field name="AC">anode</field>
|
494
494
|
<field name="PIN">D3</field>
|
495
495
|
<next>
|
@@ -50,6 +50,14 @@ step '次のキャラクターを追加する:' do |table|
|
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
+
step 'キャラクターcar1を追加する' do
|
54
|
+
table = Turnip::Table.new([
|
55
|
+
%w(name costumes x y angle),
|
56
|
+
%w(car1 car1.png 0 0 0),
|
57
|
+
])
|
58
|
+
step '次のキャラクターを追加する:', table
|
59
|
+
end
|
60
|
+
|
53
61
|
step '次のXMLと同等のブロックが配置されていること:' do |xml|
|
54
62
|
expect(page.evaluate_script('Smalruby.dumpXml()')).to eq(xml)
|
55
63
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smalruby-editor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kouji Takao
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -184,14 +184,14 @@ dependencies:
|
|
184
184
|
requirements:
|
185
185
|
- - "~>"
|
186
186
|
- !ruby/object:Gem::Version
|
187
|
-
version: 0.
|
187
|
+
version: 0.1.1
|
188
188
|
type: :runtime
|
189
189
|
prerelease: false
|
190
190
|
version_requirements: !ruby/object:Gem::Requirement
|
191
191
|
requirements:
|
192
192
|
- - "~>"
|
193
193
|
- !ruby/object:Gem::Version
|
194
|
-
version: 0.
|
194
|
+
version: 0.1.1
|
195
195
|
- !ruby/object:Gem::Dependency
|
196
196
|
name: therubyracer
|
197
197
|
requirement: !ruby/object:Gem::Requirement
|
@@ -330,20 +330,22 @@ files:
|
|
330
330
|
- app/models/concerns/ruby_to_block/block/events_on_click.rb
|
331
331
|
- app/models/concerns/ruby_to_block/block/events_on_key_push_or_down.rb
|
332
332
|
- app/models/concerns/ruby_to_block/block/events_on_start.rb
|
333
|
-
- app/models/concerns/ruby_to_block/block/
|
334
|
-
- app/models/concerns/ruby_to_block/block/hardware_button_not_use_pullup.rb
|
333
|
+
- app/models/concerns/ruby_to_block/block/hardware_button_pressed_or_released.rb
|
335
334
|
- app/models/concerns/ruby_to_block/block/hardware_init_hardware.rb
|
336
|
-
- app/models/concerns/ruby_to_block/block/
|
337
|
-
- app/models/concerns/ruby_to_block/block/
|
335
|
+
- app/models/concerns/ruby_to_block/block/hardware_led_turn_off.rb
|
336
|
+
- app/models/concerns/ruby_to_block/block/hardware_led_turn_on.rb
|
338
337
|
- app/models/concerns/ruby_to_block/block/hardware_motor_driver.rb
|
339
338
|
- app/models/concerns/ruby_to_block/block/hardware_motor_driver_set_speed.rb
|
340
339
|
- app/models/concerns/ruby_to_block/block/hardware_motor_driver_speed.rb
|
341
|
-
- app/models/concerns/ruby_to_block/block/hardware_on_button_down_or_up.rb
|
342
|
-
- app/models/concerns/ruby_to_block/block/hardware_on_sensor_change.rb
|
343
340
|
- app/models/concerns/ruby_to_block/block/hardware_operation.rb
|
344
|
-
- app/models/concerns/ruby_to_block/block/
|
345
|
-
- app/models/concerns/ruby_to_block/block/
|
341
|
+
- app/models/concerns/ruby_to_block/block/hardware_rgb_led_set_color.rb
|
342
|
+
- app/models/concerns/ruby_to_block/block/hardware_rgb_led_turn_off.rb
|
346
343
|
- app/models/concerns/ruby_to_block/block/hardware_sensor_value.rb
|
344
|
+
- app/models/concerns/ruby_to_block/block/hardware_smalrubot_v3_action.rb
|
345
|
+
- app/models/concerns/ruby_to_block/block/hardware_smalrubot_v3_action_with_sec.rb
|
346
|
+
- app/models/concerns/ruby_to_block/block/hardware_smalrubot_v3_led_turn_on_or_off.rb
|
347
|
+
- app/models/concerns/ruby_to_block/block/hardware_smalrubot_v3_light_sensor_value.rb
|
348
|
+
- app/models/concerns/ruby_to_block/block/hardware_smalrubot_v3_touch_sensor_pressed_or_released.rb
|
347
349
|
- app/models/concerns/ruby_to_block/block/hardware_two_wheel_drive_car.rb
|
348
350
|
- app/models/concerns/ruby_to_block/block/hardware_two_wheel_drive_car_commands.rb
|
349
351
|
- app/models/concerns/ruby_to_block/block/hardware_two_wheel_drive_car_run.rb
|
@@ -454,10 +456,10 @@ files:
|
|
454
456
|
- public/422.html
|
455
457
|
- public/500.html
|
456
458
|
- public/apple-touch-icon.png
|
459
|
+
- public/assets/application-b305a6ea9e7c045a8e170bbf6fb09dd1.js
|
460
|
+
- public/assets/application-b305a6ea9e7c045a8e170bbf6fb09dd1.js.gz
|
457
461
|
- public/assets/application-d5358d75a2c4e570c749b333c59b55ab.css
|
458
462
|
- public/assets/application-d5358d75a2c4e570c749b333c59b55ab.css.gz
|
459
|
-
- public/assets/application-fda71a642d958ffbaf90185c471d6e51.js
|
460
|
-
- public/assets/application-fda71a642d958ffbaf90185c471d6e51.js.gz
|
461
463
|
- public/assets/blockly/msg/js/en_us-6f7333af29688596ef863fa36a22cb41.js
|
462
464
|
- public/assets/blockly/msg/js/en_us-6f7333af29688596ef863fa36a22cb41.js.gz
|
463
465
|
- public/assets/blockly/msg/js/ja-d2cbf808bda8180571bc5f39141a98fe.js
|
@@ -478,11 +480,11 @@ files:
|
|
478
480
|
- public/assets/jquery-ui/ui-icons_888888_256x240-ce584ffa171c3ea9a018cf0d7bec65c8.png
|
479
481
|
- public/assets/jquery-ui/ui-icons_cd0a0a_256x240-747e96029e8dedcabc224e5f7d1f2ede.png
|
480
482
|
- public/assets/loading-e77296be32d066d3e29d3bf9803fa417.gif
|
481
|
-
- public/assets/manifest-
|
482
|
-
- public/assets/msg/en_us-
|
483
|
-
- public/assets/msg/en_us-
|
484
|
-
- public/assets/msg/ja-
|
485
|
-
- public/assets/msg/ja-
|
483
|
+
- public/assets/manifest-ebd584fa603a378faf780f013e6a447d.json
|
484
|
+
- public/assets/msg/en_us-c6f8f0084f38560bf933b742ede64a52.js
|
485
|
+
- public/assets/msg/en_us-c6f8f0084f38560bf933b742ede64a52.js.gz
|
486
|
+
- public/assets/msg/ja-3703e6ceebd04ae1f08b0e871800539d.js
|
487
|
+
- public/assets/msg/ja-3703e6ceebd04ae1f08b0e871800539d.js.gz
|
486
488
|
- public/assets/progressbar-ee8fb1222f286f625bbf7332844a6a0c.gif
|
487
489
|
- public/blockly/media/1x1.gif
|
488
490
|
- public/blockly/media/click.mp3
|
@@ -552,19 +554,22 @@ files:
|
|
552
554
|
- spec/acceptance/block_mode/blocks/events/on_hit.feature
|
553
555
|
- spec/acceptance/block_mode/blocks/events/on_key_push_or_down.feature
|
554
556
|
- spec/acceptance/block_mode/blocks/events/on_start.feature
|
555
|
-
- spec/acceptance/block_mode/blocks/hardware/
|
556
|
-
- spec/acceptance/block_mode/blocks/hardware/button_not_use_pullup.feature
|
557
|
+
- spec/acceptance/block_mode/blocks/hardware/button_pressed_or_released.feature
|
557
558
|
- spec/acceptance/block_mode/blocks/hardware/init_hardware.feature
|
558
|
-
- spec/acceptance/block_mode/blocks/hardware/
|
559
|
-
- spec/acceptance/block_mode/blocks/hardware/
|
559
|
+
- spec/acceptance/block_mode/blocks/hardware/led_turn_off.feature
|
560
|
+
- spec/acceptance/block_mode/blocks/hardware/led_turn_on.feature
|
560
561
|
- spec/acceptance/block_mode/blocks/hardware/motor_driver.feature
|
561
562
|
- spec/acceptance/block_mode/blocks/hardware/motor_driver_speed.feature
|
562
|
-
- spec/acceptance/block_mode/blocks/hardware/
|
563
|
-
- spec/acceptance/block_mode/blocks/hardware/
|
564
|
-
- spec/acceptance/block_mode/blocks/hardware/rgb_led_off.feature
|
565
|
-
- spec/acceptance/block_mode/blocks/hardware/rgb_led_on.feature
|
563
|
+
- spec/acceptance/block_mode/blocks/hardware/rgb_led_set_color.feature
|
564
|
+
- spec/acceptance/block_mode/blocks/hardware/rgb_led_turn_off.feature
|
566
565
|
- spec/acceptance/block_mode/blocks/hardware/sensor_value.feature
|
567
566
|
- spec/acceptance/block_mode/blocks/hardware/servo_set_position.feature
|
567
|
+
- spec/acceptance/block_mode/blocks/hardware/smalrubot_v3_action.feature
|
568
|
+
- spec/acceptance/block_mode/blocks/hardware/smalrubot_v3_action_with_sec.feature
|
569
|
+
- spec/acceptance/block_mode/blocks/hardware/smalrubot_v3_led_turn_on_or_off.feature
|
570
|
+
- spec/acceptance/block_mode/blocks/hardware/smalrubot_v3_light_sensor_value.feature
|
571
|
+
- spec/acceptance/block_mode/blocks/hardware/smalrubot_v3_motor_speed.feature
|
572
|
+
- spec/acceptance/block_mode/blocks/hardware/smalrubot_v3_touch_sensor_pressed_or_released.feature
|
568
573
|
- spec/acceptance/block_mode/blocks/hardware/two_wheel_drive_car.feature
|
569
574
|
- spec/acceptance/block_mode/blocks/hardware/two_wheel_drive_car_speed.feature
|
570
575
|
- spec/acceptance/block_mode/blocks/looks/hide.feature
|
@@ -721,19 +726,22 @@ test_files:
|
|
721
726
|
- spec/acceptance/block_mode/blocks/events/on_hit.feature
|
722
727
|
- spec/acceptance/block_mode/blocks/events/on_key_push_or_down.feature
|
723
728
|
- spec/acceptance/block_mode/blocks/events/on_start.feature
|
724
|
-
- spec/acceptance/block_mode/blocks/hardware/
|
725
|
-
- spec/acceptance/block_mode/blocks/hardware/button_not_use_pullup.feature
|
729
|
+
- spec/acceptance/block_mode/blocks/hardware/button_pressed_or_released.feature
|
726
730
|
- spec/acceptance/block_mode/blocks/hardware/init_hardware.feature
|
727
|
-
- spec/acceptance/block_mode/blocks/hardware/
|
728
|
-
- spec/acceptance/block_mode/blocks/hardware/
|
731
|
+
- spec/acceptance/block_mode/blocks/hardware/led_turn_off.feature
|
732
|
+
- spec/acceptance/block_mode/blocks/hardware/led_turn_on.feature
|
729
733
|
- spec/acceptance/block_mode/blocks/hardware/motor_driver.feature
|
730
734
|
- spec/acceptance/block_mode/blocks/hardware/motor_driver_speed.feature
|
731
|
-
- spec/acceptance/block_mode/blocks/hardware/
|
732
|
-
- spec/acceptance/block_mode/blocks/hardware/
|
733
|
-
- spec/acceptance/block_mode/blocks/hardware/rgb_led_off.feature
|
734
|
-
- spec/acceptance/block_mode/blocks/hardware/rgb_led_on.feature
|
735
|
+
- spec/acceptance/block_mode/blocks/hardware/rgb_led_set_color.feature
|
736
|
+
- spec/acceptance/block_mode/blocks/hardware/rgb_led_turn_off.feature
|
735
737
|
- spec/acceptance/block_mode/blocks/hardware/sensor_value.feature
|
736
738
|
- spec/acceptance/block_mode/blocks/hardware/servo_set_position.feature
|
739
|
+
- spec/acceptance/block_mode/blocks/hardware/smalrubot_v3_action.feature
|
740
|
+
- spec/acceptance/block_mode/blocks/hardware/smalrubot_v3_action_with_sec.feature
|
741
|
+
- spec/acceptance/block_mode/blocks/hardware/smalrubot_v3_led_turn_on_or_off.feature
|
742
|
+
- spec/acceptance/block_mode/blocks/hardware/smalrubot_v3_light_sensor_value.feature
|
743
|
+
- spec/acceptance/block_mode/blocks/hardware/smalrubot_v3_motor_speed.feature
|
744
|
+
- spec/acceptance/block_mode/blocks/hardware/smalrubot_v3_touch_sensor_pressed_or_released.feature
|
737
745
|
- spec/acceptance/block_mode/blocks/hardware/two_wheel_drive_car.feature
|
738
746
|
- spec/acceptance/block_mode/blocks/hardware/two_wheel_drive_car_speed.feature
|
739
747
|
- spec/acceptance/block_mode/blocks/looks/hide.feature
|
@@ -1,18 +0,0 @@
|
|
1
|
-
module RubyToBlock
|
2
|
-
module Block
|
3
|
-
class HardwareButtonNotUsePullup < CharacterMethodCall
|
4
|
-
include HardwareOperation
|
5
|
-
|
6
|
-
blocknize '^\s*' + CHAR_RE +
|
7
|
-
'button\(' + DIO_PIN_RE + '\)\.not_use_pullup\s*$',
|
8
|
-
statement: true
|
9
|
-
|
10
|
-
def self.process_match_data(md, context)
|
11
|
-
md2 = regexp.match(md[type])
|
12
|
-
add_character_method_call_block(context, md2[1],
|
13
|
-
new(fields: { PIN: md2[2] }))
|
14
|
-
true
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
module RubyToBlock
|
2
|
-
module Block
|
3
|
-
class HardwareOnButtonDownOrUp < CharacterEvent
|
4
|
-
include HardwareOperation
|
5
|
-
|
6
|
-
blocknize '^\s*' + CHAR_RE +
|
7
|
-
'on\(:button_(down|up),' + DIO_PIN_RE + '\)\s+' +
|
8
|
-
'do\s*$',
|
9
|
-
statement: true, indent: true
|
10
|
-
|
11
|
-
def self.process_match_data(md, context)
|
12
|
-
md2 = regexp.match(md[type])
|
13
|
-
add_character_event_blocks(context, md2[1],
|
14
|
-
new(fields: { PIN: md2[3], DOU: md2[2] }))
|
15
|
-
true
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
module RubyToBlock
|
2
|
-
module Block
|
3
|
-
class HardwareOnSensorChange < CharacterEvent
|
4
|
-
# rubocop:disable LineLength
|
5
|
-
blocknize '^\s*' + CHAR_RE + 'on\(:sensor_change,\s*"(A[0-5])"\s*\)\s+do\s*$',
|
6
|
-
statement: true, indent: true
|
7
|
-
# rubocop:enable LineLength
|
8
|
-
|
9
|
-
def self.process_match_data(md, context)
|
10
|
-
md2 = regexp.match(md[type])
|
11
|
-
add_character_event_blocks(context, md2[1],
|
12
|
-
new(fields: { PIN: md2[2] }))
|
13
|
-
true
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,75 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
# language: ja
|
3
|
-
@javascript
|
4
|
-
機能: hardware_led_off - 「LED[▼ピン]をオフにする」ブロック
|
5
|
-
シナリオ: ブロックのみ配置する
|
6
|
-
前提 "ブロック" タブを表示する
|
7
|
-
|
8
|
-
もし 次のブロックを配置する:
|
9
|
-
"""
|
10
|
-
%block{:type => "hardware_led_off", :x => "0", :y => "0"}
|
11
|
-
%field{:name => "PIN"}<
|
12
|
-
D13
|
13
|
-
"""
|
14
|
-
かつ ブロックからソースコードを生成する
|
15
|
-
|
16
|
-
ならば テキストエディタのプログラムは "" であること
|
17
|
-
|
18
|
-
シナリオ: キャラクターとブロックを配置する
|
19
|
-
前提 "ブロック" タブを表示する
|
20
|
-
かつ 次のキャラクターを追加する:
|
21
|
-
| name | costumes | x | y | angle |
|
22
|
-
| car1 | car1.png | 0 | 0 | 0 |
|
23
|
-
|
24
|
-
もし 次のブロックを配置する:
|
25
|
-
"""
|
26
|
-
%block{:type => "character_new", :x => "21", :y => "15"}
|
27
|
-
%field{:name => "NAME"}<
|
28
|
-
car1
|
29
|
-
%statement{:name => "DO"}
|
30
|
-
%block{:type => "hardware_led_off", :x => "0", :y => "0"}
|
31
|
-
%field{:name => "PIN"}<
|
32
|
-
D13
|
33
|
-
"""
|
34
|
-
かつ ブロックからソースコードを生成する
|
35
|
-
|
36
|
-
ならば テキストエディタのプログラムは以下であること:
|
37
|
-
"""
|
38
|
-
require "smalruby"
|
39
|
-
|
40
|
-
car1 = Character.new(costume: "car1.png", x: 0, y: 0, angle: 0)
|
41
|
-
car1.led("D13").off
|
42
|
-
|
43
|
-
"""
|
44
|
-
|
45
|
-
シナリオ: キャラクターとイベントとブロックを配置する
|
46
|
-
前提 "ブロック" タブを表示する
|
47
|
-
かつ 次のキャラクターを追加する:
|
48
|
-
| name | costumes | x | y | angle |
|
49
|
-
| car1 | car1.png | 0 | 0 | 0 |
|
50
|
-
|
51
|
-
もし 次のブロックを配置する:
|
52
|
-
"""
|
53
|
-
%block{:type => "character_new", :x => "21", :y => "15"}
|
54
|
-
%field{:name => "NAME"}<
|
55
|
-
car1
|
56
|
-
%statement{:name => "DO"}
|
57
|
-
%block{:type => "events_on_start"}
|
58
|
-
%statement{:name => "DO"}
|
59
|
-
%block{:type => "hardware_led_off", :x => "0", :y => "0"}
|
60
|
-
%field{:name => "PIN"}<
|
61
|
-
D13
|
62
|
-
"""
|
63
|
-
かつ ブロックからソースコードを生成する
|
64
|
-
|
65
|
-
ならば テキストエディタのプログラムは以下であること:
|
66
|
-
"""
|
67
|
-
require "smalruby"
|
68
|
-
|
69
|
-
car1 = Character.new(costume: "car1.png", x: 0, y: 0, angle: 0)
|
70
|
-
|
71
|
-
car1.on(:start) do
|
72
|
-
led("D13").off
|
73
|
-
end
|
74
|
-
|
75
|
-
"""
|
@@ -1,75 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
# language: ja
|
3
|
-
@javascript
|
4
|
-
機能: hardware_led_on - 「LED[▼ピン]をオンにする」ブロック
|
5
|
-
シナリオ: ブロックのみ配置する
|
6
|
-
前提 "ブロック" タブを表示する
|
7
|
-
|
8
|
-
もし 次のブロックを配置する:
|
9
|
-
"""
|
10
|
-
%block{:type => "hardware_led_on", :x => "0", :y => "0"}
|
11
|
-
%field{:name => "PIN"}<
|
12
|
-
D13
|
13
|
-
"""
|
14
|
-
かつ ブロックからソースコードを生成する
|
15
|
-
|
16
|
-
ならば テキストエディタのプログラムは "" であること
|
17
|
-
|
18
|
-
シナリオ: キャラクターとブロックを配置する
|
19
|
-
前提 "ブロック" タブを表示する
|
20
|
-
かつ 次のキャラクターを追加する:
|
21
|
-
| name | costumes | x | y | angle |
|
22
|
-
| car1 | car1.png | 0 | 0 | 0 |
|
23
|
-
|
24
|
-
もし 次のブロックを配置する:
|
25
|
-
"""
|
26
|
-
%block{:type => "character_new", :x => "21", :y => "15"}
|
27
|
-
%field{:name => "NAME"}<
|
28
|
-
car1
|
29
|
-
%statement{:name => "DO"}
|
30
|
-
%block{:type => "hardware_led_on", :x => "0", :y => "0"}
|
31
|
-
%field{:name => "PIN"}<
|
32
|
-
D13
|
33
|
-
"""
|
34
|
-
かつ ブロックからソースコードを生成する
|
35
|
-
|
36
|
-
ならば テキストエディタのプログラムは以下であること:
|
37
|
-
"""
|
38
|
-
require "smalruby"
|
39
|
-
|
40
|
-
car1 = Character.new(costume: "car1.png", x: 0, y: 0, angle: 0)
|
41
|
-
car1.led("D13").on
|
42
|
-
|
43
|
-
"""
|
44
|
-
|
45
|
-
シナリオ: キャラクターとイベントとブロックを配置する
|
46
|
-
前提 "ブロック" タブを表示する
|
47
|
-
かつ 次のキャラクターを追加する:
|
48
|
-
| name | costumes | x | y | angle |
|
49
|
-
| car1 | car1.png | 0 | 0 | 0 |
|
50
|
-
|
51
|
-
もし 次のブロックを配置する:
|
52
|
-
"""
|
53
|
-
%block{:type => "character_new", :x => "21", :y => "15"}
|
54
|
-
%field{:name => "NAME"}<
|
55
|
-
car1
|
56
|
-
%statement{:name => "DO"}
|
57
|
-
%block{:type => "events_on_start"}
|
58
|
-
%statement{:name => "DO"}
|
59
|
-
%block{:type => "hardware_led_on", :x => "0", :y => "0"}
|
60
|
-
%field{:name => "PIN"}<
|
61
|
-
D13
|
62
|
-
"""
|
63
|
-
かつ ブロックからソースコードを生成する
|
64
|
-
|
65
|
-
ならば テキストエディタのプログラムは以下であること:
|
66
|
-
"""
|
67
|
-
require "smalruby"
|
68
|
-
|
69
|
-
car1 = Character.new(costume: "car1.png", x: 0, y: 0, angle: 0)
|
70
|
-
|
71
|
-
car1.on(:start) do
|
72
|
-
led("D13").on
|
73
|
-
end
|
74
|
-
|
75
|
-
"""
|
@@ -1,87 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
# language: ja
|
3
|
-
@javascript
|
4
|
-
機能: hardware_on_button_down_or_up - 「ボタン[▼PIN]が[▼押された]とき」ブロック
|
5
|
-
シナリオ: ブロックのみ配置する
|
6
|
-
前提 "ブロック" タブを表示する
|
7
|
-
|
8
|
-
もし 次のブロックを配置する:
|
9
|
-
"""
|
10
|
-
%block{:type => "hardware_on_button_down_or_up", :x => "0", :y => "0"}
|
11
|
-
%field{:name => "PIN"}<
|
12
|
-
D2
|
13
|
-
%field{:name => "DOU"}<
|
14
|
-
down
|
15
|
-
"""
|
16
|
-
かつ ブロックからソースコードを生成する
|
17
|
-
|
18
|
-
ならば テキストエディタのプログラムは "" であること
|
19
|
-
|
20
|
-
シナリオ: キャラクターとブロックを配置する
|
21
|
-
前提 "ブロック" タブを表示する
|
22
|
-
かつ 次のキャラクターを追加する:
|
23
|
-
| name | costumes | x | y | angle |
|
24
|
-
| car1 | car1.png | 0 | 0 | 0 |
|
25
|
-
|
26
|
-
もし 次のブロックを配置する:
|
27
|
-
"""
|
28
|
-
%block{:type => "character_new", :x => "21", :y => "15"}
|
29
|
-
%field{:name => "NAME"}<
|
30
|
-
car1
|
31
|
-
%statement{:name => "DO"}
|
32
|
-
%block{:type => "hardware_on_button_down_or_up", :x => "0", :y => "0"}
|
33
|
-
%field{:name => "PIN"}<
|
34
|
-
D2
|
35
|
-
%field{:name => "DOU"}<
|
36
|
-
down
|
37
|
-
"""
|
38
|
-
かつ ブロックからソースコードを生成する
|
39
|
-
|
40
|
-
ならば テキストエディタのプログラムは以下であること:
|
41
|
-
"""
|
42
|
-
require "smalruby"
|
43
|
-
|
44
|
-
car1 = Character.new(costume: "car1.png", x: 0, y: 0, angle: 0)
|
45
|
-
|
46
|
-
car1.on(:button_down, "D2") do
|
47
|
-
|
48
|
-
end
|
49
|
-
|
50
|
-
"""
|
51
|
-
|
52
|
-
シナリオ: キャラクターとイベントとブロックを配置する
|
53
|
-
前提 "ブロック" タブを表示する
|
54
|
-
かつ 次のキャラクターを追加する:
|
55
|
-
| name | costumes | x | y | angle |
|
56
|
-
| car1 | car1.png | 0 | 0 | 0 |
|
57
|
-
|
58
|
-
もし 次のブロックを配置する:
|
59
|
-
"""
|
60
|
-
%block{:type => "character_new", :x => "21", :y => "15"}
|
61
|
-
%field{:name => "NAME"}<
|
62
|
-
car1
|
63
|
-
%statement{:name => "DO"}
|
64
|
-
%block{:type => "events_on_start"}
|
65
|
-
%statement{:name => "DO"}
|
66
|
-
%block{:type => "hardware_on_button_down_or_up", :x => "0", :y => "0"}
|
67
|
-
%field{:name => "PIN"}<
|
68
|
-
D2
|
69
|
-
%field{:name => "DOU"}<
|
70
|
-
up
|
71
|
-
"""
|
72
|
-
かつ ブロックからソースコードを生成する
|
73
|
-
|
74
|
-
ならば テキストエディタのプログラムは以下であること:
|
75
|
-
"""
|
76
|
-
require "smalruby"
|
77
|
-
|
78
|
-
car1 = Character.new(costume: "car1.png", x: 0, y: 0, angle: 0)
|
79
|
-
|
80
|
-
car1.on(:start) do
|
81
|
-
|
82
|
-
on(:button_up, "D2") do
|
83
|
-
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
"""
|