mirror of
https://github.com/hanzoai/synth.git
synced 2026-10-30 18:20:12 +00:00
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:
- Two people exchange all their items
- The owners of two items exchange these items
- The person holding a certain item exchanges with a specified person
- A person exchanges their item for another item
- 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:
- Randomly select a language (Chinese/English)
- Generate character names
- Generate items (color + category)
- Initialize item ownership relationships
- Generate a sequence of exchange operations and calculate the final ownership
- Generate the problem description
- Format the answer
How to Run
Use the run.sh script to run the game data generation:
./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