<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>APcol systems and Turtle Graphics</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Lucie Ciencialová</string-name>
          <email>lucie.ciencialova@fpf.slu.cz</email>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Ludeˇk Cienciala</string-name>
          <email>ludek.cienciala@fpf.slu.cz</email>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Configuration</institution>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>Institute of Computer Science, Silesian University in Opava</institution>
          ,
          <country country="CZ">Czech Republic</country>
        </aff>
        <aff id="aff2">
          <label>2</label>
          <institution>O, called the agent creation object</institution>
        </aff>
      </contrib-group>
      <abstract>
        <p>In this paper we continue our investigations in APCol systems (Automaton-like P colonies), variants of P colonies where the environment of the agents is given by a string and the functioning of the system resembles to the functioning of standard finite automaton. We introduce a new variant of APcol systems called extended APcol systems - agents capacity is not limited to two objects. We deal with the concept of agent creation in these systems and possibility of generation of strings as commands for turtle graphics.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1 Introduction</title>
      <p>
        Automaton-like P colonies (APCol systems, for short),
introduced in [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ], are variants of P colonies (introduced in
[
        <xref ref-type="bibr" rid="ref9">9</xref>
        ]) - very simple membrane systems inspired by colonies
of formal grammars. The interested reader is referred to
[
        <xref ref-type="bibr" rid="ref11">11</xref>
        ] for detailed information on membrane systems (P
systems) and to [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ] and [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ] for more information to grammar
systems theory. For more details on P colonies consult the
surveys [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ] and [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ].
      </p>
      <p>An APCol system consists of a finite number of agents
and their joint shared environment. The agents are formed
from a finite number of objects and their functioning is
based on programs consisting of rules. These rules are of
two types: they may change the objects of the agents and
they can be used for interacting with the joint shared
environment of the agents. While in the case of standard P
colonies the environment is a multiset of objects, in case
of APCol systems it is represented by a string. The
number of objects inside each agent is set by definition and it
is usually a very small number: 1, 2 or 3. The string
representing the environment is processed by the agents and it
is used as a communication channel for the agents as well,
since through the string, the agents are able to affect the
behaviour of another agent.</p>
      <p>Agents are also equipped with agent creation programs.
They are applicable when a special object appears inside
the agent. An agent with the special object can make one
copy of itself containing objects specified by the program.</p>
      <p>The computation in APCol systems starts with an input
string, representing the environment, and with each agent
in its initial state.</p>
      <p>Every computational step is done in a maximally
parallel way which means that a set of the active agents
per</p>
      <p>Copyright ©2021 for this paper by its authors. Use permitted under
Creative Commons License Attribution 4.0 International (CC BY 4.0).
forming their programs is maximal - the joint action of the
agents is maximally parallel if no more active agent can
be added to the synchronously acting agents. An agent is
active if it is able to execute at least one of its programs.</p>
      <p>The computation ends if there are no more applicable
programs in the system.</p>
      <p>
        For more detailed information on APCol systems we
refer to [
        <xref ref-type="bibr" rid="ref3 ref4">3, 4</xref>
        ].
      </p>
      <p>In computer graphics, turtle graphics are vector graphics
using a relative cursor - the “turtle” to draw curves.
Commands for turtle can be formed into string and hence we
can speak about a turtle representation of string. A state of
the turtle is defined as a triplet (x; y; a), where the
Cartesian coordinates (x; y) represent the turtle’s position, and
the angle a, called the heading, is interpreted as the
direction in which the turtle is facing. Given the step size d and
the angle increment d , the turtle can respond to commands
represented by the following symbols:
F Move forward a step of length d. The state of the turtle
changes to (x0; y0; a), where x0 = x + d cos a and y0 =
y + d sin a. A line segment between points (x; y) and
(x0; y0) is drawn.
f Move forward a step of length d without drawing a line.
+ Turn left by angle d . The next state of the turtle is
(x; y; a + d ). The positive orientation of angles is
counter-clockwise.</p>
      <p>Turn right by angle d . The next state of the turtle is
(x; y; a d ).</p>
      <p>
        Given a string s, the initial state of the turtle (x0; y0; a0)
and fixed parameters d and d , the turtle interpretation of s
is the curve (set of lines) drawn by the turtle in response to
the string s. Turtle graphics is used for example to interpret
strings generated by L-systems (more details reader can
find in [
        <xref ref-type="bibr" rid="ref13">13</xref>
        ]).
      </p>
      <p>
        In this paper we deal with APcol systems with agent
