Esempio n. 1
0
def print_hotels(context):
    if len(infos.free_hotels(context)) == 7:
        return
    else:
    	print "HOTELS ON THE BOARD:"
    	for h in constants.hotels:
    		if infos.chainsize(context, h) > 1:
    			print h + ": size = " + str(infos.chainsize(context, h))
Esempio n. 2
0
def newchain_input(context):
    '''raw input function for newchain_at()'''
    new = 0
    while new == 0:
        new = raw_input("Which hotel would you like to found?")
        if new not in infos.free_hotels(context):
            print "Bad Input."
            new = 0
    return new
Esempio n. 3
0
def newchain_at(context, x):
    """creates a new hotel chain with tile placed at x"""
    print "You have created a new chain."
    print "Available hotels are " + str(infos.free_hotels(context))
    new = inputs.newchain_input(context)
    context['grid'][x]['chain'] = new 
    adj_chain(context, x, new)
    context['player'][context['cp']]['stock'][new] = context['player'][context['cp']]['stock'][new] + 1
    context['stock'][new] = context['stock'][new]-1
    print "Player " + str(context['cp']) + " gets 1 free share of " + new + "."
Esempio n. 4
0
def print_chain_leaders(context):
    '''Prints each existing chain and its leading shareholders'''
    if len(infos.free_hotels(context)) == 7:
        return
    else:
        print "CHAIN LEADERS:"
        for h in constants.hotels:
            if context['stock'][h] < 25:
                bonus_winners = infos.find_holders(context, h)
                if bonus_winners == [[],[]]: #no shareholders at all
                    print h + " has no shareholders!  Tragic!"
                elif len(bonus_winners[0]) > 1: #tie for Majority
                    print h + ": Players " + str(bonus_winners[0]) + "tie for majority shareholder with " + str(context['player'][bonus_winners[0][0]]['stock'][h]) + " shares each."
                elif len(bonus_winners[0]) == 1 and bonus_winners[1] == []: #Only one shareholder
                    print h + ": Player " + str(bonus_winners[0][0]) + " is the only shareholder, with " + str(context['player'][bonus_winners[0][0]]['stock'][h]) + " shares."
                else: # One maj shareholder, one or more mins
                    print h + ": Player " + str(bonus_winners[0][0]) + " is the Majority shareholder, with " + str(context['player'][bonus_winners[0][0]]['stock'][h]) + " shares."
                    if len(bonus_winners[1]) == 1: # single winning minority holder
                        print "   and Player " + str(bonus_winners[1][0]) + " is the highest minority shareholder with " + str(context['player'][bonus_winners[1][0]]['stock'][h]) + " shares."
                    else: #tie for min bonus
                        print "   and Players " + str(bonus_winners[1]) + " tie for minority shareholder with " + str(context['player'][bonus_winners[1][0]]['stock'][h]) + " shares each."