# Masks of Trust: Trust Index Formula

As we prepare for the full reveal of *Masks of Trust: Game Theory Interactive App*, we're excited to share a glimpse into the system that powers key behavioral dynamics inside the simulation.

One of the core mechanics revolves around how trust is measured and interpreted during each interaction. Below is a simple yet powerful function that calculates a “Trust Index” — a value that plays a critical role in decision outcomes between players.

This method uses the minimum of the two scores and adds half the difference to it.

Parameters:

* socialTrustScore: The social trust score (0...1)
    

* personalTrustScore: The personal trust score (0...1)
    

Returns: A Double representing the combined trust index

```swift
// Function to calculate the trust index. Dev by Hackobian dd May 2025
private func calculateTrustIndex(socialTrustScore: Double, personalTrustScore: Double) -> Double {
    // 1. Find the minimum value between socialTrustScore and personalTrustScore
    let minimumScore = min(socialTrustScore, personalTrustScore)
    
    // 2. Calculate the absolute difference between the two scores
    let difference = abs(socialTrustScore - personalTrustScore)
    
    // 3. Trust index = minimum + half of the difference
    let trustIndex = minimumScore + 0.5 * difference
    
    return trustIndex
}
```

While the logic may seem straightforward, its impact is far from trivial. This formula shapes how players navigate ambiguity, interpret intentions, and respond to subtle shifts in trust.

Stay tuned — in the coming weeks, we’ll unveil more design insights and mechanics that turn abstract concepts into meaningful interactive experiences.