creation programs generating strings that can be interpreted
in turtle graphics. We construct APcol system generating
string representation of two space-filling curves Hilbert
curve and Peano curve. In [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ] the authors deal with
generation of string representation of space-filling curves by P
systems with array rewriting rules.
      </p>
      <p>
        Preliminaries and Basic Notions
Throughout the paper we assume the reader to be familiar
with the basics of the formal language theory and
membrane computing [
        <xref ref-type="bibr" rid="ref11 ref14">14, 11</xref>
        ].
      </p>
      <p>For an alphabet S, the set of all words over S (including
the empty word, e), is denoted by S . We denote the length
of a word w 2 S by jwj and the number of occurrences
of the symbol a 2 S in w by jwja.</p>
      <p>A multiset of objects M is a pair M = (O; f ), where O
is an arbitrary (not necessarily finite) set of objects and f
is a mapping f : O ! N; f assigns to each object in O its
multiplicity in M. Any multiset of objects M with the set
of objects O = fx1; : : : xng can be represented as a string w
over alphabet O with jwjxi = f (xi); 1 i n. Obviously,
all words obtained from w by permuting the letters can also
represent the same multiset M, and e represents the empty
multiset.
2.1</p>
      <sec id="sec-1-1">
        <title>Extended APCol System</title>
        <p>APCol system is a kind of P colony. It is formed from
agents with capacity 2 processing the string. They act
according to programs as it is usual in P colonies. Each
program is formed from two rules of two types. The first type
called rewriting is of the form a ! b and by execution of
this rule, the object a inside the agent is rewritten to the
object b. The second type of rules is called communication.
The communication rules are of the form c $ d and by use
of them, the agent replaces the symbol d in the string by
object c initially placed inside the agent. If c = e (e $ d) it
means that agent erases symbol d from the string. If d = e
(c $ e) it means that agent inserts symbol c to the string
in a place which is determined by use of another
communication rule in the same program or if there is no other
communication rule in the program c is placed in random
position.</p>
        <p>Let us make a few comments about the application of
the programs.</p>
        <p>1. Agent can act in only one place in the string in one
step of computation.
2. ha $ b; c $ ei
hc $ e; a $ bi
)
)
b ! ac in the string,
b ! ca in the string,
ha ! b; c $ ei ) e ! c in the string, insert c
anywhere to the string, and rewrite a to b inside agent
ha ! b; e $ di ) d ! e in the string, delete one
d from the string, and rewrite a to b inside agent
If an agent contains a special object @, the agent makes
a copy of itself. This action is done by executing a program
formed from two rewriting rules. Let a@ be a contents of
agent A1 with program p1 = h@ ! b; a ! ci. After
execution of the program p1 there is one new child-agent in
the APCol system with the same label and the same set of
programs as the parent-agent A1 has. The contents of the
parent-agent after the execution of the program is bc while
the contents of the child-agent is ba.</p>
        <p>If the parent-agent has a program p2 = ha ! c; @ ! bi,
then after the execution of the program p2 the contents of
parent-agent after the execution of the program is bc and
the contents of the child-agent is bc, too.</p>
        <p>The order of rules determines whether the rewriting rule
without @ is used before or after the creation of the
childagent.</p>
        <p>An extended APcol system is APcol system having
capacity k 1 given by definition. The increase of the
capacity results in an elongation of the context for the
application of programs with communication rules. In programs
with agent creation rules, the increased capacity affects the
content of agents - the rules listed before the agent creation
rule are executed before the creation of a new agent, and
the rules listed after the agent creation rule are executed
only on the parent agent.</p>
        <p>We introduce new type of rule, object occurrence
conditional rule. The rule (rewritting, communication) is
enriched by the prefix “oj” and it means that the rule can be
executed only if object o is present in the environmental
string in current configuration under the assumption that
the rule itself is applicable. Prefix “ej” means that rule is
applicable if rule without prefix is applicable too ( it adds
no applicability condition). We also define prefix “:oj”
and it means that the rule can be executed only if object
o is not present in the environmental string in current
configuration under the assumption that the rule itself is
applicable.</p>
        <p>Definition 1. An extended APCol system (eAPcol system
for short) with capacity k 1 with agent creation is a
construct</p>
        <p>P = (O; e; @; A1; : : : ; An);
