Esempio n. 1
0
    def _current_points_difference(self, team_a_points, team_b_points):
        current_result = "trailing" if team_a_points < team_b_points else "leading"
        points_difference = abs(team_a_points - team_b_points)
        formatter = "point" if points_difference == 1 else "points"

        points_difference_string = "You're {} by: {} {}.".format(current_result, abs(team_a_points - team_b_points),
                                                                 formatter)
        log_string(points_difference_string, self._output)
Esempio n. 2
0
    def __print_legend(self):
        legend = [
            "[Legend:]", "TM = Transfers Made, H = Hit(s),",
            "Outcome: Points gained/lost from transfers,", "TV = Team Value,",
            "Tot = TV + Bank\n"
        ]

        for string in legend:
            log_string(string, self.__output)
    def __print_legend(self):
        print()
        legend = [
            "> Legend: ", "OR = Overall Rank, OP = Overall Points,\n"
            "C = Captain, VC = Vice Captain,\n"
            "PP = Players Played, TM = Transfers Made, H = Hit(s),\n"
            "TV = Team Value", "Tot = TV + Bank\n"
        ]

        for string in legend:
            log_string(string, self.__output)
Esempio n. 4
0
    def __print_average(self):
        (my_points, average_points, league_name) = self.__average
        average_data = [
            "[League: {}]".format(league_name),
            "[Your score: {}]".format(my_points),
            "[AVERAGE score: {}".format(average_points)
        ]
        log_list_of_strings(average_data, self._output)

        winner = self._define_winner(self._team.manager_name, my_points,
                                     "AVERAGE", average_points)
        winner_string = "[Winner: {}]\n".format(winner)
        log_string(winner_string, self._output)
Esempio n. 5
0
    def __print_summary(self):
        [used_bench_points, total_bench_points] = self.__sum_bench_points()

        log_string("[Summary:]", self.__output)
        log_string("Used bench points: {}".format(used_bench_points),
                   self.__output)
        log_string("Total bench points: {}".format(total_bench_points),
                   self.__output)
        log_string("", self.__output)
    def __print_table_output(self):
        # tabulate requires a list of lists, so that's why it's needed
        list_of_lists = [manager.to_list() for manager in self.__managers]
        headers = self.__init_headers()

        # tablefmt="fancy_grid"
        table_output = tabulate(list_of_lists,
                                headers=headers,
                                tablefmt="orgtbl",
                                floatfmt=".1f",
                                numalign="center",
                                stralign="center")

        log_string(table_output, self.__output)
        log_string("", self.__output)

        formatter = "entry" if len(self.__managers) < 2 else "entries"
        print("\n{} {} have been loaded successfully.".format(
            len(self.__managers), formatter))
    def __print_summary(self):
        log_string("[Summary:]", self.__output)
        log_string("Transfers made: {}".format(self.__transfers_made),
                   self.__output)
        log_string("Hits taken: {}".format(self.__hits_taken), self.__output)

        sign = ""
        if self.__total_outcome > 0:
            sign = "+"

        log_string("Total outcome: {}{}".format(sign, self.__total_outcome),
                   self.__output)
        self.__output.append("")
