From 4e4e02353d1f917c4fdd620984daf4b6d49dd096 Mon Sep 17 00:00:00 2001 From: chunhao Date: Thu, 22 Feb 2018 18:14:01 +0800 Subject: [PATCH 1/3] f string isn't supported by python 3.5 --- treys/card.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/treys/card.py b/treys/card.py index 753aea2..0c03bd7 100644 --- a/treys/card.py +++ b/treys/card.py @@ -189,7 +189,7 @@ def int_to_pretty_str(card_int): r = Card.STR_RANKS[rank_int] - return f"[{r}{s}]" + return "[{}{}]".format(r,s) @staticmethod def print_pretty_card(card_int): From 1f4c1f4bf2a87a2e93f80055519f4984bc5ebf4f Mon Sep 17 00:00:00 2001 From: chunhao Date: Thu, 22 Feb 2018 18:18:50 +0800 Subject: [PATCH 2/3] f string isn't supported by python 3.5 --- treys/evaluator.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/treys/evaluator.py b/treys/evaluator.py index 2fa8e6d..f5354ed 100644 --- a/treys/evaluator.py +++ b/treys/evaluator.py @@ -142,7 +142,7 @@ def hand_summary(self, board, hands): for i in range(len(stages)): line = "=" * line_length - print(f"{line} {stages[i]} {line}") + print("{} {} {}".format(line,stages[i],line)) best_rank = 7463 # rank one worse than worst hand winners = [] @@ -153,7 +153,7 @@ def hand_summary(self, board, hands): rank_class = self.get_rank_class(rank) class_string = self.class_to_string(rank_class) percentage = 1.0 - self.get_five_card_rank_percentage(rank) # higher better here - print(f"Player {player + 1} hand = {class_string}, percentage rank among all hands = {percentage}") + print("Player {} hand = {}, percentage rank among all hands = {}".format(player + 1, class_string, percentage)) # detect winner if rank == best_rank: @@ -166,16 +166,16 @@ def hand_summary(self, board, hands): # if we're not on the river if i != stages.index("RIVER"): if len(winners) == 1: - print(f"Player {winners[0] + 1} hand is currently winning.\n") + print("Player {} hand is currently winning.\n".format(winners[0] + 1)) else: - print(f"Players {[x + 1 for x in winners]} are tied for the lead.\n") + print("Players {} are tied for the lead.\n".format([x + 1 for x in winners])) # otherwise on all other streets else: hand_result = self.class_to_string(self.get_rank_class(self.evaluate(hands[winners[0]], board))) print() - print(f"{line} HAND OVER {line}") + print("{} HAND OVER {}".format(line, line)) if len(winners) == 1: - print(f"Player {winners[0] + 1} is the winner with a {hand_result}\n") + print("Player {} is the winner with a {}\n".format(winners[0] + 1, hand_result)) else: - print(f"Players {winners} tied for the win with a {hand_result}\n") + print("Players {} tied for the win with a {}\n".format(winners,hand_result)) From d4eb101e8b0e3f13c74cd58c34eb2cd162ad54a6 Mon Sep 17 00:00:00 2001 From: chunhao Date: Thu, 22 Feb 2018 18:20:02 +0800 Subject: [PATCH 3/3] f string isn't supported by python 3.5 --- go.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/go.py b/go.py index 9223ded..f3e1abc 100644 --- a/go.py +++ b/go.py @@ -47,8 +47,8 @@ p2_class = evaluator.get_rank_class(p2_score) # or get a human-friendly string to describe the score -print(f"Player 1 hand rank = {p1_score} {evaluator.class_to_string(p1_class)}") -print(f"Player 2 hand rank = {p2_score} {evaluator.class_to_string(p2_class)}") +print("Player 1 hand rank = {} {evaluator.class_to_string(p1_class)}".format(p1_score)) +print("Player 2 hand rank = {} {evaluator.class_to_string(p2_class)}".format(p2_score)) # or just a summary of the entire hand hands = [player1_hand, player2_hand]