I'm currently building a monopoly simulator to learn Python, and got to where I need to simulate the "chance" and "community chest" cards. I'm thinking about doing them as a dict switch case, eg:
def chanceCard(argument):
switch = {
0: , #argument for card one
....
15:, #arugment for card fifteen
}
return switcher.get(argument, "default")
However, some of the cards essentially do the same, like "Move to Go". Is it possible to have several inputs point to the same argument? And make the code less cluttered. This would also (initially) make it easier to simulate, as i don't care about the money-gain cards.
The argument is a uniformly distributed random value between 0 and 15.
Thanks in advance!
Aucun commentaire:
Enregistrer un commentaire