# Goods Exchange Game

## Game Rules

- There are n people, each owning one item
- Items are identified by color and category (e.g., "red book")
- A series of exchange operations are executed, such as "A and B exchange all their items"
- The goal is to calculate what items each person owns after all exchanges are completed

## Game Example

```
There are 5 people: John, Mary, Tom, Sarah, and David; There are 5 items: red book, blue watch, green headphones, yellow pen, and purple cup, with exactly one of each item;
Before the exchanges, the correspondence between people and items is: John owns the red book; Mary owns the blue watch; Tom owns the green headphones; Sarah owns the yellow pen; David owns the purple cup;
3 exchange actions occur in sequence:
1st exchange: John and Mary exchange all their items
2nd exchange: The person holding the blue watch and Tom exchange all their items
3rd exchange: The person who owns the red book and the person who owns the purple cup exchange their items
Find the correspondence between people and items at the end of all exchanges.

The answer is (John,purple cup),(Mary,green headphones),(Tom,red book),(Sarah,yellow pen),(David,blue watch)
```

## Technical Implementation

The Goods Exchange game implements various exchange operation modes, including:

1. Two people exchange all their items
2. The owners of two items exchange these items
3. The person holding a certain item exchanges with a specified person
4. A person exchanges their item for another item
5. Various other exchange methods

It also includes some interference operations, such as "Someone wanted to exchange with another person, but was refused," which do not affect the final result.

## Data Generation

Game data generation follows these steps:

1. Randomly select a language (Chinese/English)
2. Generate character names
3. Generate items (color + category)
4. Initialize item ownership relationships
5. Generate a sequence of exchange operations and calculate the final ownership
6. Generate the problem description
7. Format the answer

## How to Run

Use the run.sh script to run the game data generation:

```bash
./games/tasks/goods_exchange/run.sh
```

Parameter description:
- `--num_of_data`: Number of problems to generate
- `--max_attempts`: Maximum number of attempts for each problem
- `--num_people`: Number of characters
- `--operator_num`: Number of exchange operations