Initial commit: Generator for Circus
This commit is contained in:
commit
737915cb3b
6
README.md
Normal file
6
README.md
Normal file
@ -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
|
32
data-generator.py
Normal file
32
data-generator.py
Normal file
@ -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 <number> 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)
|
Loading…
Reference in New Issue
Block a user