From 737915cb3bd868d02b6b7683e52ee87c8aacb144 Mon Sep 17 00:00:00 2001 From: Alexandre CATTEAU Date: Sun, 28 Apr 2024 18:56:21 +0200 Subject: [PATCH] Initial commit: Generator for Circus --- README.md | 6 ++++++ data-generator.py | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 README.md create mode 100644 data-generator.py diff --git a/README.md b/README.md new file mode 100644 index 0000000..b5be393 --- /dev/null +++ b/README.md @@ -0,0 +1,6 @@ +# Ticket to Campaign +Tooling for running a campaign of Ticket to Ride Legacy: Legends of the West without altering the game material + +### Components +* `data-generator.py` contains models to generate data for a campaign + * currently, only generates a Circus instance diff --git a/data-generator.py b/data-generator.py new file mode 100644 index 0000000..ba985b9 --- /dev/null +++ b/data-generator.py @@ -0,0 +1,32 @@ +# Generation of data for a campaign of Ticket to Ride Legacy Legends of the West + +# Imports +import random + +# Class for Circus: list of wagons, of the 5 colors +class Circus: + # There are: + # 4 wagons of each colors (until 2 players' stop) + # 2 wagons of each colors (until 3 players' stop) + # 2 wagons of each colors (until 4 players' stop) + # 2 wagons of each colors (until 5 players' stop) + # NOTE: In the original distribution, the same color never appears twice in a row + # We chose to remove this constraint, for the sake of simplicity + + def __init__(self, playersNb): + wagonsPerColors = 2 * playersNb + colors = "blue", "green", "black", "red", "yellow" + remaining = {"blue": wagonsPerColors, "green": wagonsPerColors, "black": wagonsPerColors, "red": wagonsPerColors, "yellow": wagonsPerColors} + self.wagons = [] + for n in range(0, 5 * wagonsPerColors): + color = colors[random.randint(0, 4)] + while remaining[color] == 0: + color = colors[random.randint(0, 4)] + self.wagons.append(color) + remaining[color] = remaining[color] - 1 + + #def next(): # returns next color (i.e., color that the player will get it they use circus) + +myCircus = Circus(3) + +print(myCircus.wagons)