from collections import deque import textItems textItems.addTo(globals()) from util import * addSymbolsTo(globals()) ####################################### # class Card(object): ####################################### colors = Symbols('TAROKK', _CLUBS, _DIAMONDS, _SPADES, _HEARTS, start=0) figures = Symbols(_ACE, _JACK, _KNIGHT, _QUEEN, _KING) tarocks = Symbols('I', 'II', 'III', 'IIII', 'V', 'VI', 'VII', 'VIII', 'IX', 'X', 'XI', 'XII', 'XIII', 'XIV', 'XV', 'XVI', 'XVII', 'XVIII', 'XIX', 'XX', 'XXI', 'SKIZ') # 'SKIZ' = _CLOWN, but referred honours = set() kings = set() _createdCards = {} # singletoning def __new__(cls, num, color=TAROKK): if (color, num) in Card._createdCards: return Card._createdCards[(color, num)] newCard = object.__new__(cls, num, color) Card._createdCards[(color, num)] = newCard return newCard
#!/usr/bin/python '''Tarokk''' import sys from random import randint, shuffle import textItems textItems.addTo(globals()) # get all string literals as global variables if len(sys.argv) > 1: language = sys.argv[1] textItems.setLang(language) from util import * from deck import * from players import * from scenarios import * CHANGE_SEQUENCE = [(0, 2, 2, 2), (1, 2, 2, 1), (2, 2, 1, 1), (3, 1, 1, 1)] ####################################### # class Table(object): ####################################### def __init__(self): self.deck = Deck() self.players = Players([ UserPlayer(_North), AIPlayer(_West), AIPlayer(_South),
from collections import deque import textItems textItems.addTo(globals()) from util import * addSymbolsTo(globals()) ####################################### # class Card(object): ####################################### colors = Symbols('TAROKK',_CLUBS,_DIAMONDS,_SPADES,_HEARTS, start=0) figures = Symbols(_ACE,_JACK,_KNIGHT,_QUEEN,_KING) tarocks = Symbols('I','II','III','IIII','V','VI','VII','VIII','IX','X', 'XI','XII','XIII','XIV','XV','XVI','XVII','XVIII', 'XIX','XX','XXI','SKIZ') # 'SKIZ' = _CLOWN, but referred honours = set() kings = set() _createdCards = {} # singletoning def __new__(cls, num, color=TAROKK): if (color,num) in Card._createdCards: return Card._createdCards[(color,num)] newCard = object.__new__(cls, num, color) Card._createdCards[(color,num)] = newCard return newCard def __init__(self, num, color=TAROKK):
'''Tarokk''' import sys from random import randint, shuffle import textItems textItems.addTo(globals()) # get all string literals as global variables if len(sys.argv)>1: language = sys.argv[1] textItems.setLang(language) from util import * from deck import * from players import * from scenarios import * CHANGE_SEQUENCE = [ (0,2,2,2), (1,2,2,1), (2,2,1,1), (3,1,1,1) ] ####################################### # class Table(object): ####################################### def __init__(self): self.deck = Deck() self.players = Players( [UserPlayer(_North), AIPlayer(_West), AIPlayer(_South), AIPlayer(_East)] )