<?xml version="1.0"?>
<flowgorithm fileversion="2.11">
    <attributes>
        <attribute name="name" value=""/>
        <attribute name="authors" value="burrin"/>
        <attribute name="about" value=""/>
        <attribute name="saved" value="2021-04-04 07:05:21 PM"/>
        <attribute name="created" value="YnVycmluO0RFU0tUT1AtNzQ5RDJJRjsyMDIxLTA0LTA0OzA1OjA0OjExIFBNOzI5MzQ="/>
        <attribute name="edited" value="YnVycmluO0RFU0tUT1AtNzQ5RDJJRjsyMDIxLTA0LTA0OzA2OjUzOjQ2IFBNOzExO2J1cnJpbjtERVNLVE9QLTc0OUQySUY7MjAyMS0wNC0wNDswNTowNDoxMSBQTTtyaWdodHNoaWZ0LmZwcmc7NzcxNw=="/>
        <attribute name="edited" value="YnVycmluO0RFU0tUT1AtNzQ5RDJJRjsyMDIxLTA0LTA0OzA3OjA1OjIxIFBNOzE4OzMxMDI="/>
    </attributes>
    <function name="Main" type="None" variable="">
        <parameters/>
        <body>
            <comment text="declare variables&#13;&#10;"/>
            <declare name="counter" type="Integer" array="False" size=""/>
            <declare name="number" type="Integer" array="False" size=""/>
            <declare name="oldnumber" type="Integer" array="False" size=""/>
            <declare name="numberOfShifts" type="Integer" array="False" size=""/>
            <declare name="strnum" type="String" array="False" size=""/>
            <declare name="nod" type="Integer" array="False" size=""/>
            <output expression="&quot;number to shift&quot;" newline="True"/>
            <input variable="number"/>
            <comment text="keep track of the orginal number for output later"/>
            <assign variable="oldnumber" expression="number"/>
            <output expression="&quot;number of shifts&quot;" newline="True"/>
            <input variable="numberOfShifts"/>
            <comment text="make number a string so we can access each component"/>
            <assign variable="strnum" expression="ToString(number)"/>
            <comment text="Flowgorith can't index a string like python so needs pushing into an array"/>
            <declare name="myArray" type="String" array="True" size="len(strnum)"/>
            <call expression="makeArray(strnum,myArray)"/>
            <comment text="perfomr shift set number of times"/>
            <for variable="counter" start="1" end="numberOfShifts" direction="inc" step="1">
                <call expression="RightCycle(myArray)"/>
            </for>
            <comment text="turn the whole thing back to an integer"/>
            <assign variable="number" expression="makeNum(myArray)"/>
            <output expression="oldnumber &amp; &quot; right shifted by &quot; &amp;numberofshifts &amp; &quot; is &quot; &amp;number" newline="True"/>
        </body>
    </function>
    <function name="countDigits" type="Integer" variable="NumOfDigits">
        <parameters>
            <parameter name="myArray" type="String" array="True"/>
        </parameters>
        <body>
            <comment text="Count nuber of digits"/>
            <declare name="NumOfDigits" type="Integer" array="False" size=""/>
            <assign variable="NumOfDigits" expression="size(myArray)"/>
        </body>
    </function>
    <function name="makeArray" type="None" variable="">
        <parameters>
            <parameter name="number" type="String" array="False"/>
            <parameter name="myArray" type="String" array="True"/>
        </parameters>
        <body>
            <comment text="Convert to an array"/>
            <declare name="counter" type="Integer" array="False" size=""/>
            <for variable="counter" start="0" end="len(number)-1" direction="inc" step="1">
                <assign variable="myArray[counter]" expression="char(number,counter)"/>
            </for>
        </body>
    </function>
    <function name="makeNum" type="Integer" variable="number">
        <parameters>
            <parameter name="MyArray" type="String" array="True"/>
        </parameters>
        <body>
            <comment text="Stitch it back to a string and turn to an integer"/>
            <declare name="number" type="Integer" array="False" size=""/>
            <declare name="strnum" type="String" array="False" size=""/>
            <declare name="counter" type="Integer" array="False" size=""/>
            <assign variable="strnum" expression="&quot;&quot;"/>
            <for variable="counter" start="0" end="size(myArray)-1" direction="inc" step="1">
                <assign variable="strnum" expression="strnum &amp; myArray[counter]"/>
            </for>
            <assign variable="number" expression="ToInteger(strnum)"/>
        </body>
    </function>
    <function name="RightCycle" type="None" variable="">
        <parameters>
            <parameter name="myArray" type="String" array="True"/>
        </parameters>
        <body>
            <comment text="perform the right cycle"/>
            <declare name="nod" type="Integer" array="False" size=""/>
            <declare name="counter" type="Integer" array="False" size=""/>
            <declare name="temp" type="String" array="False" size=""/>
            <assign variable="nod" expression="countDigits(myArray)"/>
            <assign variable="temp" expression="myArray[nod-1]"/>
            <for variable="counter" start="size(myArray)-1" end="1" direction="dec" step="1">
                <assign variable="myArray[counter]" expression="myArray[counter-1]"/>
            </for>
            <assign variable="myArray[0]" expression="temp"/>
        </body>
    </function>
</flowgorithm>