where
• O is an alphabet, its elements are called the objects;
• e 2 O, called the basic object;
• Ai; 1 i n, are agents. Each agent is a triplet Ai =
(wi; Pi; Fi), where
– wi is a multiset over O, describing the initial
state (contents) of the agent, jwij = k,
– Pi = pi;1; : : : ; pi;ki is a finite set of programs
associated with the agent, where each program
is a pair of rules. Each rule is in one of the
following forms:
* a ! b, where a; b 2 O, called an rewriting</p>
        <p>rule,
* c $ d, where c; d 2 O, called a
communication rule;
If @ appears on the left side of the rule in
the program, all rules of this program must be
rewriting; Prefix “oj” can be add to rule (not
with @ on the left side) and it adds condition for
applicability of the program - object o 2 O must
be present in the environmental string. Prefix
“:oj” can be add to rule (not with @ on the left
side) and it means that program is applicable if
object o 2 O is not present in the environmental
string.
– Fi O is a finite set of final states (contents) of
agent Ai.</p>
        <p>When an agent obtains the object @ by the execution
of a rewriting or a communication rule in the program, the
agent must create a new agent in the next step of the
computation in the way described within the above definition.</p>
        <p>The computation starts in the initial configuration where
all agents contain their initial multiset of objects and there
is an input string over the alphabet T on the eAPCol
system. Consequently, an initial configuration of the eAPCol
system is an (n + 1)-tuple c = (w; w1; : : : ; wn) where w is
the initial state of the environment and the other n
components are multisets of objects, given in the form of strings,
the initial states of the agents.</p>
        <p>A configuration of an eAPCol system P is given by
(w; w1; : : : ; wnl ), where jwij = k; 1 i n, wi
represents all the objects inside the agent labelled Ai and w 2
(O feg) is the string to be processed.</p>
        <p>At each step of the computation every agent attempts
to find one of its programs to use. If the number of
applicable programs is higher than one, then the agent
nondeterministically chooses one of them. At one step of
computation, the maximal possible number of agents have to
be active, i.e., have to perform a program.</p>
        <p>By executing programs, the eAPCol system passes from
one configuration to another configuration. A sequence
of configurations started from the initial configuration is
called a computation.</p>
        <p>The computation halts when no agent has an applicable
program.
3</p>
        <p>Space-Filling Curves generation by
eAPcol Systems
In this paper, we focus on the generation of control strings
for generating space-filling curves using turtle graphics.
We concentrated on three curves - Hilbert, Moore and
Peano. All three curves are fractal-like. A new iteration of
the curve is formed according to a given rule from the
previous iteration. This increases the area filled by the curve.</p>
        <p>Various mechanisms are used to generate iterations of
these curves (or control strings for turtle graphics), for
example, parallel grammars or L-systems.</p>
        <p>There are several techniques for generating these strings
by eAPcol systems. We can use a sequential approach and
follow the rules of parallel grammars to rewrite all
occurrences of non-terminals one by one, so that the agent
" moves" the object-tag that separates the processed part
of the string from the unprocessed part as it rewrites
nonterminals to strings.</p>
        <p>
          Alternatively, we can use a parallel approach (as in
Lsystems [
          <xref ref-type="bibr" rid="ref13">13</xref>
          ]) that requires rewriting all non-terminals in
string in one step. Because of the increasing number of
non-terminals, the number of agents that process the string
needs to increase.
        </p>
        <p>In this paper, we use both approaches. We use the
parallel approach to generate the string describing the curve
and the transcoding of the result into the turtle graphics
language is done sequentially.
3.1</p>
      </sec>
      <sec id="sec-1-2">
        <title>Hilbert curve</title>
        <p>
          In 1891 Hilbert introduced the Hilbert space-filling curve
in [
          <xref ref-type="bibr" rid="ref7">7</xref>
          ]. Its finite approximations, the Hilbert words, were
first described as chain-code words in [
          <xref ref-type="bibr" rid="ref15">15</xref>
          ]. The first
approximation is given by H1 = urd where u; d; r; l are
objects representing direction up, down, right and left, and,
for n &gt; 1; the subsequent approximations are given by
        </p>
        <p>Hn+1 = g(Hn)uHnrHndj(Hn)
where g; j are homomorphisms on alphabet given by:
g(u) = r; g(d) = l; g(l) = d; g(r) = u – symmetry w.r.t. Oy
and rotation right 90 degrees;
j(u) = l; j(d) = r; j(l) = u; j(r) = d – symmetry w.r.t.
Oy and rotation left 90 degrees.</p>
        <p>The first four approximations are shown in Figure 1.</p>
        <p>Hilbert words can be generated by context-free rules
