smalruby-editor 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of smalruby-editor might be problematic. Click here for more details.
- checksums.yaml +4 -4
 - data/.rubocop.yml +3 -0
 - data/Guardfile +2 -6
 - data/LEGAL +6 -0
 - data/README.rdoc +2 -0
 - data/app/assets/javascripts/application.js +1 -0
 - data/app/assets/javascripts/blocks/hardware.js.coffee.erb +37 -0
 - data/app/assets/javascripts/models/source_code.js +123 -0
 - data/app/assets/javascripts/msg/en_us.js +2 -0
 - data/app/assets/javascripts/msg/ja.js +2 -0
 - data/app/assets/javascripts/smalruby.js.coffee.erb +1 -1
 - data/app/assets/javascripts/views/character_modal_view.js.coffee +2 -0
 - data/app/assets/javascripts/views/character_selector_view.js.coffee +2 -2
 - data/app/assets/javascripts/views/load_modal_view.js.coffee.erb +2 -0
 - data/app/assets/javascripts/views/reset_modal_view.js.coffee +2 -0
 - data/app/assets/stylesheets/application.css +0 -0
 - data/app/assets/stylesheets/editor.css.scss +0 -0
 - data/app/assets/stylesheets/toolbox_raspberrypi.css.scss.erb +32 -0
 - data/app/assets/stylesheets/toolbox_smalrubot_s1.css.scss.erb +1 -0
 - data/app/controllers/editor_controller.rb +0 -0
 - data/app/helpers/application_helper.rb +5 -0
 - data/app/models/concerns/ruby_to_block/block/hardware_smalrubot_s1_dc_motor_power_ratio.rb +26 -0
 - data/app/models/concerns/ruby_to_block/block/hardware_smalrubot_s1_dc_motor_set_power_ratio.rb +21 -0
 - data/app/models/concerns/ruby_to_block/block/hardware_smalrubot_v3_motor_set_speed.rb +21 -0
 - data/app/models/concerns/ruby_to_block/block/hardware_smalrubot_v3_motor_speed.rb +26 -0
 - data/app/models/source_code.rb +0 -0
 - data/app/views/editor/_toolbox_default.html.haml +7 -3
 - data/app/views/editor/_toolbox_raspberrypi.html.haml +233 -0
 - data/app/views/editor/_toolbox_smalrubot_s1.html.haml +75 -51
 - data/app/views/editor/_toolbox_smalrubot_v3.html.haml +70 -55
 - data/app/views/editor/index.html.haml +0 -6
 - data/app/views/layouts/application.html.erb +1 -0
 - data/db/schema.rb +23 -23
 - data/lib/smalruby_editor.rb +5 -1
 - data/lib/smalruby_editor/config.rb +2 -0
 - data/lib/smalruby_editor/version.rb +1 -1
 - data/smalruby-editor.gemspec +1 -1
 - data/spec/acceptance/block_mode/blocks/hardware/smalrubot_s1_dc_motor_power_ratio.feature +116 -0
 - data/spec/javascripts/models/source_code_spec.coffee +5 -0
 - data/spec/models/concerns/ruby_to_block/block/hardware__smalrubot_s1_spec.rb +89 -1
 - data/spec/models/concerns/ruby_to_block/block/hardware__smalrubot_v3_spec.rb +433 -0
 - data/spec/models/concerns/ruby_to_block/block/hardware_spec.rb +0 -338
 - data/vendor/assets/javascripts/strftime-min.js +8 -0
 - metadata +27 -14
 - data/app/assets/javascripts/models/source_code.js.coffee +0 -80
 
| 
         @@ -35,42 +35,42 @@ 
     | 
|
| 
       35 
35 
     | 
    
         
             
                  = toolbox_key_field
         
     | 
| 
       36 
36 
     | 
    
         
             
                  = toolbox_pod_field
         
     | 
| 
       37 
37 
     | 
    
         | 
| 
      
 38 
     | 
    
         
            +
                -# キャラクターがクリックされたとき
         
     | 
| 
      
 39 
     | 
    
         
            +
                %block{:type => "#{category}_on_click"}
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
       38 
41 
     | 
    
         
             
              - category = 'control'
         
     | 
| 
       39 
42 
     | 
    
         
             
              %category{:name => tt('.control')}
         
     | 
| 
       40 
     | 
    
         
            -
                -#  
     | 
