About the Algorithms Used in No Blame

The algorithms used in No Blame are not especially sophisticated, although they are a little complicated to explain. First, it is important to know that there are two major algorithms at work here: a shuffling algorithm that shuffles the original poems’ lines, followed by a casting algorithm that casts an I Ching hexagram for each of the 64 poems / art works that make up the final book. Essentially, the output of the poem shuffling algorithm provides the material for the casting of the I Ching, which determines how the poems and art will be titled and placed into the final sequence. The following list explains what is done, step by step, to shuffle the original 16 poems, how the casting algorithm is applied, and what the link is between the two.

  1. First, there are two versions of the poem set that are pre-coded into the program: the original poems, and a version reorganized by linguistic category (the "linguistic lists"). Note that the linguistic lists themselves do not appear in the final work, but are used only to generate an alternative shuffled version that does.
  2. A complete set of "stanza patterns" is generated in such a way that 16 sets of non-repeating numbers between 1 and 16 are created, and each number (1-16) appears exactly 4 times across the 16 sets. This is important; since these numbers represent which line numbers from the 16-line poems to "grab" during the shuffling process, it is necessary that every line gets used once and only once in creating the new, shuffled poem set.
  3. Next, the shuffled poems are created by applying each of the stanza patterns 4 times (per poem) in order to create the new set of 16-line poems. When a stanza pattern is applied, it grabs one of the lines from the 16 original or linguistic list poems that has the corresponding line value. This line is then removed from consideration during the rest of the shuffling process so that is not used again.
  4. The original poem set and the newly created shuffled original poem and shuffled linguistic list sets are now stored along with the line values for each line. Note that the line values for the "linguist lists" are stored as well in order to be used in the following first step of the casting algorithm; the results for this, however, will be applied to the generation of the 16 art works instead of to any of the poems.
  5. The saved line values are now used as the "coin tosses" for the modified coin-toss method used in the algorithm that casts I Ching hexagrams for each poem, establishing a connection between the poems and the casting of the I Ching. The casting algorithm queries whether a randomly selected line from the poem being cast is even or odd; if even, this is counted as a "heads," and if odd, as "tails." Three such "coin tosses" are made in order to determine if the current hexagram line is "broken" or "solid," and this process is repeated until six hexagram lines have been cast from the bottom up and a complete hexagram is determined for the poem/artwork. (Note: Please consult information elsewhere on the details of using the coin toss method to cast the I Ching.)
  6. Much like with the shuffling algorithm, the casting algorithm is applied one poem at a time through all of the sets in such a way to ensure that each I Ching hexagram is cast once and only once. Essentially, each time a hexagram is determined for a poem, the algorithm asks if that hexagram has already been cast; if so, the algorithm rejects the result and casts again until the result is a hexagram that has not yet been cast.
  7. The title and number of each cast hexagram is now stored along with the poems and the art pages (and will be used to determine which artworks will be generated; see the page about the generative art for more information).
  8. Finally, the entire set for the book is sorted into numerical order by hexagram, so that this generated instance of the No Blame book proceeds from hexagram 1 through 64 as numbered in the King Wen sequence.