that are applied parallelly to string formed from
terminals and non-terminals. To generate Hilbert words we use
rewriting context-free (CF) rules over non-terminal
alphabet fN; L; R;U g and terminals from fu; d; l; rg. The CF
rules are:</p>
        <sec id="sec-1-2-1">
          <title>1. N ! LuNrNdR</title>
        </sec>
        <sec id="sec-1-2-2">
          <title>2. L ! NrLuLlU</title>
        </sec>
        <sec id="sec-1-2-3">
          <title>3. R ! U lRdRrN 4. U ! RdU lU uL</title>
          <p>The starting string is N. In the last step of generation
of Hilbert word we use another set of rules that is formed
from e-rules and all non-terminals are erased from word.
Another approach is to count with terminals only in each
generated word. Hilbert word H1 is obtained by execution
of the first rule to starting string</p>
        </sec>
        <sec id="sec-1-2-4">
          <title>N ) LuNrNdR ) urd</title>
          <p>The second Hilbert word, H2 is generated from N by
following derivation:</p>
          <p>N )
)
)</p>
        </sec>
        <sec id="sec-1-2-5">
          <title>LuNrNdR )</title>
        </sec>
        <sec id="sec-1-2-6">
          <title>NrLuLlU uLuNrNdRrLuNrNdRdU lRdRrN )</title>
          <p>ruluurdrurddldr</p>
          <p>For the turtle to draw the first approximation of the
Hilbert curve, the command string is F F F. The
command string for second approximation of Hilbert curve is
F + F + F FF F F + F + F F FF F + F + F.</p>
          <p>To generate Hilbert curve we construct eAPcol system
with capacity three and with agent creation formed from
two kind of agents.</p>
          <p>1. The input of the system is a string s0 = an#
corresponding to the number of iterations concatenated
with a special symbol labelling the end of input. The
output of system is command string for Turtle
Graphics to generate n-th approximation of Hilbert curve
concatenated with symbol #2.
2. The first agent A1 removes one occurrence of object
a after all non-terminals are deleted from a string of
computation.
3. The second agent A2 will generates approximations
of Hilbert word in two phases.</p>
          <p>In the first phase the agent generates symbols
corresponding to the direction of movement of turtle
(u; d; r; l for direction up, down, right and left) with
objects called non-terminals according to CF rules.
In the second phase, the agent makes a copy of
itself twice. It means that in three steps the number of
agents labelled by A2 rises four times (the reason is
the parallel simulation of the execution of the rules
listed below).
4. The last phase of computation is to “code” directions
u; d; l; r into turtle language.</p>
          <p>Now, we describe the function of the constructed system
in more detail, present the programs of the agents, and
illustrate the function of the system using the example of
generating a command string for the first approximation
of the Hilbert curve.</p>
          <p>Agent A1 is equipped by the following programs for first
three phases of computation:</p>
          <p>A1
A2
A3
A4
A5
A6
A7
A8
A9
A10
A11
A12
A13
A14
&lt; #je ! e; e ! e; e ! b &gt;;
&lt; e ! e; e ! e; b ! c &gt;;
&lt; :Nje ! w1; e ! e; c ! e &gt;;
&lt; :Ljw1 ! w2; e ! e; e ! e &gt;;
&lt; :Rjw2 ! w3; e ! e; e ! e &gt;;
&lt; :U jw3 ! w4; e ! e; e ! e &gt;;
&lt; ajw4 ! 0; e ! g; e ! e &gt;;
&lt; 0 ! 1; g $ a; e ! e &gt;;
&lt; :ajw4 ! 00; e ! f ; e ! e &gt;;
&lt; 00 ! 00; f $ #1; e ! e &gt;;
&lt; a ! e; 1 ! 2 ; e $ g &gt;;
&lt; g ! e; 2 ! 3 ; e ! e &gt;;
&lt; e ! e; i ! i+1 ; e ! e &gt;; 3
&lt; 15 ! e; e ! e; e ! c &gt;
i
14</p>
          <p>The second agent in the first two steps generates the
starting word N. The agent places object N next to object
#. The communication rule is equipped with condition a :,
it means that agent can put N into string only if a is present
in the sting. This is initialization phase for generation of
Hilbert word.</p>
          <p>B1
B2
&lt; e ! #1; e ! N; e ! e &gt;;
&lt; #1 $ #; ajN $ e; e ! e &gt;</p>
          <p>In our example, the initial configuration of the system is
