Thue-Morse: Difference between revisions

Content added Content deleted
Line 1,609: Line 1,609:
Adapted from Java.
Adapted from Java.
===One by One===
===One by One===
The truemorse lambda function return another lambda, which used to send specific part of message, until end of message (return empty string).
The thuemorse lambda function return another lambda, which used to send specific part of message, until end of message (return empty string).


<syntaxhighlight lang="m2000 interpreter">
<syntaxhighlight lang="m2000 interpreter">
truemorse$=lambda$ (n as integer)->{
thuemorse$=lambda$ (n as integer)->{
def sb0$="0", sb1$="1"
def sb0$="0", sb1$="1"
n=max.data(0, n)
n=max.data(0, n)
Line 1,627: Line 1,627:
end while
end while
if n>=0 then n-- :park$+=sb0$
if n>=0 then n-- :park$+=sb0$


if many<len(park$) then
if many<len(park$) then
Line 1,642: Line 1,641:
log$="Message :"+str$(i,0)+{
log$="Message :"+str$(i,0)+{
}
}
t$=truemorse$(i)
t$=thuemorse$(i)
do
do
resp$=t$(16)
resp$=t$(16)
Line 1,681: Line 1,680:


<syntaxhighlight lang="m2000 interpreter">
<syntaxhighlight lang="m2000 interpreter">
// copy truemorse lambda here//
// copy thuemorse lambda here//
dim t$(0 to 6)
dim t$(0 to 6)
document log$
document log$
jobs=stack
jobs=stack
For i=6 to 0
For i=6 to 0
t$(i)=truemorse$(i)
t$(i)=thuemorse$(i)
stack jobs {push i}
stack jobs {push i}
next i
next i