diff --git a/main.py b/main.py new file mode 100644 index 0000000..6cfdc88 --- /dev/null +++ b/main.py @@ -0,0 +1,82 @@ +import random +import neurolab +#numbers = 0, 9 +#type = ["a", "b", "c", "d", "e", "Y"] +#color = ["r", "y", "b", "g"] +class card(): + def __init__(self, type=None): + self.type = "" + if type == None: + self.__randomcard() + else: + self.type = type + + def __randomcard(self): + temp = random.choice(["r", "y", "b", "g"]) + temp = temp + str(random.randint(0, 9)) + temp = temp + random.choice(["a", "b", "c", "d", "e", "Y"]) + if temp[2] == "Y": + temp = temp[:2] + elif temp[2] == "d" or temp[2] == "e": + temp = "z" + temp[2:3] + else: + temp = temp[0] + temp[2] + self.type = temp + +class cardset(): + def __init__(self, cards, cardset=None): + self.cards = [] + if cardset == None: + for i in range(cards): + self.cards.append(card()) + else: + for i in cardset: + self.cards.append(card(i)) + + def show(self): + for i in self.cards: + i = i.type + if i[0] == "r": + color = "rote" + elif i[0] == "y": + color = "gelbe" + elif i[0] == "b": + color = "blaue" + elif i[0] == "g": + color = "grĂ¼ne" + elif i[0] == "z": + color = "" + else: + color = "UNKNOWN COLOR" + if i[1].isnumeric(): + type = i[1] + else: + if i[1] == "a": + type = "2 aufnehmen" + elif i[1] == "b": + type = "richtungswechsel" + elif i[1] == "c": + type = "aussetzen" + elif i[1] == "d": + type = "farb wechsel" + elif i[1] == "e": + type = "4 aufnehmen" + else: + type = "UNKNOWN TYPE" + print(color+" "+type) + + def setcard(self, target, toset): + self.cards[target].type = toset +class game(): + def __init__(self, players=2, cards=7): + self.players = {} + for i in range(players): + self.players[i] = cardset(cards) + + def showcards(self): + for i in self.players: + print("player {}:".format(i)) + self.players[i].show() + + +