Initialization Problem

Here’s a stupid little problem with Sappho, the programming language for SWAT, which I’m using for Siboot. I’d like to initialize all character relationships to random values. In a conventional language, I’d use something simple like this:

for (int i = 0; (i < 7); ++i)
   {
      for (int j = 0; (j < 7); ++j)
         {
            pPowerful[i,j] = random();
            pTruthful[i,j] = random();
            pGood[i,j] = random();
         }
   }

However, Sappho was designed to avoid flow-control structures. There is a very simple if-statement, but there are no loops. Perhaps this was a mistake; we thought that it would be helpful for non-techie writers. However, now I’m stuck with trying to make Sappho do something it wasn’t designed to do well.

Of course, I could simply unroll the loop, but with 7 characters, there would be 49 versions of the statements, and they cannot readily be copied and pasted repeatedly. So I’m trying to figure out the cleanest way to combine automation with explicit code writing. The actual statement in question looks like this in Sappho:

SetPPowerful
   actor#1
   actor#2
   
random

SetPTruthful
   actor#1
   actor#2
   
random

SetPGood
   actor#1
   actor#2
   
random

I reckon that’s about a thousand mouse-clicks worth of work, and I’ll probably get some wrong, which will be very difficult to find. 

My best guess right now is to use a Verb called InitializeOneRelationship, which incorporates the three statements above, using Subject for actor#1 and DirObject for actor#2. But then I need some way to trigger this Verb for every pair of characters. Remember, an Actor can execute only one Verb at a time.

Aha! The solution is to set up a central hub Verb (‘initializeAllRelationships’), to which each Actor reacts with ‘initializeForNynub’, which in turn leads them to ‘initializeForSoome’, and so on through the list of Actors. It works. There’s still a problem with seven of these Events being displayed to the player; I will solve this by presenting some background information to the player using these Events as cover.