52 lines
967 B
Markdown
52 lines
967 B
Markdown
### Secret Santa
|
|
Simple `python3` script for the "Secret Santa" game. Creates participants pairs from input json file and prints and saves them to the output json file.
|
|
This small script might evolve into a simple website, API or `bash` script in the future!
|
|
|
|
### Run:
|
|
- Create `participants.json` file as in the example
|
|
- Run the next command in your shell (from the same directory as the `main.py` file):
|
|
```sh
|
|
python3 main.py
|
|
```
|
|
- Enjoy script results!
|
|
|
|
### Examples:
|
|
- Input file (`participants.json`):
|
|
```json
|
|
[
|
|
"Jayce",
|
|
"Viktor",
|
|
"Jinx",
|
|
"Vi",
|
|
"Ekko",
|
|
"Caitlyn"
|
|
]
|
|
```
|
|
|
|
- Output file (`pairs.json`):
|
|
```json
|
|
{
|
|
"Jayce": "Vi",
|
|
"Vi": "Viktor",
|
|
"Viktor": "Caitlyn",
|
|
"Caitlyn": "Jinx",
|
|
"Jinx": "Ekko",
|
|
"Ekko": "Jayce"
|
|
}
|
|
```
|
|
|
|
- Console output:
|
|
```
|
|
Reading from participants.json.
|
|
Writing to pairs.json.
|
|
Finished!
|
|
|
|
Results:
|
|
Jayce → Vi
|
|
Vi → Viktor
|
|
Viktor → Caitlyn
|
|
Caitlyn → Jinx
|
|
Jinx → Ekko
|
|
Ekko → Jayce
|
|
```
|