How to resolve the algorithm Fairshare between two and more step by step in the Quackery programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Fairshare between two and more step by step in the Quackery programming language

Table of Contents

Problem Statement

The Thue-Morse sequence is a sequence of ones and zeros that if two people take turns in the given order, the first persons turn for every '0' in the sequence, the second for every '1'; then this is shown to give a fairer, more equitable sharing of resources. (Football penalty shoot-outs for example, might not favour the team that goes first as much if the penalty takers take turns according to the Thue-Morse sequence and took 2^n penalties) The Thue-Morse sequence of ones-and-zeroes can be generated by:

Use this method:

Counting from zero;   using a function/method/routine to express an integer count in base b, sum the digits modulo b to produce the next member of the Thue-Morse fairshare series for b people.

Show the first 25 terms of the fairshare sequence:

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Fairshare between two and more step by step in the Quackery programming language

Source code in the quackery programming language

  [ dup dip digitsum mod ] is fairshare ( n n --> n )  

  ' [ 2 3 5 11 ]
  witheach
    [ dup echo say ": "
      25 times
        [ i^ over fairshare echo sp ] 
      drop cr ]

  

You may also check:How to resolve the algorithm Count in octal step by step in the XPL0 programming language
You may also check:How to resolve the algorithm Number names step by step in the 360 Assembly programming language
You may also check:How to resolve the algorithm Primality by trial division step by step in the ALGOL 60 programming language
You may also check:How to resolve the algorithm Long year step by step in the APL programming language
You may also check:How to resolve the algorithm Rock-paper-scissors step by step in the Ruby programming language