| 
       41 
     | 
    
         
            -
                %block{:type => "#{category} 
     | 
| 
      
 43 
     | 
    
         
            +
                -# ( )秒待つ
         
     | 
| 
      
 44 
     | 
    
         
            +
                %block{:type => "#{category}_sleep"}
         
     | 
| 
      
 45 
     | 
    
         
            +
                  = toolbox_number_value('SEC', 1)
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
                -# ほんの少し待つ
         
     | 
| 
      
 48 
     | 
    
         
            +
                %block{:type => "#{category}_await"}
         
     | 
| 
       42 
49 
     | 
    
         | 
| 
       43 
50 
     | 
    
         
             
                -# ( )回繰り返す
         
     | 
| 
       44 
51 
     | 
    
         
             
                %block{:type => "#{category}_times"}
         
     | 
| 
       45 
52 
     | 
    
         
             
                  = toolbox_number_value('COUNT', 10)
         
     | 
| 
       46 
53 
     | 
    
         | 
| 
       47 
     | 
    
         
            -
                -#  
     | 
| 
       48 
     | 
    
         
            -
                %block{:type => "#{category} 
     | 
| 
       49 
     | 
    
         
            -
             
     | 
| 
       50 
     | 
    
         
            -
                -# 繰り返しから脱出する
         
     | 
| 
       51 
     | 
    
         
            -
                %block{:type => "#{category}_break"}
         
     | 
| 
       52 
     | 
    
         
            -
             
     | 
| 
       53 
     | 
    
         
            -
                -# 次の繰り返しにジャンプする
         
     | 
| 
       54 
     | 
    
         
            -
                %block{:type => "#{category}_next"}
         
     | 
| 
      
 54 
     | 
    
         
            +
                -# ずっと
         
     | 
| 
      
 55 
     | 
    
         
            +
                %block{:type => "#{category}_loop"}
         
     | 
| 
       55 
56 
     | 
    
         | 
| 
       56 
     | 
    
         
            -
                -#  
     | 
| 
       57 
     | 
    
         
            -
                %block{:type => "#{category} 
     | 
| 
      
 57 
     | 
    
         
            +
                -# もし< >なら
         
     | 
| 
      
 58 
     | 
    
         
            +
                %block{:type => "#{category}_if"}
         
     | 
| 
       58 
59 
     | 
    
         | 
| 
       59 
     | 
    
         
            -
                -#  
     | 
| 
       60 
     | 
    
         
            -
                %block{:type => "#{category} 
     | 
| 
       61 
     | 
    
         
            -
                  = toolbox_number_value('SEC', 1)
         
     | 
| 
      
 60 
     | 
    
         
            +
                -# もし< >なら~でなければ
         
     | 
| 
      
 61 
     | 
    
         
            +
                %block{:type => "#{category}_if_else"}
         
     | 
| 
       62 
62 
     | 
    
         | 
| 
       63 
63 
     | 
    
         
             
                -# < >まで待つ
         
     | 
| 
       64 
64 
     | 
    
         
             
                %block{:type => "#{category}_await_until"}
         
     | 
| 
       65 
65 
     | 
    
         | 
| 
       66 
     | 
    
         
            -
                -#  
     | 
| 
       67 
     | 
    
         
            -
                %block{:type => "#{category} 
     | 
| 
      
 66 
     | 
    
         
            +
                -# < >まで繰り返す
         
     | 
| 
      
 67 
     | 
    
         
            +
                %block{:type => "#{category}_until"}
         
     | 
| 
       68 
68 
     | 
    
         | 
| 
       69 
     | 
    
         
            -
                -#  
     | 
| 
       70 
     | 
    
         
            -
                %block{:type => "#{category} 
     | 
| 
      
 69 
     | 
    
         
            +
                -# 繰り返しから脱出する
         
     | 
| 
      
 70 
     | 
    
         
            +
                %block{:type => "#{category}_break"}
         
     | 
| 
       71 
71 
     | 
    
         | 
| 
       72 
     | 
    
         
            -
                -#  
     | 
| 
       73 
     | 
    
         
            -
                %block{:type => "#{category} 
     | 
| 
      
 72 
     | 
    
         
            +
                -# 次の繰り返しにジャンプする
         
     | 
| 
      
 73 
     | 
    
         
            +
                %block{:type => "#{category}_next"}
         
     | 
| 
       74 
74 
     | 
    
         | 
| 
       75 
75 
     | 
    
         
             
              - category = 'sensing'
         
     | 
| 
       76 
76 
     | 
    
         
             
              %category{:name => tt('.sensing')}
         
     | 
| 
         @@ -104,20 +104,47 @@ 
     | 
|
| 
       104 
104 
     | 
    
         | 
| 
       105 
105 
     | 
    
         
             
              - category = 'operators'
         
     | 
| 
       106 
106 
     | 
    
         
             
              %category{:name => tt('.operators')}
         
     | 
| 
      
 107 
     | 
    
         
            +
                -# 数値
         
     | 
| 
      
 108 
     | 
    
         
            +
                %block{:type => 'math_number'}
         
     | 
| 
      
 109 
     | 
    
         
            +
                  %field{:name => 'NUM'}<
         
     | 
| 
      
 110 
     | 
    
         
            +
                    0
         
     | 
| 
      
 111 
     | 
    
         
            +
             
     | 
| 
      
 112 
     | 
    
         
            +
                -# テキスト
         
     | 
| 
      
 113 
     | 
    
         
            +
                %block{:type => 'text'}
         
     | 
| 
      
 114 
     | 
    
         
            +
                  %field{:name => 'TEXT'}<
         
     | 
| 
      
 115 
     | 
    
         
            +
                    = tt('.text')
         
     | 
| 
      
 116 
     | 
    
         
            +
             
     | 
| 
      
 117 
     | 
    
         
            +
                -# 変数:( ) + ( )
         
     | 
| 
      
 118 
     | 
    
         
            +
                %block{:type => "#{category}_add"}
         
     | 
| 
      
 119 
     | 
    
         
            +
             
     | 
| 
      
 120 
     | 
    
         
            +
                -# 変数:( ) - ( )
         
     | 
| 
      
 121 
     | 
    
         
            +
                %block{:type => "#{category}_minus"}
         
     | 
| 
      
 122 
     | 
    
         
            +
             
     | 
| 
      
 123 
     | 
    
         
            +
                -# 変数:( ) * ( )
         
     | 
| 
      
 124 
     | 
    
         
            +
                %block{:type => "#{category}_multiply"}
         
     | 
| 
      
 125 
     | 
    
         
            +
             
     | 
| 
      
 126 
     | 
    
         
            +
                -# 変数:( ) / ( )
         
     | 
| 
      
 127 
     | 
    
         
            +
                %block{:type => "#{category}_divide"}
         
     | 
| 
      
 128 
     | 
    
         
            +
             
     | 
| 
      
 129 
     | 
    
         
            +
                -# 変数:( )から( )までの乱数
         
     | 
| 
      
 130 
     | 
    
         
            +
                %block{:type => "#{category}_rand"}
         
     | 
| 
      
 131 
     | 
    
         
            +
                  = toolbox_number_value('A', 1)
         
     | 
| 
      
 132 
     | 
    
         
            +
                  = toolbox_number_value('B', 10)
         
     | 
| 
      
 133 
     | 
    
         
            +
             
     | 
| 
       107 
134 
     | 
    
         
             
                -# 条件:( ) < ( )
         
     | 
| 
       108 
     | 
    
         
            -
                %block{:type => "#{category} 
     | 
| 
      
 135 
     | 
    
         
            +
                %block{:type => "#{category}_compare_lt"}
         
     | 
| 
       109 
136 
     | 
    
         | 
| 
       110 
137 
     | 
    
         
             
                -# 条件:( ) <= ( )
         
     | 
| 
       111 
     | 
    
         
            -
                %block{:type => "#{category} 
     | 
| 
      
 138 
     | 
    
         
            +
                %block{:type => "#{category}_compare_lte"}
         
     | 
| 
       112 
139 
     | 
    
         | 
| 
       113 
140 
     | 
    
         
             
                -# 条件:( ) = ( )
         
     | 
| 
       114 
141 
     | 
    
         
             
                %block{:type => "#{category}_compare_eq"}
         
     | 
| 
       115 
142 
     | 
    
         | 
| 
       116 
143 
     | 
    
         
             
                -# 条件:( ) >= ( )
         
     | 
| 
       117 
     | 
    
         
            -
                %block{:type => "#{category} 
     | 
| 
      
 144 
     | 
    
         
            +
                %block{:type => "#{category}_compare_gte"}
         
     | 
| 
       118 
145 
     | 
    
         | 
| 
       119 
146 
     | 
    
         
             
                -# 条件:( ) > ( )
         
     | 
| 
       120 
     | 
    
         
            -
                %block{:type => "#{category} 
     | 
| 
      
 147 
     | 
    
         
            +
                %block{:type => "#{category}_compare_gt"}
         
     | 
| 
       121 
148 
     | 
    
         | 
| 
       122 
149 
     | 
    
         
             
                -# 条件:< > かつ < >
         
     | 
| 
       123 
150 
     | 
    
         
             
                %block{:type => "#{category}_and"}
         
     | 
| 
         @@ -128,35 +155,21 @@ 
     | 
|
| 
       128 
155 
     | 
    
         
             
                -# 条件:< > ではない
         
     | 
| 
       129 
156 
     | 
    
         
             
                %block{:type => "#{category}_negate"}
         
     | 
| 
       130 
157 
     | 
    
         | 
| 
       131 
     | 
    
         
            -
                -#  
     | 
| 
       132 
     | 
    
         
            -
                %block{:type => "#{category} 
     | 
| 
       133 
     | 
    
         
            -
             
     | 
| 
       134 
     | 
    
         
            -
             
     | 
| 
       135 
     | 
    
         
            -
                %block{:type => "#{category}_false"}
         
     | 
| 
       136 
     | 
    
         
            -
             
     | 
| 
       137 
     | 
    
         
            -
                -# 変数:( ) + ( )
         
     | 
| 
       138 
     | 
    
         
            -
                %block{:type => "#{category}_add"}
         
     | 
| 
      
 158 
     | 
    
         
            +
                -# 変数:( )の( )番目
         
     | 
| 
      
 159 
     | 
    
         
            +
                %block{:type => "#{category}_index_of"}
         
     | 
| 
      
 160 
     | 
    
         
            +
                  = toolbox_text_value('A', tt('.world'))
         
     | 
| 
      
 161 
     | 
    
         
            +
                  = toolbox_number_value('INDEX', 1)
         
     | 
| 
       139 
162 
     | 
    
         | 
| 
       140 
     | 
    
         
            -
                -# 変数:( ) 
     | 
| 
       141 
     | 
    
         
            -
                %block{:type => "#{category} 
     | 
| 
       142 
     | 
    
         
            -
             
     | 
| 
       143 
     | 
    
         
            -
                -# 変数:( ) * ( )
         
     | 
| 
       144 
     | 
    
         
            -
                %block{:type => "#{category}_multiply"}
         
     | 
| 
       145 
     | 
    
         
            -
             
     | 
| 
       146 
     | 
    
         
            -
                -# 変数:( ) / ( )
         
     | 
| 
       147 
     | 
    
         
            -
                %block{:type => "#{category}_divide"}
         
     | 
| 
       148 
     | 
    
         
            -
             
     | 
| 
       149 
     | 
    
         
            -
                -# 変数:( )から( )までの乱数
         
     | 
| 
       150 
     | 
    
         
            -
                %block{:type => "#{category}_rand"}
         
     | 
| 
       151 
     | 
    
         
            -
                  = toolbox_number_value('A', 1)
         
     | 
| 
       152 
     | 
    
         
            -
                  = toolbox_number_value('B', 10)
         
     | 
| 
      
 163 
     | 
    
         
            +
                -# 変数:( )の長さ
         
     | 
| 
      
 164 
     | 
    
         
            +
                %block{:type => "#{category}_length"}
         
     | 
| 
      
 165 
     | 
    
         
            +
                  = toolbox_text_value('A', tt('.world'))
         
     | 
| 
       153 
166 
     | 
    
         | 
| 
       154 
167 
     | 
    
         
             
                -# 変数:( )を( )で割った余り
         
     | 
| 
       155 
168 
     | 
    
         
             
                %block{:type => "#{category}_modulo"}
         
     | 
| 
       156 
169 
     | 
    
         
             
                  = toolbox_number_value('A', 5)
         
     | 
| 
       157 
170 
     | 
    
         
             
                  = toolbox_number_value('B', 2)
         
     | 
| 
       158 
171 
     | 
    
         | 
| 
       159 
     | 
    
         
            -
                -# 変数:( ) 
     | 
| 
      
 172 
     | 
    
         
            +
                -# 変数:( )を四捨五入
         
     | 
| 
       160 
173 
     | 
    
         
             
                %block{:type => "#{category}_round"}
         
     | 
| 
       161 
174 
     | 
    
         
             
                  = toolbox_number_value('A', 0.5)
         
     | 
| 
       162 
175 
     | 
    
         | 
| 
         @@ -166,12 +179,14 @@ 
     | 
|
| 
       166 
179 
     | 
    
         
             
                  %field{:name => 'METHOD'}<
         
     | 
| 
       167 
180 
     | 
    
         
             
                    Math.sqrt(%num%)
         
     | 
| 
       168 
181 
     | 
    
         | 
| 
       169 
     | 
    
         
            -
                -#  
     | 
| 
       170 
     | 
    
         
            -
                %block{:type =>  
     | 
| 
       171 
     | 
    
         
            -
                  %field{:name => 'NUM'}<
         
     | 
| 
       172 
     | 
    
         
            -
                    0
         
     | 
| 
      
 182 
     | 
    
         
            +
                -# 条件:真
         
     | 
| 
      
 183 
     | 
    
         
            +
                %block{:type => "#{category}_true"}
         
     | 
| 
       173 
184 
     | 
    
         | 
| 
       174 
     | 
    
         
            -
             
     | 
| 
       175 
     | 
    
         
            -
                 
     | 
| 
       176 
     | 
    
         
            -
             
     | 
| 
       177 
     | 
    
         
            -
             
     | 
| 
      
 185 
     | 
    
         
            +
                -# 条件:偽
         
     | 
| 
      
 186 
     | 
    
         
            +
                %block{:type => "#{category}_false"}
         
     | 
| 
      
 187 
     | 
    
         
            +
             
     | 
| 
      
 188 
     | 
    
         
            +
              - if !SmalrubyEditor::Config.enabled?('auto_init_hardware')
         
     | 
| 
      
 189 
     | 
    
         
            +
                %category{:name => tt('.etc')}
         
     | 
| 
      
 190 
     | 
    
         
            +
                  - category = 'hardware'
         
     | 
| 
      
 191 
     | 
    
         
            +
                  -# ハードウェアを準備する
         
     | 
| 
      
 192 
     | 
    
         
            +
                  %block{:type => "#{category}_init_hardware"}
         
     | 
| 
         @@ -125,12 +125,6 @@ 
     | 
|
| 
       125 
125 
     | 
    
         
             
            = render 'load_modal'
         
     | 
| 
       126 
126 
     | 
    
         
             
            = render 'reset_modal'
         
     | 
| 
       127 
127 
     | 
    
         | 
| 
       128 
     | 
    
         
            -
            - if raspberrypi?
         
     | 
| 
       129 
     | 
    
         
            -
              :javascript
         
     | 
| 
       130 
     | 
    
         
            -
                $(function() {
         
     | 
| 
       131 
     | 
    
         
            -
                  $('div[aria-level="1"][aria-posinset="4"],div[aria-level="1"][aria-posinset="10"]').hide();
         
     | 
| 
       132 
     | 
    
         
            -
                });
         
     | 
| 
       133 
     | 
    
         
            -
             
     | 
| 
       134 
128 
     | 
    
         
             
            - if session[:username]
         
     | 
| 
       135 
129 
     | 
    
         
             
              :javascript
         
     | 
| 
       136 
130 
     | 
    
         
             
                window.Smalruby.username = '#{h session[:username]}';
         
     | 
| 
         @@ -16,6 +16,7 @@ 
     | 
|
| 
       16 
16 
     | 
    
         
             
              <%= stylesheet_link_tag    "toolbox_#{toolbox_css_name}", media: "all" %>
         
     | 
| 
       17 
17 
     | 
    
         
             
              <%= javascript_include_tag "application" %>
         
     | 
| 
       18 
18 
     | 
    
         
             
              <%= javascript_include_tag "blockly/msg/js/#{blockly_message_locale_name}" %>
         
     | 
| 
      
 19 
     | 
    
         
            +
              <%= javascript_include_tag "msg/#{blockly_message_default_locale_name}" %>
         
     | 
| 
       19 
20 
     | 
    
         
             
              <%= javascript_include_tag "msg/#{blockly_message_locale_name}" %>
         
     | 
| 
       20 
21 
     | 
    
         
             
              <%= csrf_meta_tags %>
         
     | 
| 
       21 
22 
     | 
    
         
             
            </head>
         
     | 
    
        data/db/schema.rb
    CHANGED
    
    | 
         @@ -1,23 +1,23 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # encoding: UTF-8
         
     | 
| 
       2 
     | 
    
         
            -
            # This file is auto-generated from the current state of the database. Instead
         
     | 
| 
       3 
     | 
    
         
            -
            # of editing this file, please use the migrations feature of Active Record to
         
     | 
| 
       4 
     | 
    
         
            -
            # incrementally modify your database, and then regenerate this schema definition.
         
     | 
| 
       5 
     | 
    
         
            -
            #
         
     | 
| 
       6 
     | 
    
         
            -
            # Note that this schema.rb definition is the authoritative source for your
         
     | 
| 
       7 
     | 
    
         
            -
            # database schema. If you need to create the application database on another
         
     | 
| 
       8 
     | 
    
         
            -
            # system, you should be using db:schema:load, not running all the migrations
         
     | 
| 
       9 
     | 
    
         
            -
            # from scratch. The latter is a flawed and unsustainable approach (the more migrations
         
     | 
| 
       10 
     | 
    
         
            -
            # you'll amass, the slower it'll run and the greater likelihood for issues).
         
     | 
| 
       11 
     | 
    
         
            -
            #
         
     | 
| 
       12 
     | 
    
         
            -
            # It's strongly recommended that you check this file into your version control system.
         
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
            ActiveRecord::Schema.define(version: 20131219045113) do
         
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
              create_table "source_codes", force: true do |t|
         
     | 
| 
       17 
     | 
    
         
            -
                t.text     "data"
         
     | 
| 
       18 
     | 
    
         
            -
                t.datetime "created_at"
         
     | 
| 
       19 
     | 
    
         
            -
                t.datetime "updated_at"
         
     | 
| 
       20 
     | 
    
         
            -
                t.string   "filename"
         
     | 
| 
       21 
     | 
    
         
            -
              end
         
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
            end
         
     | 
| 
      
 1 
     | 
    
         
            +
            # encoding: UTF-8
         
     | 
| 
      
 2 
     | 
    
         
            +
            # This file is auto-generated from the current state of the database. Instead
         
     | 
| 
      
 3 
     | 
    
         
            +
            # of editing this file, please use the migrations feature of Active Record to
         
     | 
| 
      
 4 
     | 
    
         
            +
            # incrementally modify your database, and then regenerate this schema definition.
         
     | 
| 
      
 5 
     | 
    
         
            +
            #
         
     | 
| 
      
 6 
     | 
    
         
            +
            # Note that this schema.rb definition is the authoritative source for your
         
     | 
| 
      
 7 
     | 
    
         
            +
            # database schema. If you need to create the application database on another
         
     | 
| 
      
 8 
     | 
    
         
            +
            # system, you should be using db:schema:load, not running all the migrations
         
     | 
| 
      
 9 
     | 
    
         
            +
            # from scratch. The latter is a flawed and unsustainable approach (the more migrations
         
     | 
| 
      
 10 
     | 
    
         
            +
            # you'll amass, the slower it'll run and the greater likelihood for issues).
         
     | 
| 
      
 11 
     | 
    
         
            +
            #
         
     | 
| 
      
 12 
     | 
    
         
            +
            # It's strongly recommended that you check this file into your version control system.
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
            ActiveRecord::Schema.define(version: 20131219045113) do
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
              create_table "source_codes", force: true do |t|
         
     | 
| 
      
 17 
     | 
    
         
            +
                t.text     "data"
         
     | 
| 
      
 18 
     | 
    
         
            +
                t.datetime "created_at"
         
     | 
| 
      
 19 
     | 
    
         
            +
                t.datetime "updated_at"
         
     | 
| 
      
 20 
     | 
    
         
            +
                t.string   "filename"
         
     | 
| 
      
 21 
     | 
    
         
            +
              end
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
            end
         
     | 
    
        data/lib/smalruby_editor.rb
    CHANGED
    
    | 
         @@ -128,9 +128,13 @@ standalone: 
     | 
|
| 
       128 
128 
     | 
    
         | 
| 
       129 
129 
     | 
    
         
             
                CONFIG_YML_TEMPLATE = <<-EOS
         
     | 
| 
       130 
130 
     | 
    
         
             
            #toolbox_name: default
         
     | 
| 
      
 131 
     | 
    
         
            +
            #toolbox_name: raspberrypi
         
     | 
| 
      
 132 
     | 
    
         
            +
            #toolbox_name: smalrubot_v3
         
     | 
| 
      
 133 
     | 
    
         
            +
            #toolbox_name: smalrubot_s1
         
     | 
| 
      
 134 
     | 
    
         
            +
            #toolbox_name: default
         
     | 
| 
       131 
135 
     | 
    
         
             
            #toolbox_css_name: default
         
     | 
| 
       132 
136 
     | 
    
         
             
            features:
         
     | 
| 
       133 
     | 
    
         
            -
               
     | 
| 
      
 137 
     | 
    
         
            +
              #- disabled_add_character_from_beginning
         
     | 
| 
       134 
138 
     | 
    
         
             
              #- disabled_new_character
         
     | 
| 
       135 
139 
     | 
    
         
             
              #- auto_init_hardware
         
     | 
| 
       136 
140 
     | 
    
         
             
              #- readonly_ruby_mode
         
     | 
    
        data/smalruby-editor.gemspec
    CHANGED
    
    
| 
         @@ -0,0 +1,116 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # encoding: utf-8
         
     | 
| 
      
 2 
     | 
    
         
            +
            # language: en
         
     | 
| 
      
 3 
     | 
    
         
            +
            @javascript
         
     | 
| 
      
 4 
     | 
    
         
            +
            Feature: hardware_smalrubot_s1_dc_motor_{,set_}power_ratio block
         
     | 
| 
      
 5 
     | 
    
         
            +
              Background:
         
     | 
| 
      
 6 
     | 
    
         
            +
                Given "ブロック" タブを表示する
         
     | 
| 
      
 7 
     | 
    
         
            +
                And キャラクターcar1を追加する
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
              Scenario: ブロックのみ配置する
         
     | 
| 
      
 10 
     | 
    
         
            +
                When 次のブロックを配置する:
         
     | 
| 
      
 11 
     | 
    
         
            +
                  """
         
     | 
| 
      
 12 
     | 
    
         
            +
                  %block{:type => "hardware_smalrubot_s1_dc_motor_power_ratio"}
         
     | 
| 
      
 13 
     | 
    
         
            +
                    %field{:name => "LOR"}<
         
     | 
| 
      
 14 
     | 
    
         
            +
                      right
         
     | 
| 
      
 15 
     | 
    
         
            +
                  """
         
     | 
| 
      
 16 
     | 
    
         
            +
                And ブロックからソースコードを生成する
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
                Then テキストエディタのプログラムは "" であること
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
              Scenario: 文とブロックを配置する
         
     | 
| 
      
 21 
     | 
    
         
            +
                When 次のブロックを配置する:
         
     | 
| 
      
 22 
     | 
    
         
            +
                  """
         
     | 
| 
      
 23 
     | 
    
         
            +
                  %block{:type => "ruby_p", :x => "0", :y => "0", :inline => "true" }
         
     | 
| 
      
 24 
     | 
    
         
            +
                    %value{:name => "ARG"}
         
     | 
| 
      
 25 
     | 
    
         
            +
                      %block{:type => "hardware_smalrubot_s1_dc_motor_power_ratio"}
         
     | 
| 
      
 26 
     | 
    
         
            +
                        %field{:name => "LOR"}<
         
     | 
| 
      
 27 
     | 
    
         
            +
                          right
         
     | 
| 
      
 28 
     | 
    
         
            +
                    %next
         
     | 
| 
      
 29 
     | 
    
         
            +
                      %block{:type => "hardware_smalrubot_s1_dc_motor_set_power_ratio"}
         
     | 
| 
      
 30 
     | 
    
         
            +
                        %field{:name => "LOR"}<
         
     | 
| 
      
 31 
     | 
    
         
            +
                          left
         
     | 
| 
      
 32 
     | 
    
         
            +
                        %value{:name => "SPEED"}
         
     | 
| 
      
 33 
     | 
    
         
            +
                          %block{:type => "math_number"}
         
     | 
| 
      
 34 
     | 
    
         
            +
                            %field{:name => "NUM"}<
         
     | 
| 
      
 35 
     | 
    
         
            +
                              50
         
     | 
| 
      
 36 
     | 
    
         
            +
                  """
         
     | 
| 
      
 37 
     | 
    
         
            +
                And ブロックからソースコードを生成する
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
                Then テキストエディタのプログラムは以下であること:
         
     | 
| 
      
 40 
     | 
    
         
            +
                  """
         
     | 
| 
      
 41 
     | 
    
         
            +
                  require "smalruby"
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
                  p("")
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
                  """
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
              Scenario: キャラクターとブロックを配置する
         
     | 
| 
      
 48 
     | 
    
         
            +
                When 次のブロックを配置する:
         
     | 
| 
      
 49 
     | 
    
         
            +
                  """
         
     | 
| 
      
 50 
     | 
    
         
            +
                  %block{:type => "character_new", :x => "21", :y => "15"}
         
     | 
| 
      
 51 
     | 
    
         
            +
                    %field{:name => "NAME"}<
         
     | 
| 
      
 52 
     | 
    
         
            +
                      car1
         
     | 
| 
      
 53 
     | 
    
         
            +
                    %statement{:name => "DO"}
         
     | 
| 
      
 54 
     | 
    
         
            +
                      %block{:type => "ruby_p", :x => "0", :y => "0", :inline => "true" }
         
     | 
| 
      
 55 
     | 
    
         
            +
                        %value{:name => "ARG"}
         
     | 
| 
      
 56 
     | 
    
         
            +
                          %block{:type => "hardware_smalrubot_s1_dc_motor_power_ratio"}
         
     | 
| 
      
 57 
     | 
    
         
            +
                            %field{:name => "LOR"}<
         
     | 
| 
      
 58 
     | 
    
         
            +
                              right
         
     | 
| 
      
 59 
     | 
    
         
            +
                        %next
         
     | 
| 
      
 60 
     | 
    
         
            +
                          %block{:type => "hardware_smalrubot_s1_dc_motor_set_power_ratio"}
         
     | 
| 
      
 61 
     | 
    
         
            +
                            %field{:name => "LOR"}<
         
     | 
| 
      
 62 
     | 
    
         
            +
                              left
         
     | 
| 
      
 63 
     | 
    
         
            +
                            %value{:name => "SPEED"}
         
     | 
| 
      
 64 
     | 
    
         
            +
                              %block{:type => "math_number"}
         
     | 
| 
      
 65 
     | 
    
         
            +
                                %field{:name => "NUM"}<
         
     | 
| 
      
 66 
     | 
    
         
            +
                                  50
         
     | 
| 
      
 67 
     | 
    
         
            +
                  """
         
     | 
| 
      
 68 
     | 
    
         
            +
                And ブロックからソースコードを生成する
         
     | 
| 
      
 69 
     | 
    
         
            +
             
     | 
| 
      
 70 
     | 
    
         
            +
                Then テキストエディタのプログラムは以下であること:
         
     | 
| 
      
 71 
     | 
    
         
            +
                  """
         
     | 
| 
      
 72 
     | 
    
         
            +
                  require "smalruby"
         
     | 
| 
      
 73 
     | 
    
         
            +
             
     | 
| 
      
 74 
     | 
    
         
            +
                  car1 = Character.new(costume: "car1.png", x: 0, y: 0, angle: 0)
         
     | 
| 
      
 75 
     | 
    
         
            +
                  p(car1.smalrubot_s1.right_dc_motor_power_ratio)
         
     | 
| 
      
 76 
     | 
    
         
            +
                  car1.smalrubot_s1.left_dc_motor_power_ratio = 50
         
     | 
| 
      
 77 
     | 
    
         
            +
             
     | 
| 
      
 78 
     | 
    
         
            +
                  """
         
     | 
| 
      
 79 
     | 
    
         
            +
             
     | 
| 
      
 80 
     | 
    
         
            +
              Scenario: キャラクターとイベントとブロックを配置する
         
     | 
| 
      
 81 
     | 
    
         
            +
                When 次のブロックを配置する:
         
     | 
| 
      
 82 
     | 
    
         
            +
                  """
         
     | 
| 
      
 83 
     | 
    
         
            +
                  %block{:type => "character_new", :x => "21", :y => "15"}
         
     | 
| 
      
 84 
     | 
    
         
            +
                    %field{:name => "NAME"}<
         
     | 
| 
      
 85 
     | 
    
         
            +
                      car1
         
     | 
| 
      
 86 
     | 
    
         
            +
                    %statement{:name => "DO"}
         
     | 
| 
      
 87 
     | 
    
         
            +
                      %block{:type => "events_on_start"}
         
     | 
| 
      
 88 
     | 
    
         
            +
                        %statement{:name => "DO"}
         
     | 
| 
      
 89 
     | 
    
         
            +
                          %block{:type => "ruby_p", :x => "0", :y => "0", :inline => "true" }
         
     | 
| 
      
 90 
     | 
    
         
            +
                            %value{:name => "ARG"}
         
     | 
| 
      
 91 
     | 
    
         
            +
                              %block{:type => "hardware_smalrubot_s1_dc_motor_power_ratio"}
         
     | 
| 
      
 92 
     | 
    
         
            +
                                %field{:name => "LOR"}<
         
     | 
| 
      
 93 
     | 
    
         
            +
                                  right
         
     | 
| 
      
 94 
     | 
    
         
            +
                            %next
         
     | 
| 
      
 95 
     | 
    
         
            +
                              %block{:type => "hardware_smalrubot_s1_dc_motor_set_power_ratio"}
         
     | 
| 
      
 96 
     | 
    
         
            +
                                %field{:name => "LOR"}<
         
     | 
| 
      
 97 
     | 
    
         
            +
                                  left
         
     | 
| 
      
 98 
     | 
    
         
            +
                                %value{:name => "SPEED"}
         
     | 
| 
      
 99 
     | 
    
         
            +
                                  %block{:type => "math_number"}
         
     | 
| 
      
 100 
     | 
    
         
            +
                                    %field{:name => "NUM"}<
         
     | 
| 
      
 101 
     | 
    
         
            +
                                      50
         
     | 
| 
      
 102 
     | 
    
         
            +
                  """
         
     | 
| 
      
 103 
     | 
    
         
            +
                And ブロックからソースコードを生成する
         
     | 
| 
      
 104 
     | 
    
         
            +
             
     | 
| 
      
 105 
     | 
    
         
            +
                Then テキストエディタのプログラムは以下であること:
         
     | 
| 
      
 106 
     | 
    
         
            +
                  """
         
     | 
| 
      
 107 
     | 
    
         
            +
                  require "smalruby"
         
     | 
| 
      
 108 
     | 
    
         
            +
             
     | 
| 
      
 109 
     | 
    
         
            +
                  car1 = Character.new(costume: "car1.png", x: 0, y: 0, angle: 0)
         
     | 
| 
      
 110 
     | 
    
         
            +
             
     | 
| 
      
 111 
     | 
    
         
            +
                  car1.on(:start) do
         
     | 
| 
      
 112 
     | 
    
         
            +
                    p(smalrubot_s1.right_dc_motor_power_ratio)
         
     | 
| 
      
 113 
     | 
    
         
            +
                    self.smalrubot_s1.left_dc_motor_power_ratio = 50
         
     | 
| 
      
 114 
     | 
    
         
            +
                  end
         
     | 
| 
      
 115 
     | 
    
         
            +
             
     | 
| 
      
 116 
     | 
    
         
            +
                  """
         
     | 
| 
         @@ -38,3 +38,8 @@ describe 'Smalruby.SourceCode', -> 
     | 
|
| 
       38 
38 
     | 
    
         | 
| 
       39 
39 
     | 
    
         
             
                  it '01.rb.xmlを返すこと', ->
         
     | 
| 
       40 
40 
     | 
    
         
             
                    expect(self.getRbxmlFilename()).to.equal('01.rb.xml')
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
              describe '.defaultFilename', ->
         
     | 
| 
      
 43 
     | 
    
         
            +
                it 'program_<日付>.rbを返すこと', ->
         
     | 
| 
      
 44 
     | 
    
         
            +
                  now = new Date(2015, 2 - 1, 10, 12, 10, 59)
         
     | 
| 
      
 45 
     | 
    
         
            +
                  expect(Smalruby.SourceCode.defaultFilename(now)).to.equal('program_150210_121059.rb')
         
     | 
| 
         @@ -4,7 +4,7 @@ require_relative 'shared/block_examples' 
     | 
|
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
            # rubocop:disable EmptyLines, LineLength
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
     | 
    
         
            -
            describe RubyToBlock::Block, 'Smalrubot  
     | 
| 
      
 7 
     | 
    
         
            +
            describe RubyToBlock::Block, 'Smalrubot s1 blocks', to_blocks: true do
         
     | 
| 
       8 
8 
     | 
    
         
             
              parts = <<-EOS
         
     | 
| 
       9 
9 
     | 
    
         
             
            require "smalruby"
         
     | 
| 
       10 
10 
     | 
    
         | 
| 
         @@ -29,6 +29,12 @@ car1.on(:start) do 
     | 
|
| 
       29 
29 
     | 
    
         | 
| 
       30 
30 
     | 
    
         
             
              smalrubot_s1.turn_on_white_led
         
     | 
| 
       31 
31 
     | 
    
         
             
              smalrubot_s1.turn_off_blue_led
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
              p(smalrubot_s1.left_dc_motor_power_ratio)
         
     | 
| 
      
 34 
     | 
    
         
            +
              p(smalrubot_s1.right_dc_motor_power_ratio)
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
              smalrubot_s1.left_dc_motor_power_ratio = 10
         
     | 
| 
      
 37 
     | 
    
         
            +
              smalrubot_s1.right_dc_motor_power_ratio = 90
         
     | 
| 
       32 
38 
     | 
    
         
             
            end
         
     | 
| 
       33 
39 
     | 
    
         
             
            car1.smalrubot_s1.forward
         
     | 
| 
       34 
40 
     | 
    
         
             
            car1.smalrubot_s1.backward
         
     | 
| 
         @@ -47,6 +53,12 @@ p(car1.smalrubot_s1.right_ir_photoreflector_value) 
     | 
|
| 
       47 
53 
     | 
    
         | 
| 
       48 
54 
     | 
    
         
             
            car1.smalrubot_s1.turn_on_white_led
         
     | 
| 
       49 
55 
     | 
    
         
             
            car1.smalrubot_s1.turn_off_blue_led
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
            p(car1.smalrubot_s1.left_dc_motor_power_ratio)
         
     | 
| 
      
 58 
     | 
    
         
            +
            p(car1.smalrubot_s1.right_dc_motor_power_ratio)
         
     | 
| 
      
 59 
     | 
    
         
            +
             
     | 
| 
      
 60 
     | 
    
         
            +
            car1.smalrubot_s1.left_dc_motor_power_ratio = 10
         
     | 
| 
      
 61 
     | 
    
         
            +
            car1.smalrubot_s1.right_dc_motor_power_ratio = 90
         
     | 
| 
       50 
62 
     | 
    
         
             
              EOS
         
     | 
| 
       51 
63 
     | 
    
         
             
              describe compact_source_code(parts) do
         
     | 
| 
       52 
64 
     | 
    
         
             
                _parts = parts
         
     | 
| 
         @@ -137,6 +149,44 @@ car1.smalrubot_s1.turn_off_blue_led 
     | 
|
| 
       137 
149 
     | 
    
         
             
                                                                          <block type="hardware_smalrubot_s1_led_turn_on_or_off" inline="true">
         
     | 
| 
       138 
150 
     | 
    
         
             
                                                                            <field name="COLOUR">blue</field>
         
     | 
| 
       139 
151 
     | 
    
         
             
                                                                            <field name="OOO">turn_off</field>
         
     | 
| 
      
 152 
     | 
    
         
            +
                                                                            <next>
         
     | 
| 
      
 153 
     | 
    
         
            +
                                                                              <block type="ruby_p" inline="true">
         
     | 
| 
      
 154 
     | 
    
         
            +
                                                                                <value name="ARG">
         
     | 
| 
      
 155 
     | 
    
         
            +
                                                                                  <block type="hardware_smalrubot_s1_dc_motor_power_ratio">
         
     | 
| 
      
 156 
     | 
    
         
            +
                                                                                    <field name="LOR">left</field>
         
     | 
| 
      
 157 
     | 
    
         
            +
                                                                                  </block>
         
     | 
| 
      
 158 
     | 
    
         
            +
                                                                                </value>
         
     | 
| 
      
 159 
     | 
    
         
            +
                                                                                <next>
         
     | 
| 
      
 160 
     | 
    
         
            +
                                                                                  <block type="ruby_p" inline="true">
         
     | 
| 
      
 161 
     | 
    
         
            +
                                                                                    <value name="ARG">
         
     | 
| 
      
 162 
     | 
    
         
            +
                                                                                      <block type="hardware_smalrubot_s1_dc_motor_power_ratio">
         
     | 
| 
      
 163 
     | 
    
         
            +
                                                                                        <field name="LOR">right</field>
         
     | 
| 
      
 164 
     | 
    
         
            +
                                                                                      </block>
         
     | 
| 
      
 165 
     | 
    
         
            +
                                                                                    </value>
         
     | 
| 
      
 166 
     | 
    
         
            +
                                                                                    <next>
         
     | 
| 
      
 167 
     | 
    
         
            +
                                                                                      <block type="hardware_smalrubot_s1_dc_motor_set_power_ratio" inline="true">
         
     | 
| 
      
 168 
     | 
    
         
            +
                                                                                        <field name="LOR">left</field>
         
     | 
| 
      
 169 
     | 
    
         
            +
                                                                                        <value name="SPEED">
         
     | 
| 
      
 170 
     | 
    
         
            +
                                                                                          <block type="math_number">
         
     | 
| 
      
 171 
     | 
    
         
            +
                                                                                            <field name="NUM">10</field>
         
     | 
| 
      
 172 
     | 
    
         
            +
                                                                                          </block>
         
     | 
| 
      
 173 
     | 
    
         
            +
                                                                                        </value>
         
     | 
| 
      
 174 
     | 
    
         
            +
                                                                                        <next>
         
     | 
| 
      
 175 
     | 
    
         
            +
                                                                                          <block type="hardware_smalrubot_s1_dc_motor_set_power_ratio" inline="true">
         
     | 
| 
      
 176 
     | 
    
         
            +
                                                                                            <field name="LOR">right</field>
         
     | 
| 
      
 177 
     | 
    
         
            +
                                                                                            <value name="SPEED">
         
     | 
| 
      
 178 
     | 
    
         
            +
                                                                                              <block type="math_number">
         
     | 
| 
      
 179 
     | 
    
         
            +
                                                                                                <field name="NUM">90</field>
         
     | 
| 
      
 180 
     | 
    
         
            +
                                                                                              </block>
         
     | 
| 
      
 181 
     | 
    
         
            +
                                                                                            </value>
         
     | 
| 
      
 182 
     | 
    
         
            +
                                                                                          </block>
         
     | 
| 
      
 183 
     | 
    
         
            +
                                                                                        </next>
         
     | 
| 
      
 184 
     | 
    
         
            +
                                                                                      </block>
         
     | 
| 
      
 185 
     | 
    
         
            +
                                                                                    </next>
         
     | 
| 
      
 186 
     | 
    
         
            +
                                                                                  </block>
         
     | 
| 
      
 187 
     | 
    
         
            +
                                                                                </next>
         
     | 
| 
      
 188 
     | 
    
         
            +
                                                                              </block>
         
     | 
| 
      
 189 
     | 
    
         
            +
                                                                            </next>
         
     | 
| 
       140 
190 
     | 
    
         
             
                                                                          </block>
         
     | 
| 
       141 
191 
     | 
    
         
             
                                                                        </next>
         
     | 
| 
       142 
192 
     | 
    
         
             
                                                                      </block>
         
     | 
| 
         @@ -242,6 +292,44 @@ car1.smalrubot_s1.turn_off_blue_led 
     | 
|
| 
       242 
292 
     | 
    
         
             
                                                                          <block type="hardware_smalrubot_s1_led_turn_on_or_off" inline="true">
         
     | 
| 
       243 
293 
     | 
    
         
             
                                                                            <field name="COLOUR">blue</field>
         
     | 
| 
       244 
294 
     | 
    
         
             
                                                                            <field name="OOO">turn_off</field>
         
     | 
| 
      
 295 
     | 
    
         
            +
                                                                            <next>
         
     | 
| 
      
 296 
     | 
    
         
            +
                                                                              <block type="ruby_p" inline="true">
         
     | 
| 
      
 297 
     | 
    
         
            +
                                                                                <value name="ARG">
         
     | 
| 
      
 298 
     | 
    
         
            +
                                                                                  <block type="hardware_smalrubot_s1_dc_motor_power_ratio">
         
     | 
| 
      
 299 
     | 
    
         
            +
                                                                                    <field name="LOR">left</field>
         
     | 
| 
      
 300 
     | 
    
         
            +
                                                                                  </block>
         
     | 
| 
      
 301 
     | 
    
         
            +
                                                                                </value>
         
     | 
| 
      
 302 
     | 
    
         
            +
                                                                                <next>
         
     | 
| 
      
 303 
     | 
    
         
            +
                                                                                  <block type="ruby_p" inline="true">
         
     | 
| 
      
 304 
     | 
    
         
            +
                                                                                    <value name="ARG">
         
     | 
| 
      
 305 
     | 
    
         
            +
                                                                                      <block type="hardware_smalrubot_s1_dc_motor_power_ratio">
         
     | 
| 
      
 306 
     | 
    
         
            +
                                                                                        <field name="LOR">right</field>
         
     | 
| 
      
 307 
     | 
    
         
            +
                                                                                      </block>
         
     | 
| 
      
 308 
     | 
    
         
            +
                                                                                    </value>
         
     | 
| 
      
 309 
     | 
    
         
            +
                                                                                    <next>
         
     | 
| 
      
 310 
     | 
    
         
            +
                                                                                      <block type="hardware_smalrubot_s1_dc_motor_set_power_ratio" inline="true">
         
     | 
| 
      
 311 
     | 
    
         
            +
                                                                                        <field name="LOR">left</field>
         
     | 
| 
      
 312 
     | 
    
         
            +
                                                                                        <value name="SPEED">
         
     | 
| 
      
 313 
     | 
    
         
            +
                                                                                          <block type="math_number">
         
     | 
| 
      
 314 
     | 
    
         
            +
                                                                                            <field name="NUM">10</field>
         
     | 
| 
      
 315 
     | 
    
         
            +
                                                                                          </block>
         
     | 
| 
      
 316 
     | 
    
         
            +
                                                                                        </value>
         
     | 
| 
      
 317 
     | 
    
         
            +
                                                                                        <next>
         
     | 
| 
      
 318 
     | 
    
         
            +
                                                                                          <block type="hardware_smalrubot_s1_dc_motor_set_power_ratio" inline="true">
         
     | 
| 
      
 319 
     | 
    
         
            +
                                                                                            <field name="LOR">right</field>
         
     | 
| 
      
 320 
     | 
    
         
            +
                                                                                            <value name="SPEED">
         
     | 
| 
      
 321 
     | 
    
         
            +
                                                                                              <block type="math_number">
         
     | 
| 
      
 322 
     | 
    
         
            +
                                                                                                <field name="NUM">90</field>
         
     | 
| 
      
 323 
     | 
    
         
            +
                                                                                              </block>
         
     | 
| 
      
 324 
     | 
    
         
            +
                                                                                            </value>
         
     | 
| 
      
 325 
     | 
    
         
            +
                                                                                          </block>
         
     | 
| 
      
 326 
     | 
    
         
            +
                                                                                        </next>
         
     | 
| 
      
 327 
     | 
    
         
            +
                                                                                      </block>
         
     | 
| 
      
 328 
     | 
    
         
            +
                                                                                    </next>
         
     | 
| 
      
 329 
     | 
    
         
            +
                                                                                  </block>
         
     | 
| 
      
 330 
     | 
    
         
            +
                                                                                </next>
         
     | 
| 
      
 331 
     | 
    
         
            +
                                                                              </block>
         
     | 
| 
      
 332 
     | 
    
         
            +
                                                                            </next>
         
     | 
| 
       245 
333 
     | 
    
         
             
                                                                          </block>
         
     | 
| 
       246 
334 
     | 
    
         
             
                                                                        </next>
         
     | 
| 
       247 
335 
     | 
    
         
             
                                                                      </block>
         
     |