# Serves

## Overview

This section will cover the basic packets that will be a part of every game. A match is played the best **3 of 5 games**. For each game, the first player to reach 11 points wins that game, however a game must be won by at least a two point margin. A point is scored after each ball is put into play.

1. Change of Service (Swap Serve)
2. Change of Side (Swap Side)

## 1. Change of Service (Swap Serve)

The player to serve first is chosen at random, with the winner of the random draw able to choose to serve first or receive first.

The player who is serving changes after a certain number of points are scored. In an 11 point game, the service changes every 2 points.

Example of how it works.

* Player A serves first to Player B. They each get one point, and the score is 1-1. The total score is now 2, so it is Player B's turn to serve and therefore a `SwapServe` packet will be emitted.
* Player B gets the next 2 points, and the score is 1-3. The total score is now 4, and the serve switches back to Player A.
* Player A continues serving until the total score is 6.

In an 11 point game, the game must be won by a 2-point lead. If both players score 10 points, the service switches after every point until the game is over.

The rules in doubles game are following the same logic desribed above. At each change of service, the last receiver shall become the server and the partner of the previous server shall become the receiver. For example, a correct pattern would be:

* Player A has played his two serves to player X
* Player X then plays his two serves to player B.
* Player B will then play his two serves to Player Y
* player Y will play his two serves to Player A.

Player A will then restart the sequence all over again and the sequence will repeat itself until a changeover or the end of the game.

```
{
    "eventElementType": "SwapServe",
    "game": 1,
    "id": 99991,
    "matchScore": {
        "pointsA": 0,
        "pointsB": 0
    },
    "scores": [],
    "seqNum": 2,
    "timestamp": "2021-07-13T13:41:29.944Z"
}
```

## 2. Change of Side (Swap Sides)

A changeover occurs when one team has scored 5 points. This will also change up the order of receiving.

For instance, players A & B score 5 points first, whilst A is serving to X. After changing ends, player A will serve to player Y for the remainder of the game.

```
{
    "eventElementType": "SwapSides",
    "game": 1,
    "id": 99991,
    "matchScore": {
        "pointsA": 0,
        "pointsB": 0
    },
    "scores": [],
    "seqNum": 3,
    "timestamp": "2021-07-13T13:41:31.405Z"
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sportradar.com/table-tennis/live-data-scenarios/during-a-match/the-basics.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
