Search code examples
drawingflowgorithm

Drawing function in Flowgorithm limited?


Example figure

Example code

My colleagues and I try to create the example image. In Small Basic code it works perfectly. But when created with Flowgorithm the beginning of the image starts progressively disappering while drawing the rest of the image after approx. 25% is done. Is there a memory problem or a max. number of pixels to be drawn? Settings maybe ?


Solution

  • I can confirm the defect/behavior. You can have at most 8000 operations, counting both draws and turns. Unfortunately it's not obvious to pin down. It's not the number of drawing operations alone. It seems that consecutive draw or turn operations get concatenated to reduce the total.

    To test it, I tried to have a drawing with easily countable steps:

    drawing

    The following program shows that you can have at most 8000 operations, counting both draws and turns:

    Main

    Row

    Connect

    The XML version:

        <function name="Main" type="None" variable="">
            <parameters/>
            <body>
                <declare name="i, rows, steps" type="Integer" array="False" size=""/>
                <assign variable="steps" expression="0"/>
                <assign variable="rows" expression="16"/>
                <for variable="i" start="1" end="rows" direction="inc" step="1">
                    <assign variable="steps" expression="steps + Row(29)"/>
                    <assign variable="steps" expression="steps + Connect(90)"/>
                    <assign variable="steps" expression="steps + Row(30)"/>
                    <assign variable="steps" expression="steps + Connect(-90)"/>
                </for>
                <assign variable="steps" expression="steps + row(8)"/>
                <output expression="steps" newline="True"/>
            </body>
        </function>
        <function name="Connect" type="Integer" variable="steps">
            <parameters>
                <parameter name="angle" type="Integer" array="False"/>
            </parameters>
            <body>
                <declare name="steps" type="Integer" array="False" size=""/>
                <assign variable="steps" expression="12"/>
                <forward expression="100" pen="down"/>
                <turn expression="90" rotate="right"/>
                <forward expression="100" pen="down"/>
                <turn expression="angle" rotate="right"/>
                <forward expression="100" pen="down"/>
                <turn expression="90" rotate="left"/>
                <forward expression="100" pen="down"/>
                <turn expression="90" rotate="right"/>
                <forward expression="100" pen="down"/>
                <turn expression="angle" rotate="right"/>
                <forward expression="100" pen="down"/>
                <turn expression="90" rotate="left"/>
            </body>
        </function>
        <function name="Row" type="Integer" variable="steps">
            <parameters>
                <parameter name="steps" type="Integer" array="False"/>
            </parameters>
            <body>
                <declare name="i" type="Integer" array="False" size=""/>
                <for variable="i" start="1" end="steps" direction="inc" step="1">
                    <forward expression="100" pen="down"/>
                    <turn expression="90" rotate="right"/>
                    <forward expression="100" pen="down"/>
                    <turn expression="90" rotate="right"/>
                    <forward expression="100" pen="down"/>
                    <turn expression="90" rotate="left"/>
                    <forward expression="100" pen="down"/>
                    <turn expression="90" rotate="left"/>
                </for>
                <assign variable="steps" expression="steps * 8"/>
            </body>
        </function>