def addfactions(): '''Initiates factions for the players ''' global factions asking = True c = 0 while c < FACTIONS_MIN or c > FACTIONS_MAX: c = input('How many players? ') try: c = int(c) if c < FACTIONS_MIN or c > FACTIONS_MAX: raise ValueError except ValueError: print('Value must between {0} and {1}!'.format(FACTIONS_MIN,FACTIONS_MAX)) c = 0 i = 0 while (int(c) > i): n = input('Name of the '+ rt.ordinal(len(factions)+1) +' faction? (Enter if random) ') if n == '': n = random.choice(factionnames) del factionnames[factionnames.index(n)] factions.append(Faction(n)) print('{0} faction initialized.'.format(n)) i += 1
def setup(): global deck global factions global state global unrest ## 4.2 MARKERS: .. Place a Revenue marker on the "100" box of the State Treasury ## Track and the Unrest Level Marker on the "0" box... next() state = 100 report("STATE", ":", state) next() unrest = 0 report("UNREST", ":", unrest) next() deckgens = [] deckgens.extend(poolgens) ## 4.4 CARDS: .. Separate the 20 white Senator cards and randomly deal three to ## each player. Return the remaining white Senator cards to the white deck and ## shuffle it. Place the 1st Punic War card in the Inactive Wars section of the ## Forum... random.shuffle(deckgens) report("ER Family Cards", ":", "shuffled!") next() for f in range(len(factions)): dealgens(deckgens, factions[f], 3) deck.extend(deckgens) del deckgens next() Wa01.play() report(rt.ordinal(Wa01.name[1]) + " " + Wa01.name[0], ":", Wa01.status) ## 4.5 FACTION LEADERS: Each player places a Faction Leader marker containing ## the symbol of his Faction on one of his three Senators. next() for f in factions: searching = True i = input("Please name the faction leader of faction " + f.name + ": ") while searching: found = searchname(i, f.senators) if len(found) != 1: i = input("Please be more specific: ") else: searching = False addfactionleader(found[0][1]) ## 4.6 TEMPORARY ROME CONSUL: The Senator in play with the lowest ID# is ## Temporary Rome Consul .. Place the Rome Consul and Prior Consul markers on ## his card and add five to his Influence.. next() for s in senators: if getsenatoridvalue(s) == getminsenatoridvalue(): addromeconsul(s) ## 4.7 INITIAL INTRIGUE PHASE: Each player, starting with the temporary Rome ## Consul and then proceeding clockwise around the table, draws cards from the ## top of the white deck until he has drawn three red cards. He keeps the ## identity of his red cards to himself, but must openly discard all black cards ## he drew face up one at a time as he draws them. After each player has ## obtained three red cards with which to start the game, the remaining cards ## plus all black discards are reshuffled. Each player may decide to play any ## Statesmen or Concessions he has now or hold them in his hand until a ## subsequent Revolution Phase. .. next() deckreds = [] deckreds.extend(poolredcards) random.shuffle(deckreds) report("ER Red Cards", ":", "shuffled!") next() for f in range(len(factions)): dealreds(deckreds, factions[f], 3) next() deck.extend(deckreds) del deckreds deckblacks = [] deckblacks.extend(poolblackcards) deckblacks.remove("Wa01") deck.extend(deckblacks) del deckblacks report("Deck", ":", "done!") next() random.shuffle(deck) report("Deck", ":", "shuffled!")