Another ‘Typical’ Day

I did a lot of outside work (reducing fuels, freeing up a pine buried by deer brush, cleaning up the shop, etc), but here’s what I did today on Siboot:

Fixing the uncertainty calculation
I previously discussion the initialization of uncertainty values. Today’s problem was different: when an actor does something that causes another actor to adjust his p-Value for the active actor, how much does the uncertainty in the second actor’s p-Value change? I ended up completely rewriting the algorithm, using Blend instead of multiplication. 

Fixing the calculation of quantifier indeces
There are seven quantifiers representing -3 through +3. When I wish to display a BNumber quantity, I must first convert it to the appropriate index. The algorithm relied on doing a standard BNumber-to-Number transform. This was a mistake: that transform yields values greater than 1 only for extreme values of the BNumber. Therefore, I replaced that algorithm with a simple linear algorithm:

QuantifierIndex = (int)(4.0 * x) + 3;

Why do they all hate me?
It seems that everybody holds Caroonycoork in contempt; on all the scales they come out negative. The initializing algorithm does use a large random number for setting up p-Values, so I cut it down a bit, but that didn’t change much. I wonder, should I dump the use of accordance values? They certainly do bias the p-Values strongly, even though I divide them by 4. I shrink the effect by dividing by 8 instead of 4, but it has little effect. Here’s a table of the p-Values towards Caroonycoork:

actual values (good, honest, powerful): 0.559944  -0.17998199  0.21997799

2      0.56634796 -0.4729029 -0.20025802
3      0.45091456 -0.55137384 0.05944395
4      0.5714832 -0.12971503 -0.2720527
5      0.3274892 -0.2741139 -0.20420516
6      0.5587621 -0.5281234 -0.39456606
7      0.45590872 -0.35870272 0.089405656

This shows the p-Values (pGood, pHonest, pPowerful) for each of the other actors towards Caroonycoork. One thing leaps out at me: every one of the p-Values is less than the actual value. My algorithm has a fatal flaw: it’s one-sided. A little research led me to a horrifying discovery: my BRandom function doesn’t yield random numbers! They’re all negative! I checked the original source code for SWAT, and the error wasn’t in that code. At some point I changed my Siboot code, introducing this ghastly error. 

LoopyBooby Time
The previous problem fixed, I ran a new test run and quickly got into a new problem. Now Gaustusu was much more forthcoming — too forthcoming, in fact. He gossiped with me and showed no indication of stopping. When I checked the script, I found that there’s nothing stopping an actor from gossiping forever. So I need to insert a check on such behavior. One source of this is that the only options available to respond to gossip are “I see”, “gossip”, and “tell about betrayal”. There’s nothing in there permitting an actor to propose a deal. So I must also add the “suggest a deal” option. 

Fixing up some stupid code
That done, I turned to something that has been bugging me for a long time. Facundo Dominguez, the original programmer of the SWAT software, developed a system of such elegance that a clod like myself simply couldn’t grasp it. It had a beautiful system that permitted an indefinite number of traits to be attached to any actor, prop, or stage, all smoothly and easily. Unfortunately, it was simply too abstract for my simple mind, and I had the devil of time just figuring out how to even access the values in his system. 

The solution presented itself when I stumbled upon a truly oddball bit of code that referenced the values through the Sappho operators that modified them. This code was indirect in extremis; it used an operator to point to something else that pointed to something else that pointed to the value I needed. I implemented that scheme throughout my own cruddy code.

Sometime later, though, I figured out a better, more direct scheme that didn’t go through so many intermediaries. I replaced my old, clumsy code with the new scheme and it worked. I promised myself that I’d do the same thing for all the other places where the clumsy code appeared.

Well, this evening, I finished that little bit of housekeeping. Sometimes it’s important to go back and clean up your code.

And so the day draws to a close.