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

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Thue-Morse step by step in the Action! 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 Action! programming language

Source code in the action! programming language

PROC Next(CHAR ARRAY s)
  BYTE i,len
  CHAR c

  IF s(0)=0 THEN
    s(0)=1 s(1)='0
    RETURN
  FI

  FOR i=1 TO s(0)
  DO
    IF s(i)='0 THEN
      c='1
    ELSE
      c='0
    FI
    s(s(0)+i)=c
  OD
  s(0)==*2
RETURN

PROC Main()
  BYTE i
  CHAR ARRAY s(256)

  s(0)=0
  FOR i=0 TO 7
  DO
    Next(s)
    PrintF("T%B=%S%E%E",i,s)
  OD
RETURN

  

You may also check:How to resolve the algorithm Balanced brackets step by step in the Swift programming language
You may also check:How to resolve the algorithm Move-to-front algorithm step by step in the ALGOL 68 programming language
You may also check:How to resolve the algorithm Rot-13 step by step in the Arturo programming language
You may also check:How to resolve the algorithm Yin and yang step by step in the Raku programming language
You may also check:How to resolve the algorithm Stack traces step by step in the BASIC programming language