Esempio n. 8
0
    def _print_one_matchup(self, opponent):
        ((team_unique_players, team_points), (opp_unique_players, opp_points)) = \
            self._list_of_unique_players_and_their_points(opponent)

        team_manager = self._team.manager_name
        opponent_manager = opponent.manager_name

        unique_players = ["{}: [{}] vs.".format(team_manager, team_unique_players),
                          "{}: [{}]".format(opponent_manager, opp_unique_players)]
        log_list_of_strings(unique_players, self._output)

        if self._team.active_chip != "None" or opponent.active_chip != "None":
            active_chip = ["[Active chip]",
                           "{} vs. {}".format(self._team.active_chip, opponent.active_chip)]
            log_list_of_strings(active_chip, self._output)

        hits_taken = ["[Hits taken]",
                      "{}: {}".format(team_manager, self._team.gw_hits),
                      "{}: {}".format(opponent_manager, opponent.gw_hits)]
        log_list_of_strings(hits_taken, self._output)

        different_players_points = ["[Points gained by different players]",
                                    "{}: {}".format(team_manager, team_points),
                                    "{}: {}".format(opponent_manager, opp_points)]
        log_list_of_strings(different_players_points, self._output)

        if self._team.gw_hits != opponent.gw_hits:
            hit_cost = 4
            team_points -= self._team.gw_hits*hit_cost
            opp_points -= opponent.gw_hits*hit_cost

        # Take hits into account
        self._current_points_difference(team_points, opp_points)

        winner = self._define_winner(team_manager, team_points, opponent_manager, opp_points)
        winner_string = "[Winner: {}]\n".format(winner)
        log_string(winner_string, self._output)
Esempio n. 9
0
    def __print_table_output(self):
        log_string("[{}'s Autosubs History:]".format(self.__manager_name),
                   self.__output)
        log_string("", self.__output)

        headers = ["GW", "Players Out", "Players In", "Used BP", "Total BP"]

        # tabulate requires a list of lists, so that's why it's needed
        list_of_lists = [manager.to_list() for manager in self.__managers]

        table_output = tabulate(list_of_lists,
                                headers=headers,
                                tablefmt="orgtbl",
                                floatfmt=".1f",
                                numalign="center",
                                stralign="center")

        log_string(table_output, self.__output)
        log_string("", self.__output)
Esempio n. 10
0
    def __print_histogram(self):
        log_string("[Autosubs Histogram:]", self.__output)
        log_string("", self.__output)

        histogram_headers = ["Name", "Points", "Times"]
        histogram_output = tabulate(
            self.__managers[0].get_players_in_histogram(),
            headers=histogram_headers,
            tablefmt="orgtbl",
            numalign="center",
            stralign="center")

        log_string(histogram_output, self.__output)
        self.__output.append("")
    def _print_table_output(self):
        log_string(self._WC_MSG, self.__output)

        headers = [
            "GW", "OR", "Transfers Out", "Transfers In", "Transfers Made",
            "Hits", "Outcome"
        ]
        list_of_lists = [manager.to_list_gw() for manager in self.__managers]

        table_output = tabulate(list_of_lists,
                                headers=headers,
                                tablefmt="orgtbl",
                                floatfmt=".1f",
                                numalign="center",
                                stralign="center")

        log_string(table_output, self.__output)
        log_string("", self.__output)
Esempio n. 12
0
    def _print_table_output(self):
        log_string(self._WC_MSG, self.__output)

        list_of_lists = [manager.to_list() for manager in self.__managers]
        headers = [
            "No", "Manager", "Transfers Out", "Transfers In",
            "{} TM".format(self._gw_name), "{} H".format(self._gw_name),
            "Outcome", "{} P".format(self._gw_name), "TV", "Bank", "Tot"
        ]

        table_output = tabulate(list_of_lists,
                                headers=headers,
                                tablefmt="orgtbl",
                                floatfmt=".1f",
                                numalign="center",
                                stralign="center")

        log_string(table_output, self.__output)
        log_string("", self.__output)
Esempio n. 13
0
 def wrapper(self, opponent):
     league = "[League: {}]".format(opponent.league_name)
     log_string(league, self._output)
     f(self, opponent)
 def _print_wc_fh_info(self):
     for manager in self.__managers:
         if manager.get_wc_info() is not None:
             info = manager.get_wc_info()
             log_string(info, self.__output)
             log_string("", self.__output)
Esempio n. 15
0
    def _print_record(self):
        record = "[Record: {}W, {}D, {}L]\n".format(self._wins, self._draws, self._losses)
        log_string(record, self._output)

        print("Good luck, {}! :)".format(self.__manager_name))