(a#; eeeA1 ; eeeA2 ). The first phase of computation is shown
in the Table 1. In rows, there are configurations of the
system and sets of applicable programs. If there are more
than one applicable program associated with an agent, the
executed program is indicated by bold.</p>
          <p>Configuration
Env. A1 A2
a# eee eee
a# eeb #1Ne
a#1N eec #ee</p>
          <p>Applicable programs
A1 A2
A1 B1
A2 B2</p>
          <p>B3</p>
          <p>In the next phase, the agent A2 replaces N by string
LuNrNdR in accordance to the first CF rule. First it
generates object #X , where X is non-terminal object. This
program in non-deterministically chosen. If there is no such
non-terminal present in the string (before this step there
was no such non-terminal or the number of occurrences
of non-terminal X was less than the number of agents that
generated object #X ), the agent can rewrite object #X into
# in the next step. It is done in fourteen steps, because
agent uses program with two rewriting rules, then another
one with two communication rules to generate one object
of the right side of rule and one object marking the point
where to insert new objects. We note that all CF rules
are of the same length and all the agents are working
simultaneously so when there are more agents with label
A2 they can insert object in different parts of string. But
the agents can consume object marker (for example #N2
- marker object for insertion of second object of CF rule
with N on the left-hand side of the rule) that corresponds
only to currently performed CF rule. Let X 2 fN; L; R;U g
and X ! x1x2x3x4x5x6x7 is CF rule.</p>
          <p>We demonstrate the application of the programs by
continuing the example: In Table 2, we show how the
computation is done when agent A2 chooses program associated
with non-terminal that is not present in the string (or
nonterminal is used by another copy of the agent).</p>
          <p>Configuration
Env. A1
a#1N eec
a#1N eec
a#1N eec</p>
          <p>A2
#ee
#Lee
#ee</p>
          <p>A1</p>
          <p>Applicable programs</p>
          <p>A2
B3 : &lt;#!#L;e!e;e!e&gt;
B5 : &lt;:Lj#L!#;e!e;e!e&gt;</p>
          <p>B3</p>
          <p>In Table 3 the computation with right choice of program
is shown.</p>
          <p>After insertion of all the objects from the right-hand side
of the CF rule, the agent A2 is creating new agents in two
steps using programs</p>
          <p>After this phase in the first iteration the environmental
string is in the form an 1#1LuNrNdR and there are four
agents labelled A2 in the eAPcol system.</p>
          <p>In Table 5, the creation of new agents labelled A2 is
shown.</p>
          <p>When agent A1 deletes all occurrences of object a from
the environmental string, f appears in the environment and
agents labelled A2 delete all non-terminals from the string.</p>
          <p>B16
B17
&lt; f jx1 ! f ; #X1 ! e; X1 ! X1 &gt;;
&lt; f ! f ; e $ #X ; X1 ! f &gt;;</p>
          <p>If the environmental string was #1LuNrNdR before this
phase of computation, four agents deleted non-terminals
from the string and after this phase the string is f urd.</p>
          <p>In final phase the agent A1 rewrite objects fu; d; l; rg to
symbols fF; +; g. The coding depends on two
consecutive objects, for example if ru is substring of the
environmental string u is replaced by +F because to draw line in
direction up after line in direction right turtle must turn 90
degrees left and draw a line.</p>
          <p>To draw Hilbert curve by turtle we have to set two
parameters - the step size and the angle increment - and
initial state of the turtle. For code generation it is necessary
to set the angle increment d = 90 and turtle orientation to
up (a = 90 ). Because of angle increment the turtle can be
oriented in four directions (up, down, right, left). Boxed
symbols u ; d ; r ; l can represent current turtle
orientation.</p>
          <p>There are following programs in a set of programs of
agent A1:
A15
A16
A17
A18
A19
A20
A21
A22
A23
A24
A25
A26
A27
A28
A29
A30
A31
A32
A33
&lt; 00 ! u ; #1 ! #2; e ! e &gt;;
to move in the same direction as turtle is facing
x 2 fu; d; r; lg
&lt; x ! x ; #2 $ f ; e $ x &gt;;
&lt; x ! x ; f ! f ; x ! F &gt;;
&lt; x ! x ; F $ #2; f $ e &gt;;
to rotate and move
cc(u) = r; cc(r) = d; cc(d) = l; cc(l) = u; p = cc(x)
&lt; x ! x ; #2 $ f ; e $ p &gt;;
&lt; x ! p ; f ! f 0; p ! &gt;;
&lt; p ! p ; $ #2; f 0 $ e &gt;;
&lt; p ! p ; #2 $ f 0; e ! F &gt;;
&lt; p ! p ; f 0 ! f ; F ! F &gt;;
cw(u) = l; cw(l) = d; cw(d) = r; cw(r) = u; q = cw(x)
&lt; x ! x ; #2 $ f ; e $ q &gt;;
&lt; x ! q ; f ! f 0; q ! + &gt;;
&lt; q ! q ; + $ #2; f 0 $ e &gt;;
&lt; q ! q ; #2 $ f 0; e ! F &gt;;
&lt; q ! q ; f 0 ! f ; F ! F &gt;;
to rotate twice and move
dc(u) = d; dc(l) = r; dc(d) = u; dc(r) = l; y = dc(x)
&lt; x ! x ; #2 $ f ; e $ y &gt;;
&lt; x ! y ; f ! f 00; y ! + &gt;;
&lt; y ! y ; + $ #2; f 00 $ e &gt;;
&lt; y ! y ; #2 $ f 00; e ! + &gt;;
&lt; y ! y ; f 00 ! f 0; + ! + &gt;;</p>
          <p>If the initial angle of the turtle is 90 degrees (it faces up)
the agent A1 rewrites string into F F F. If the initial
angle of the turtle is 0 degrees (it faces right) the agent A1
rewrites string into +F F F. The initial angle is
generated by a program that launches this phase of computation
and it is given by definition of used turtle graphics system.
Env.
a#1N
a#1N
a#1#N
a#1#N
a#1#N
a#1#N
a#1#N
a#1#N
g#1#N
#1L#N1
#1L#N1
#1Lu#N2</p>
          <p>Configuration</p>
          <p>A1
eec
eec
eec
w1ee
w2ee
w3ee
w4ee
0ge
1 ae
2 eg
e 3 e
e 4 e</p>
          <p>A2
#ee
#N ee
N#N1 ee
#N1 LN1
#N1 LN1
#N1 LN1
#N1 LN1
#N1 LN1
#N1 LN1
#N eN1
#N2 uN2
#N1 eN2</p>
          <p>Applicable programs
A1 A2</p>
          <p>B3(X=N)</p>
          <p>B4</p>
          <p>B6
A3
A4
A5
A6
A7
A8
A11 B7(x1=L)</p>
          <p>A12 B8(x2=u)
A13(i=3) B9
A13(i=4) B10(i=3; x3=N)</p>
          <p>Env.
#1Lu#N2
#1LuN#N3
#1LuN#N3
#1LuNr#N4
#1LuNr#N4
#1LuNrN#N5
#1LuNrN#N5
#1LuNrNd#N6
#1LuNrNd#N6
#1LuNrNdR
#1LuNrNdR
Applicable programs</p>
          <p>A2</p>
          <p>B11(i=3)
B10(i=4; x4=r)</p>
          <p>B11(i=4)
B10(i=5; x5=N)</p>
          <p>B11(i=5)
B10(i=6; x6=d)</p>
          <p>B11(i=6)
B10(i=7; x7=R)</p>
          <p>B12
B13
B14</p>
          <p>A2</p>
          <p>A2</p>
          <p>A2
ee# ee#</p>
          <p>A1
A14</p>
          <p>Applicable programs</p>
          <p>A2 A2 A2
B14
B15 B15
B3 B3 B3</p>
          <p>A2
B3
The Moore curve is a variant of Hilbert curve. The first
four iterations are depicted in Figure 2. To generate word
representation of Moore curve we use rewriting
contextfree (CF) rules over non-terminal alphabet fA; B;C; E; Fg
and terminals from fu; d; l; rg. The CF rules are:</p>
        </sec>
        <sec id="sec-1-2-7">
          <title>1. A ! BuBrGdG</title>
        </sec>
        <sec id="sec-1-2-8">
          <title>2. B ! ClBuBrE</title>
        </sec>
        <sec id="sec-1-2-9">
          <title>3. C ! BuClCdG</title>
        </sec>
        <sec id="sec-1-2-10">
          <title>4. E ! GdErEuB</title>
        </sec>
        <sec id="sec-1-2-11">
          <title>5. G ! ErGdGlC</title>
          <p>A derivation of word representation of Moore curve starts
with string A. The derivation of word M1 is</p>
        </sec>
        <sec id="sec-1-2-12">
          <title>A ) BuBrFdF ) urd</title>
          <p>and the word M2 is generated as follows:</p>
        </sec>
        <sec id="sec-1-2-13">
          <title>A ) BuBrGdG ) ) ClBuBrEuClBuBrErErGdGlCdErGdGlC ) ) lurulurrrdldrdl</title>
          <p>eAPcol systems generating Moore curve are very
