Esempio n. 1
0
 def __init__(self, id,  node_location, name ):
     self.id = id
     self.wallet = {1: [currency_1(currency())] * 5,
                    5: [currency_5(currency())] * 5,
                    10: [currency_10(currency())] * 5,
                    20: [currency_20(currency())] * 6,
                    50: [currency_50(currency())] * 2,
                    100: [currency_100(currency())] * 2,
                    500: [currency_500(currency())] * 2,
     }
     self.node_location = node_location
     self.ownership_purple = []
     self.ownership_light_blue = []
     self.ownership_pink = []
     self.ownership_orange = []
     self.ownership_red = []
     self.ownership_yellow = []
     self.ownership_green = []
     self.ownership_blue = []
     self.ownership_railroad = []
     self.name = name
Esempio n. 2
0
def create_trade():

    team1_abbr = raw_input("Team 1: ")
    team1 = Team(team1_abbr)
    while team1.get_salary() is None:
        print("Unable to find team " + team1_abbr + ". Try again")
        team1_abbr = raw_input("Team 1: ")
        team1 = Team(team1_abbr)

    team1_players = team1.get_players()

    team2_abbr = raw_input("Team 2: ")
    team2 = Team(team2_abbr)
    while team2.get_salary() is None:
        print("Unable to find team " + team2_abbr + ". Try again")
        team2_abbr = raw_input("Team 2: ")
        team2 = Team(team2_abbr)
    team2_players = team2.get_players()

    teams = [team1, team2]
    while 1:
        ans = raw_input(
            "Would you like to include more teams? Include them now, or type 'no' if you are done adding teams: "
        )
        if ans == "no":
            break
        new_team = Team(ans)
        while new_team.get_salary() is None:
            print("Unable to find team " + ans + ". Try again")
            ans = raw_input("Team: ")
            if ans == "no":
                break
            new_team = Team(ans)

        teams.append(Team(ans))

    print("")
    console_print.print_players_together(
        team1_players, team2_players,
        max(len(team1_players), len(team2_players)))
    print(
        "----------------------------------------------------------------------------------------------------------------------------------------------"
    )
    print("TEAM SALARY: \t\t\t\t\t" + str(currency(team1.salary)) + "\t\t|\t" +
          "TEAM SALARY: \t\t\t\t\t" + str(currency(team2.salary)))
    print(
        "----------------------------------------------------------------------------------------------------------------------------------------------"
    )

    tpes1 = team1.get_trade_exceptions()
    tpes2 = team2.get_trade_exceptions()
    console_print.print_exceptions_together(tpes1, tpes2,
                                            max(len(tpes1), len(tpes2)))
    print("")

    for i in range(2, len(teams)):
        print(teams[i].get_players())
        print("TEAM SALARY: " + currency.currency(teams[i].salary))
        if teams[i].get_trade_exceptions() != []:
            print("Trade Exceptions: ")
            print(teams[i].get_trade_exceptions())

    for i in range(0, len(teams)):
        finished = False
        while not finished:
            player_id = raw_input(
                "Type the Player ID of a player you wish to trade from " +
                teams[i].name + ". Type done when you have finished: ")
            if player_id == "Done" or player_id == "done":
                finished = True
                break
            player = Player(player_id, teams[i].name)
            if player.name is not None:
                teams[i].players_out.append(player)
                if len(teams) == 2:
                    if i == 0:
                        teams[1].players_in.append(player)
                    else:
                        teams[0].players_in.append(player)
                else:
                    match = False
                    while not match:
                        destination = raw_input(
                            "What team would you like to trade " +
                            player.name + " to? ").upper()

                        for q in range(0, len(teams)):
                            if destination == teams[
                                    q].name and destination != player.team.name:
                                match = True
                                print("You are trading " + player.name +
                                      " to " + destination)
                                teams[q].players_in.append(player)

    print(
        "**************************************************************************************************"
    )
    for i in range(0, len(teams)):
        print(teams[i].name + " OUT:", end=' ')
        for p in teams[i].players_out:
            print(p.name, end=', ', flush=True)

        print("")

        print(teams[i].name + " IN:", end=' ')
        for p in teams[i].players_in:
            print(p.name, end=', ', flush=True)

        print("")

    trade = Trade(teams)

    for i in teams:
        i.calc_money_in()
        i.calc_money_out()

    trade.summary()
    decisions = []
    for team in teams:
        decision, msg = trade.check_trade(team)
        print(msg)
        decisions.append(decision)
        if not decision:
            break

    print(trade.finalize_trade(decisions))
Esempio n. 3
0
 def add_500(self, num):
     val = [[currency_1(currency())]] * num
     self.wallet[500].extend(val)
Esempio n. 4
0
def getanswer(msg,query,orig_query):
	if msg == "<train status>":
		ans = train(query)
	elif msg == "<weather status>":
		ans = weather(query)
        elif msg == "<cricinfo module>":
                ans = cric_info(orig_query)
        elif msg == "<festival module>":
                ans = festival(orig_query)
        elif msg == "<tennis module>":
                ans = tennis(orig_query)
        elif msg == "<car module>":
        	ans=car(orig_query)
        elif msg == "<tank module>":
        	ans=tank(orig_query)
        elif msg == "<disease module>":
        	ans=disease(orig_query)       
	elif msg == "<flight module>":
                ans = flight(orig_query)
        elif msg == "<recipe module>":
                ans = recipe(orig_query)
	elif msg=="<discography module>":
		ans=discography(orig_query)
	elif msg=="<electronic module>":
		ans=electronic(orig_query)
        elif msg == "<wiki module>":
                ans = wiki_module(orig_query)

        elif msg == "<bank module>":
                ans = bank_module(orig_query)

	#elif msg == "<restaurant module>":
		#ans = restaurant(orig_query)
		
		
	#elif msg == "<website module>":
	#	ans = get_website(orig_query)

	elif msg == "<stock status>":
		ans = stock(query)
	elif msg == "<mineral status>":
		ans = mineral(query)
	elif msg == "<sports status>":
		ans = sports(query)
	elif msg == "<movie review>":
		ans = movie(query,orig_query)
        elif msg == "<exam status>":
                ans = exam(query)
        elif msg == "<locationcentric module>":
                ans = location(query)
	elif msg == "<highway module>":
                ans = highway(query)
	elif msg == "<differences module>":
                ans = differences(orig_query)
	elif msg == "<currency module>":
		ans = currency(query) 
	elif msg == "<meanings module>":
		ans= meanings(orig_query)  
        elif msg == "<theatre module>":
                ans= theatre(orig_query)
        elif msg == "<minister module>":
                ans= minister(orig_query)

        elif msg == "<std module>":
                ans= std(query)

        elif msg == "<bday module>":
                ans= [{"bday":[]}]

        elif msg == "<highcourt module>":
                ans = highcourt(orig_query)


	#print "here"             
	return ans
Esempio n. 5
0
import apifetch
import createdb
import currency

apifetch()
createdb()
currency()