| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

All You Need Is Blend (part 1)

Page history last edited by Bill Maya 15 years, 1 month ago

In Special Operators we talked a little about Blend and the kinds of things it lets you do. The Blend Operator is far and away the most useful tool for calculations with BNumbers. With this one Operator, you can perform just about all of the common calculations we find in Scripts.

 

Averaging Two BNumbers (with or without a Bias)

 

Blend's most frequent use is to take two values and find a value between them, or in other words, to average them. It also allows you to put your thumb on the scale toward one or the other value, by use of the third term, the bias factor. For instance, let's suppose you have a family drama sequence in which a character, a ne'er-do-well, gets into trouble and has to go around begging family members for help. All family members have to decide whether to intervene for him. Let's further suppose you want each family member to take into account both how close their kinship is to the begging Actor, as well as how much affection they have for him.

The script might look like this:

 

beg for help:beggee: intervene on behalf of: Inclination

Blend of:

   Kinship of:

        ReactingActor

        ThisSubject

   PNasty_Nice of:

        ReactingActor

        ThisSubject

   0.0

 

In this example, the Actor who has to make a decision whether to intervene is the ReactingActor and the ne'er-do-well who has just begged for help is ThisSubject.  Notice that this script assumes the degree of Kinship is equally important to the outcome as the degree of affection ReactingActor has for ThisSubject. But you can also use the bias factor to change the balance. Let's walk through some examples.

 

(1) In the example above, if Kinship is +0.5 (ReactingActor and ThisSubject are cousins) but PNasty_Nice is -0.5 (ReactingActor actively dislikes ThisSubject), you get this:

 

Blend of:

   +0.5

   -0.5

   0.0

 

This yields a result of 0.0—the average of +0.5 and -0.5. In this scenario, ReactingActor might intervene for ThisSubject. But don't bet your life savings on it; there's only a 50/50 chance that it'll happen, all other things being equal. This is what you get when you place equal importance on Kinship and PNasty_Nice.

 

(2) You can also do weighted averages, which give greater weight to one of the Blend factors. Let's try making the degree of Kinship a little more important than PNasty_Nice. In this case, as above, ReactingActor and ThisSubject are still cousins (Kinship is +0.5), and ReactingActor still dislikes ThisSubject (PNasty_Nice is -0.5), but we change the bias factor to +0.2—that is, we put our thumb on the scales and tip the result toward the first term, Kinship.

 

Blend of:

   +0.5

   -0.5

   +0.2

 

(The +0.2 means we are biasing toward the first term, Kinship. If we used a -0.2, we'd be biasing toward the second term, PNasty_Nice.)

This yields a result of +0.1, because the bias factor of +0.2 gives slightly greater weight to the +0.5. ReactingActor is a bit more likely to help his irritating cousin out.

 

(3) What if we want to make ReactingActor's PNasty_Nice for ThisSubject more important than than Kinship?

 

Blend of:

   +0.5

   -0.5

   -0.6

 

A -0.6 biases the result strongly toward the second term, PNasty_Nice. This yields a result of -0.3. In this case, ReactingActor is quite a bit less likely to help out his or her irritating cousin than in either of the prior two examples.

 

If you play around with the Blend operator in Scryptalyzer you can see this principle at work.

 

Next Tutorial: All You Need Is Blend (part 2)

Previous Tutorial: BNumbers, UNumbers, and Numbers

 


Creative Commons License  This tutorial by Storytron, Inc. is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License.

 

Comments (0)

You don't have permission to comment on this page.