similar to that one generating commands for Hilbert curve.
They differs only in the programs for the second phase of
part 3, because the generating CF rules are different. But
the CF rules are of the same length and they contain the
same number of non-terminals on their right hand side.
A3
A4
A5
A6
A9
A10
A15
A16
n = 1</p>
        </sec>
        <sec id="sec-1-2-14">
          <title>1. N ! NuLuNrRdDdRrNuLuN</title>
        </sec>
        <sec id="sec-1-2-15">
          <title>2. L ! LuNuLlDdRdDlLuNuL</title>
        </sec>
        <sec id="sec-1-2-16">
          <title>3. R ! RdDdRrNuLuNrRdDdR</title>
        </sec>
        <sec id="sec-1-2-17">
          <title>4. D ! DdRdDlLuNuLlDdRdD</title>
          <p>All right hand sides of the rules are again of the same
length ( it is a transformation of the original curve
representation), but the number of non-terminals on the right
hand side of the rules has increased from 4 to 9 compared
to the Hilbert curve. The phase of agent creation has to
take more steps (4 steps) and system will generate some
spare agents (sixteen instead of nine). Also the phase of
insertion of objects from right hand side of CF rules will
take more steps (35 steps). The other phases of
computation stays the same as in previous subsection.
4</p>
        </sec>
      </sec>
    </sec>
    <sec id="sec-2">
      <title>Conclusion</title>
      <p>In this contribution we showed APcol system with agent
