How to resolve the algorithm Thue-Morse step by step in the FutureBasic programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Thue-Morse step by step in the FutureBasic programming language

Table of Contents

Problem Statement

Create a Thue-Morse sequence.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Thue-Morse step by step in the FutureBasic programming language

Source code in the futurebasic programming language

local fn ThueMorse( s as Str255 ) as Str255
  Str255 k
  short  i
  
  k = ""
  for i = 1 to len$(s)
    if mid$(s, i, 1) == "1"
      k += "0"
    else
      k += "1"
    end if
  next
end fn = s + k

local fn DoIt
  Str255 tm
  short  i
  
  tm = "0"
  print tm
  for i = 1 to 7
    tm = fn ThueMorse( tm )
    print tm
  next
end fn

fn DoIt

HandleEvents

  

You may also check:How to resolve the algorithm Singly-linked list/Element insertion step by step in the XPL0 programming language
You may also check:How to resolve the algorithm Wilson primes of order n step by step in the Phix programming language
You may also check:How to resolve the algorithm Primality by trial division step by step in the Quackery programming language
You may also check:How to resolve the algorithm Two bullet roulette step by step in the Go programming language
You may also check:How to resolve the algorithm Commatizing numbers step by step in the Go programming language