Skip to content

Latest commit

 

History

History
434 lines (220 loc) · 13.9 KB

ge-ren-cheng-xu-she-ji.md

File metadata and controls

434 lines (220 loc) · 13.9 KB

《基于机器人的实践方法》个人程序设计报告
2016级计算机基地班 孙逸鲲320160905591

案例说明:
程序使用blockly编写。
功能为:用户从键盘输入一个十进制整数,程序计算出该小于该整数的所有质数。
由于时间精力能力有限,代码稍显粗浅简陋,望老师多多包涵。

拼接好的模块截图:

**运行结果截图: **


XML代码:

<xml xmlns="http://www.w3.org/1999/xhtml">

  <variables>

    <variable type="" id="\]Qv\]t\[GZQthdL8KjpTZW">m</variable>

    <variable type="" id="S}kr\[\]{Uy\*DU6$K3uip}">n</variable>

    <variable type="" id="K:L-Tq4sa\[H;8i$GkHG\|">i</variable>

    <variable type="" id="R?-A9ngC3ib\]+fVv\]3ti">j</variable>

    <variable type="" id="tyoreQKzw\_F:U\`O4nL:C">一个字符串</variable>

  </variables>

  <block type="text\_print" id="+luIJrq-B@SeqzTkOEAk" x="-613" y="-38">

    <value name="TEXT">

      <shadow type="text" id="dWrZ}!}OH,U8@VZ8d\[xt">

        <field name="TEXT">\*\*\*\*功能是输出m以内的质数\*\*\*\*</field>

      </shadow>

    </value>

    <next>

      <block type="variables\_set" id="\|J~49v\*@Q\)pe.MfnQvBh">

        <field name="VAR" id="\]Qv\]t\[GZQthdL8KjpTZW" variabletype="">m</field>

        <value name="VALUE">

          <block type="text\_prompt\_ext" id="\`}\]\*,Tr9qZzeM416:xIL">

            <mutation type="TEXT"></mutation>

            <field name="TYPE">TEXT</field>

            <value name="TEXT">

              <shadow type="text" id="=\*O+$dmE.n^R\_$\*{7\*@4">

                <field name="TEXT">请输入数字m</field>

              </shadow>

            </value>

          </block>

        </value>

        <next>

          <block type="variables\_set" id="+}6^G\[bVkRaHPPQ\*{!\*\_">

            <field name="VAR" id="tyoreQKzw\_F:U\`O4nL:C" variabletype="">一个字符串</field>

            <value name="VALUE">

              <block type="variables\_get" id="aIWwnH}=8ez9}Bf,\_fO+">

                <field name="VAR" id="\]Qv\]t\[GZQthdL8KjpTZW" variabletype="">m</field>

              </block>

            </value>

            <next>

              <block type="text\_append" id="Y.uvR\|CxUAg=%wVeQg0A">

                <field name="VAR" id="tyoreQKzw\_F:U\`O4nL:C" variabletype="">一个字符串</field>

                <value name="TEXT">

                  <shadow type="text" id="cy:M1+;a\]pzNe@xbQ%~=">

                    <field name="TEXT"></field>

                  </shadow>

                  <block type="text" id="=\]yZt/\*\(D;\|tG3\`0-~A,">

                    <field name="TEXT">以内的质数有: </field>

                  </block>

                </value>

                <next>

                  <block type="controls\_for" id="g4Xm?O;t/aJdv\];\|rC=@">

                    <field name="VAR" id="K:L-Tq4sa\[H;8i$GkHG\|" variabletype="">i</field>

                    <value name="FROM">

                      <shadow type="math\_number" id="T-soLurgWiH1TWsn\[gRA">

                        <field name="NUM">2</field>

                      </shadow>

                    </value>

                    <value name="TO">

                      <shadow type="math\_number" id="~K\`KSINl-\(x!~NmoV~\(d">

                        <field name="NUM">10</field>

                      </shadow>

                      <block type="variables\_get" id="prvHTc\*pEA\)d6MKrhZmg">

                        <field name="VAR" id="\]Qv\]t\[GZQthdL8KjpTZW" variabletype="">m</field>

                      </block>

                    </value>

                    <value name="BY">

                      <shadow type="math\_number" id="$Ql\*p@UPpy7nKoq!Hw52">

                        <field name="NUM">1</field>

                      </shadow>

                    </value>

                    <statement name="DO">

                      <block type="controls\_for" id="uj7G/09b6hcUEQ,\[i?8D">

                        <field name="VAR" id="S}kr\[\]{Uy\*DU6$K3uip}" variabletype="">n</field>

                        <value name="FROM">

                          <shadow type="math\_number" id="G\]uBrEANvuc+FET\]/anB">

                            <field name="NUM">2</field>

                          </shadow>

                        </value>

                        <value name="TO">

                          <shadow type="math\_number" id="^l\[H;iUN15k6TWoQk1NZ">

                            <field name="NUM">10</field>

                          </shadow>

                          <block type="math\_arithmetic" id="-FY0elR0e!;e5;2hcog.">

                            <field name="OP">MINUS</field>

                            <value name="A">

                              <shadow type="math\_number" id="XDe/o\($JQJWPf+QS{F;!">

                                <field name="NUM">1</field>

                              </shadow>

                              <block type="variables\_get" id="gixwgk2\)KC4\#iwL1@IuJ">

                                <field name="VAR" id="\]Qv\]t\[GZQthdL8KjpTZW" variabletype="">m</field>

                              </block>

                            </value>

                            <value name="B">

                              <shadow type="math\_number" id=".YVAxL{5/v==VsVh\`o\*+">

                                <field name="NUM">1</field>

                              </shadow>

                            </value>

                          </block>

                        </value>

                        <value name="BY">

                          <shadow type="math\_number" id="yPOb\[X,8!\(r5FJCWwBQ=">

                            <field name="NUM">1</field>

                          </shadow>

                        </value>

                        <statement name="DO">

                          <block type="controls\_if" id="}^Y\|o@^}pgV+Luu0N7\]E">

                            <value name="IF0">

                              <block type="logic\_compare" id="krR/^/\*MLOC@SGY5QXl3">

                                <field name="OP">EQ</field>

                                <value name="A">

                                  <block type="math\_modulo" id="n9Qc^SNJ+=!1p\#+!z5y7">

                                    <value name="DIVIDEND">

                                      <shadow type="math\_number" id="?\*f.VJ\]EuLIPKA890%ca">

                                        <field name="NUM">64</field>

                                      </shadow>

                                      <block type="variables\_get" id="npApH2s\[l4D5+\_\)\|eY3/">

                                        <field name="VAR" id="K:L-Tq4sa\[H;8i$GkHG\|" variabletype="">i</field>

                                      </block>

                                    </value>

                                    <value name="DIVISOR">

                                      <shadow type="math\_number" id="Z?.K\#=Isv;7gSBW~+hZ2">

                                        <field name="NUM">10</field>

                                      </shadow>

                                      <block type="variables\_get" id=";2n3q\)@=:V;\[t@kdL2B6">

                                        <field name="VAR" id="S}kr\[\]{Uy\*DU6$K3uip}" variabletype="">n</field>

                                      </block>

                                    </value>

                                  </block>

                                </value>

                                <value name="B">

                                  <block type="math\_number" id="=%?g8DuVz4PUvYs;0Af%">

                                    <field name="NUM">0</field>

                                  </block>

                                </value>

                              </block>

                            </value>

                            <statement name="DO0">

                              <block type="controls\_flow\_statements" id="x:AMyEM}6gH\(B-Y0t=j8">

                                <field name="FLOW">BREAK</field>

                              </block>

                            </statement>

                          </block>

                        </statement>

                        <next>

                          <block type="controls\_if" id=",P/^nG,X.C}y0c9ZZvT/">

                            <value name="IF0">

                              <block type="logic\_compare" id="\_MKW,Bg,O3ea:1aHqb1=">

                                <field name="OP">EQ</field>

                                <value name="A">

                                  <block type="variables\_get" id="\`=5U-\_JSzAkxaz.-X\`9q">

                                    <field name="VAR" id="K:L-Tq4sa\[H;8i$GkHG\|" variabletype="">i</field>

                                  </block>

                                </value>

                                <value name="B">

                                  <block type="variables\_get" id="A-@%40\*qBfdT7\#q/JLRz">

                                    <field name="VAR" id="S}kr\[\]{Uy\*DU6$K3uip}" variabletype="">n</field>

                                  </block>

                                </value>

                              </block>

                            </value>

                            <statement name="DO0">

                              <block type="text\_append" id="u6lqCQLI\)d\#N9y@:\]U8p">

                                <field name="VAR" id="tyoreQKzw\_F:U\`O4nL:C" variabletype="">一个字符串</field>

                                <value name="TEXT">

                                  <shadow type="text" id="cy:M1+;a\]pzNe@xbQ%~=">

                                    <field name="TEXT"></field>

                                  </shadow>

                                  <block type="variables\_get" id=":\_GW7/7+@qkp5o8Qop\(D">

                                    <field name="VAR" id="K:L-Tq4sa\[H;8i$GkHG\|" variabletype="">i</field>

                                  </block>

                                </value>

                                <next>

                                  <block type="text\_append" id="s\*,xO\[m\_0^V=1\#ciZURg">

                                    <field name="VAR" id="tyoreQKzw\_F:U\`O4nL:C" variabletype="">一个字符串</field>

                                    <value name="TEXT">

                                      <shadow type="text" id="IU.a\[\#3@0ouSs/{-UbO}">

                                        <field name="TEXT">   </field>

                                      </shadow>

                                    </value>

                                  </block>

                                </next>

                              </block>

                            </statement>

                          </block>

                        </next>

                      </block>

                    </statement>

                    <next>

                      <block type="text\_print" id="x}U!g7=\(9d\*nPo^lYEDN">

                        <value name="TEXT">

                          <shadow type="text" id="PiH4GCY{;CY\`,34LEge4">

                            <field name="TEXT">abc</field>

                          </shadow>

                          <block type="variables\_get" id="\#5Pxv5cPxPx@;N\]bm\#L/">

                            <field name="VAR" id="tyoreQKzw\_F:U\`O4nL:C" variabletype="">一个字符串</field>

                          </block>

                        </value>

                      </block>

                    </next>

                  </block>

                </next>

              </block>

            </next>

          </block>

        </next>

      </block>

    </next>

  </block>

</xml>