creation as a kind of P colonies is suitable model for turtle
graphics commands generation. We presented the idea of
construction of APcol system with capacity two that can
compute turtle commands for given number of iteration as
the input. We have described the construction of the
system for two space-filling curves - Hilbert curve and Peano
curve. For the construction, we exploited the existence of
context-free rules to generate a string of directions
representing these curves. Future work in the area of APcol
systems ability research may focus not only on generating
space-filling curves, but also on generation of command
string of other curves that use parameters (for example a
change of step length ) or the stochastic command
generation rules.</p>
      <p>Notes and Comments. This work was supported
partially by European Union under European Structural
and Investment Funds Operational Programme
Research, Development and Education project Zvýšení
kvality vzdeˇlávání na Slezské univerziteˇ v Opaveˇ
ve vazbeˇ na potrˇeby Moravskoslezského kraje,
CZ.02.2.69/0.0/0.0/18_058/0010238 and by the
Silesian University in Opava under the Student Funding
Scheme, project SGS/11/2019.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <surname>Ceterchi</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Subramanian</surname>
            ,
            <given-names>K.G.</given-names>
          </string-name>
          <article-title>Generating pictures in string representation with P systems: the case of spacefilling curves</article-title>
          .
          <source>J Membr Comput</source>
          <volume>2</volume>
          ,
          <fpage>369</fpage>
          -
          <lpage>379</lpage>
          (
          <year>2020</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <surname>Cienciala</surname>
            ,
            <given-names>L.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Ciencialová</surname>
            ,
            <given-names>L.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Csuhaj-Varjú</surname>
            ,
            <given-names>E.</given-names>
          </string-name>
          :
          <string-name>
            <surname>Towards P Colonies Processing</surname>
          </string-name>
          <article-title>Strings</article-title>
          .
          <source>In: Proc. BWMC</source>
          <year>2014</year>
          , Sevilla,
          <year>2014</year>
          . pp.
          <fpage>102</fpage>
          -
          <lpage>118</lpage>
          . Fénix Editora, Sevilla, Spain (
          <year>2014</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <surname>Cienciala</surname>
            ,
            <given-names>L.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Ciencialová</surname>
            ,
            <given-names>L.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Csuhaj-Varjú</surname>
          </string-name>
          , E.:
          <article-title>P colonies processing strings</article-title>
          .
          <source>Fundamenta Informaticae</source>
          <volume>134</volume>
          (
          <issue>1-2</issue>
          ),
          <fpage>51</fpage>
          -
          <lpage>65</lpage>
          (
          <year>2014</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <surname>Cienciala</surname>
            ,
            <given-names>L.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Ciencialová</surname>
            ,
            <given-names>L.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Csuhaj-Varjú</surname>
          </string-name>
          , E.:
          <article-title>A Class of Restricted P Colonies with String Environment</article-title>
          .
          <source>Natural Computing</source>
          <volume>15</volume>
          (
          <issue>4</issue>
          ),
          <fpage>541</fpage>
          -
          <lpage>549</lpage>
          (
          <year>2016</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <surname>Ciencialová</surname>
            ,
            <given-names>L.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Csuhaj-Varjú</surname>
            ,
            <given-names>E.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Cienciala</surname>
            ,
            <given-names>L.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Sosík</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          : P colonies.
          <source>Bulletin of the International Membrane Computing Society</source>
          <volume>1</volume>
          (
          <issue>2</issue>
          ):
          <fpage>119</fpage>
          -
          <lpage>156</lpage>
          (
          <year>2016</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <surname>Csuhaj-Varjú</surname>
            ,
            <given-names>E.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Kelemen</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          , Pa˘un, Gh.,
          <string-name>
            <surname>Dassow</surname>
            ,
            <given-names>J</given-names>
          </string-name>
          .(eds.):
          <article-title>Grammar Systems: A Grammatical Approach to Distribution and Cooperation</article-title>
          . Gordon and Breach Science Publishers, Inc., Newark, NJ, USA (
          <year>1994</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <surname>Hilbert</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          :
          <article-title>Über die stetige Abbildung einer Linie auf ein Flächenstück</article-title>
          . Math. Annln.
          <volume>38</volume>
          <fpage>459</fpage>
          -
          <lpage>460</lpage>
          (
          <year>1891</year>
          ).).
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <surname>Kelemenová</surname>
            ,
            <given-names>A.: P</given-names>
          </string-name>
          <string-name>
            <surname>Colonies</surname>
          </string-name>
          .
          <source>Chapter</source>
          <volume>23</volume>
          .1, In: Pa˘un, Gh.,
          <string-name>
            <surname>Rozenberg</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Salomaa</surname>
            ,
            <given-names>A</given-names>
          </string-name>
          . (eds.)
          <source>The Oxford Handbook of Membrane Computing</source>
          , pp.
          <fpage>584</fpage>
          -
          <lpage>593</lpage>
          . Oxford University Press (
          <year>2010</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <surname>Kelemen</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Kelemenová</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          , Pa˘un, G.:
          <article-title>Preview of P Colonies: A Biochemically Inspired Computing Model</article-title>
          .
          <source>In: Workshop and Tutorial Proceedings. Ninth International Conference on the Simulation and Synthesis of Living Systems (Alife IX)</source>
          . pp.
          <fpage>82</fpage>
          -
          <lpage>86</lpage>
          . Boston, Mass (
          <year>2004</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <surname>Kelemen</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Kelemenová</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          :
          <article-title>A Grammar-Theoretic Treatment of Multiagent Systems</article-title>
          . Cybern. Syst.
          <volume>23</volume>
          (
          <issue>6</issue>
          ),
          <fpage>621</fpage>
          -
          <lpage>633</lpage>
          (
          <year>1992</year>
          ),
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [11] Pa˘un, Gh.,
          <string-name>
            <surname>Rozenberg</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Salomaa</surname>
            ,
            <given-names>A</given-names>
          </string-name>
          .(eds.):
          <source>The Oxford Handbook of Membrane Computing</source>
          . Oxford University Press, Inc., New York, NY, USA (
          <year>2010</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          [12]
          <string-name>
            <surname>Peano</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          :
          <article-title>Sur une courbe qui remplit toute une aire plane</article-title>
          .
          <source>Math. Annln</source>
          .
          <volume>36</volume>
          ,
          <fpage>157</fpage>
          -
          <lpage>160</lpage>
          (
          <year>1890</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          [13]
          <string-name>
            <surname>Prusinkiewicz</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Lindenmayer</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          :
          <source>The Algorithmic Beauty of Plants</source>
          . Springer-Verlag, Berlin, Heidelberg (
          <year>1996</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          [14]
          <string-name>
            <surname>Rozenberg</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Salomaa</surname>
            ,
            <given-names>A</given-names>
          </string-name>
          .(eds.):
          <article-title>Handbook of Formal Languages I-III</article-title>
          . Springer Verlag.,
          <string-name>
            <surname>Berin-</surname>
          </string-name>
          Heidelberg-New York (
          <year>1997</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          [15]
          <string-name>
            <surname>Siromoney</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Subramanian</surname>
            ,
            <given-names>K.G.</given-names>
          </string-name>
          :
          <article-title>Space-filling curves and Infinite graphs</article-title>
          .
          <source>Lecture notes in Comp. Sci. 153</source>
          (
          <year>1983</year>
          )
          <fpage>380</fpage>
          -
          <lpage>391</lpage>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>