

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

# 예제: 복합 규칙을 사용하여 비슷한 속성이나 비슷한 선택을 가진 플레이어로 매치 생성
<a name="match-examples-10"></a>

이 예제는 `compound`를 사용하여 두 팀이 참가하는 매치에 대한 규칙 세트를 설정하는 방법을 보여줍니다. 예제에서는: 
+ `SimilarLeagueDistance` 규칙은 매치에 참가하는 모든 플레이어가 다른 플레이어 2명 이내에 `league`를 갖도록 보장합니다.
+ `SimilarSkillDistance` 규칙은 매치에 참가하는 모든 플레이어가 다른 플레이어 10명 이내에 `skill`을 갖도록 보장합니다. 플레이어가 10초 동안 기다린 경우 거리는 20으로 확장됩니다. 플레이어가 20초 동안 기다린 경우 거리는 40으로 확장됩니다.
+ `SameMapComparison` 규칙은 매치에 참가한 모든 플레이어가 동일한 `map`를 요청하도록 보장합니다.
+ `SameModeComparison` 규칙은 매치에 참가한 모든 플레이어가 동일한 `mode`를 요청하도록 보장합니다.
+ 다음 조건 중 하나에 해당하면 `CompoundRuleMatchmaker` 규칙이 일치하는지 확인합니다.
  + 매치에 참가한 플레이어도 동일한 `map` 및 `mode` 요청을 수행했습니다.
  + 매치에 참가한 플레이어는 비슷한 `skill` 및 `league` 속성을 가지고 있습니다.

```
{
    "ruleLanguageVersion": "1.0",
    "teams": [{
        "name": "red",
        "minPlayers": 10,
        "maxPlayers": 20
    }, {
        "name": "blue",
        "minPlayers": 10,
        "maxPlayers": 20
    }],
    "algorithm": {
        "strategy":"balanced",
        "balancedAttribute": "skill",
        "batchingPreference":"fastestRegion"
    },
    "playerAttributes": [{
        "name": "league",
        "type": "number"
    },{
        "name": "skill",
        "type": "number"
    },{
        "name": "map",
        "type": "string"
    },{
        "name": "mode",
        "type": "string"
    }],
    "rules": [{
        "name": "SimilarLeagueDistance",
        "type": "distance",
        "measurements": ["max(flatten(teams[*].players.attributes[league]))"],
        "referenceValue": "min(flatten(teams[*].players.attributes[league]))",
        "maxDistance": 2
    }, {
        "name": "SimilarSkillDistance",
        "type": "distance",
        "measurements": ["max(flatten(teams[*].players.attributes[skill]))"],
        "referenceValue": "min(flatten(teams[*].players.attributes[skill]))",
        "maxDistance": 10
    }, {
        "name": "SameMapComparison",
        "type": "comparison",
        "operation": "=",
        "measurements": ["flatten(teams[*].players.attributes[map])"]
    }, {
        "name": "SameModeComparison",
        "type": "comparison",
        "operation": "=",
        "measurements": ["flatten(teams[*].players.attributes[mode])"]
    }, {
        "name": "CompoundRuleMatchmaker",
        "type": "compound",
        "statement": "or(and(SameMapComparison, SameModeComparison), and(SimilarSkillDistance, SimilarLeagueDistance))"
    }],
    "expansions": [{
        "target": "rules[SimilarSkillDistance].maxDistance",
        "steps": [{
            "waitTimeSeconds": 10,
            "value": 20
        }, {
            "waitTimeSeconds": 20,
            "value": 40
        }]
    }]
}
```