From 8098498440be3fcb51d5b65db65514f80535d439 Mon Sep 17 00:00:00 2001 From: Naman Goyal Date: Thu, 7 Oct 2021 20:11:44 -0400 Subject: [PATCH 1/8] Fix typo --- players/g10_player.py | 2 +- players/g1_player.py | 2 +- players/g2_player.py | 2 +- players/g3_player.py | 2 +- players/g4_player.py | 2 +- players/g5_player.py | 2 +- players/g6_player.py | 2 +- players/g7_player.py | 2 +- players/g8_player.py | 2 +- players/g9_player.py | 2 +- random_player.py | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/players/g10_player.py b/players/g10_player.py index 5f30626..e7dba9c 100644 --- a/players/g10_player.py +++ b/players/g10_player.py @@ -20,7 +20,7 @@ def __init__(self, flavor_preference: List[int], rng: np.random.Generator, logge self.state = None def serve(self, top_layer: np.ndarray, curr_level: np.ndarray, player_idx: int, get_flavors: Callable[[], List[int]], get_player_count: Callable[[], int], get_served: Callable[[], List[Dict[int, int]]], get_turns_received: Callable[[], List[int]]) -> Dict[str, Union[Tuple[int], int]]: - """Request what to scoop or whom to pass in the given step of the turn. In each turn the simulator calls this serve function mulitple times for each step for a single player, until the player has scooped 24 units of ice-cream or asked to pass to next player or made an invalid request. If you have scooped 24 units of ice-cream in a turn then you get one last step in that turn where you can specify to pass to a player. + """Request what to scoop or whom to pass in the given step of the turn. In each turn the simulator calls this serve function multiple times for each step for a single player, until the player has scooped 24 units of ice-cream or asked to pass to next player or made an invalid request. If you have scooped 24 units of ice-cream in a turn then you get one last step in that turn where you can specify to pass to a player. Args: top_layer (np.ndarray): Numpy 2d array of size (24, 15) containing flavor at each cell location diff --git a/players/g1_player.py b/players/g1_player.py index 5f30626..e7dba9c 100644 --- a/players/g1_player.py +++ b/players/g1_player.py @@ -20,7 +20,7 @@ def __init__(self, flavor_preference: List[int], rng: np.random.Generator, logge self.state = None def serve(self, top_layer: np.ndarray, curr_level: np.ndarray, player_idx: int, get_flavors: Callable[[], List[int]], get_player_count: Callable[[], int], get_served: Callable[[], List[Dict[int, int]]], get_turns_received: Callable[[], List[int]]) -> Dict[str, Union[Tuple[int], int]]: - """Request what to scoop or whom to pass in the given step of the turn. In each turn the simulator calls this serve function mulitple times for each step for a single player, until the player has scooped 24 units of ice-cream or asked to pass to next player or made an invalid request. If you have scooped 24 units of ice-cream in a turn then you get one last step in that turn where you can specify to pass to a player. + """Request what to scoop or whom to pass in the given step of the turn. In each turn the simulator calls this serve function multiple times for each step for a single player, until the player has scooped 24 units of ice-cream or asked to pass to next player or made an invalid request. If you have scooped 24 units of ice-cream in a turn then you get one last step in that turn where you can specify to pass to a player. Args: top_layer (np.ndarray): Numpy 2d array of size (24, 15) containing flavor at each cell location diff --git a/players/g2_player.py b/players/g2_player.py index 5f30626..e7dba9c 100644 --- a/players/g2_player.py +++ b/players/g2_player.py @@ -20,7 +20,7 @@ def __init__(self, flavor_preference: List[int], rng: np.random.Generator, logge self.state = None def serve(self, top_layer: np.ndarray, curr_level: np.ndarray, player_idx: int, get_flavors: Callable[[], List[int]], get_player_count: Callable[[], int], get_served: Callable[[], List[Dict[int, int]]], get_turns_received: Callable[[], List[int]]) -> Dict[str, Union[Tuple[int], int]]: - """Request what to scoop or whom to pass in the given step of the turn. In each turn the simulator calls this serve function mulitple times for each step for a single player, until the player has scooped 24 units of ice-cream or asked to pass to next player or made an invalid request. If you have scooped 24 units of ice-cream in a turn then you get one last step in that turn where you can specify to pass to a player. + """Request what to scoop or whom to pass in the given step of the turn. In each turn the simulator calls this serve function multiple times for each step for a single player, until the player has scooped 24 units of ice-cream or asked to pass to next player or made an invalid request. If you have scooped 24 units of ice-cream in a turn then you get one last step in that turn where you can specify to pass to a player. Args: top_layer (np.ndarray): Numpy 2d array of size (24, 15) containing flavor at each cell location diff --git a/players/g3_player.py b/players/g3_player.py index 5f30626..e7dba9c 100644 --- a/players/g3_player.py +++ b/players/g3_player.py @@ -20,7 +20,7 @@ def __init__(self, flavor_preference: List[int], rng: np.random.Generator, logge self.state = None def serve(self, top_layer: np.ndarray, curr_level: np.ndarray, player_idx: int, get_flavors: Callable[[], List[int]], get_player_count: Callable[[], int], get_served: Callable[[], List[Dict[int, int]]], get_turns_received: Callable[[], List[int]]) -> Dict[str, Union[Tuple[int], int]]: - """Request what to scoop or whom to pass in the given step of the turn. In each turn the simulator calls this serve function mulitple times for each step for a single player, until the player has scooped 24 units of ice-cream or asked to pass to next player or made an invalid request. If you have scooped 24 units of ice-cream in a turn then you get one last step in that turn where you can specify to pass to a player. + """Request what to scoop or whom to pass in the given step of the turn. In each turn the simulator calls this serve function multiple times for each step for a single player, until the player has scooped 24 units of ice-cream or asked to pass to next player or made an invalid request. If you have scooped 24 units of ice-cream in a turn then you get one last step in that turn where you can specify to pass to a player. Args: top_layer (np.ndarray): Numpy 2d array of size (24, 15) containing flavor at each cell location diff --git a/players/g4_player.py b/players/g4_player.py index 5f30626..e7dba9c 100644 --- a/players/g4_player.py +++ b/players/g4_player.py @@ -20,7 +20,7 @@ def __init__(self, flavor_preference: List[int], rng: np.random.Generator, logge self.state = None def serve(self, top_layer: np.ndarray, curr_level: np.ndarray, player_idx: int, get_flavors: Callable[[], List[int]], get_player_count: Callable[[], int], get_served: Callable[[], List[Dict[int, int]]], get_turns_received: Callable[[], List[int]]) -> Dict[str, Union[Tuple[int], int]]: - """Request what to scoop or whom to pass in the given step of the turn. In each turn the simulator calls this serve function mulitple times for each step for a single player, until the player has scooped 24 units of ice-cream or asked to pass to next player or made an invalid request. If you have scooped 24 units of ice-cream in a turn then you get one last step in that turn where you can specify to pass to a player. + """Request what to scoop or whom to pass in the given step of the turn. In each turn the simulator calls this serve function multiple times for each step for a single player, until the player has scooped 24 units of ice-cream or asked to pass to next player or made an invalid request. If you have scooped 24 units of ice-cream in a turn then you get one last step in that turn where you can specify to pass to a player. Args: top_layer (np.ndarray): Numpy 2d array of size (24, 15) containing flavor at each cell location diff --git a/players/g5_player.py b/players/g5_player.py index 5f30626..e7dba9c 100644 --- a/players/g5_player.py +++ b/players/g5_player.py @@ -20,7 +20,7 @@ def __init__(self, flavor_preference: List[int], rng: np.random.Generator, logge self.state = None def serve(self, top_layer: np.ndarray, curr_level: np.ndarray, player_idx: int, get_flavors: Callable[[], List[int]], get_player_count: Callable[[], int], get_served: Callable[[], List[Dict[int, int]]], get_turns_received: Callable[[], List[int]]) -> Dict[str, Union[Tuple[int], int]]: - """Request what to scoop or whom to pass in the given step of the turn. In each turn the simulator calls this serve function mulitple times for each step for a single player, until the player has scooped 24 units of ice-cream or asked to pass to next player or made an invalid request. If you have scooped 24 units of ice-cream in a turn then you get one last step in that turn where you can specify to pass to a player. + """Request what to scoop or whom to pass in the given step of the turn. In each turn the simulator calls this serve function multiple times for each step for a single player, until the player has scooped 24 units of ice-cream or asked to pass to next player or made an invalid request. If you have scooped 24 units of ice-cream in a turn then you get one last step in that turn where you can specify to pass to a player. Args: top_layer (np.ndarray): Numpy 2d array of size (24, 15) containing flavor at each cell location diff --git a/players/g6_player.py b/players/g6_player.py index 5f30626..e7dba9c 100644 --- a/players/g6_player.py +++ b/players/g6_player.py @@ -20,7 +20,7 @@ def __init__(self, flavor_preference: List[int], rng: np.random.Generator, logge self.state = None def serve(self, top_layer: np.ndarray, curr_level: np.ndarray, player_idx: int, get_flavors: Callable[[], List[int]], get_player_count: Callable[[], int], get_served: Callable[[], List[Dict[int, int]]], get_turns_received: Callable[[], List[int]]) -> Dict[str, Union[Tuple[int], int]]: - """Request what to scoop or whom to pass in the given step of the turn. In each turn the simulator calls this serve function mulitple times for each step for a single player, until the player has scooped 24 units of ice-cream or asked to pass to next player or made an invalid request. If you have scooped 24 units of ice-cream in a turn then you get one last step in that turn where you can specify to pass to a player. + """Request what to scoop or whom to pass in the given step of the turn. In each turn the simulator calls this serve function multiple times for each step for a single player, until the player has scooped 24 units of ice-cream or asked to pass to next player or made an invalid request. If you have scooped 24 units of ice-cream in a turn then you get one last step in that turn where you can specify to pass to a player. Args: top_layer (np.ndarray): Numpy 2d array of size (24, 15) containing flavor at each cell location diff --git a/players/g7_player.py b/players/g7_player.py index 5f30626..e7dba9c 100644 --- a/players/g7_player.py +++ b/players/g7_player.py @@ -20,7 +20,7 @@ def __init__(self, flavor_preference: List[int], rng: np.random.Generator, logge self.state = None def serve(self, top_layer: np.ndarray, curr_level: np.ndarray, player_idx: int, get_flavors: Callable[[], List[int]], get_player_count: Callable[[], int], get_served: Callable[[], List[Dict[int, int]]], get_turns_received: Callable[[], List[int]]) -> Dict[str, Union[Tuple[int], int]]: - """Request what to scoop or whom to pass in the given step of the turn. In each turn the simulator calls this serve function mulitple times for each step for a single player, until the player has scooped 24 units of ice-cream or asked to pass to next player or made an invalid request. If you have scooped 24 units of ice-cream in a turn then you get one last step in that turn where you can specify to pass to a player. + """Request what to scoop or whom to pass in the given step of the turn. In each turn the simulator calls this serve function multiple times for each step for a single player, until the player has scooped 24 units of ice-cream or asked to pass to next player or made an invalid request. If you have scooped 24 units of ice-cream in a turn then you get one last step in that turn where you can specify to pass to a player. Args: top_layer (np.ndarray): Numpy 2d array of size (24, 15) containing flavor at each cell location diff --git a/players/g8_player.py b/players/g8_player.py index 5f30626..e7dba9c 100644 --- a/players/g8_player.py +++ b/players/g8_player.py @@ -20,7 +20,7 @@ def __init__(self, flavor_preference: List[int], rng: np.random.Generator, logge self.state = None def serve(self, top_layer: np.ndarray, curr_level: np.ndarray, player_idx: int, get_flavors: Callable[[], List[int]], get_player_count: Callable[[], int], get_served: Callable[[], List[Dict[int, int]]], get_turns_received: Callable[[], List[int]]) -> Dict[str, Union[Tuple[int], int]]: - """Request what to scoop or whom to pass in the given step of the turn. In each turn the simulator calls this serve function mulitple times for each step for a single player, until the player has scooped 24 units of ice-cream or asked to pass to next player or made an invalid request. If you have scooped 24 units of ice-cream in a turn then you get one last step in that turn where you can specify to pass to a player. + """Request what to scoop or whom to pass in the given step of the turn. In each turn the simulator calls this serve function multiple times for each step for a single player, until the player has scooped 24 units of ice-cream or asked to pass to next player or made an invalid request. If you have scooped 24 units of ice-cream in a turn then you get one last step in that turn where you can specify to pass to a player. Args: top_layer (np.ndarray): Numpy 2d array of size (24, 15) containing flavor at each cell location diff --git a/players/g9_player.py b/players/g9_player.py index 5f30626..e7dba9c 100644 --- a/players/g9_player.py +++ b/players/g9_player.py @@ -20,7 +20,7 @@ def __init__(self, flavor_preference: List[int], rng: np.random.Generator, logge self.state = None def serve(self, top_layer: np.ndarray, curr_level: np.ndarray, player_idx: int, get_flavors: Callable[[], List[int]], get_player_count: Callable[[], int], get_served: Callable[[], List[Dict[int, int]]], get_turns_received: Callable[[], List[int]]) -> Dict[str, Union[Tuple[int], int]]: - """Request what to scoop or whom to pass in the given step of the turn. In each turn the simulator calls this serve function mulitple times for each step for a single player, until the player has scooped 24 units of ice-cream or asked to pass to next player or made an invalid request. If you have scooped 24 units of ice-cream in a turn then you get one last step in that turn where you can specify to pass to a player. + """Request what to scoop or whom to pass in the given step of the turn. In each turn the simulator calls this serve function multiple times for each step for a single player, until the player has scooped 24 units of ice-cream or asked to pass to next player or made an invalid request. If you have scooped 24 units of ice-cream in a turn then you get one last step in that turn where you can specify to pass to a player. Args: top_layer (np.ndarray): Numpy 2d array of size (24, 15) containing flavor at each cell location diff --git a/random_player.py b/random_player.py index 5f30626..e7dba9c 100644 --- a/random_player.py +++ b/random_player.py @@ -20,7 +20,7 @@ def __init__(self, flavor_preference: List[int], rng: np.random.Generator, logge self.state = None def serve(self, top_layer: np.ndarray, curr_level: np.ndarray, player_idx: int, get_flavors: Callable[[], List[int]], get_player_count: Callable[[], int], get_served: Callable[[], List[Dict[int, int]]], get_turns_received: Callable[[], List[int]]) -> Dict[str, Union[Tuple[int], int]]: - """Request what to scoop or whom to pass in the given step of the turn. In each turn the simulator calls this serve function mulitple times for each step for a single player, until the player has scooped 24 units of ice-cream or asked to pass to next player or made an invalid request. If you have scooped 24 units of ice-cream in a turn then you get one last step in that turn where you can specify to pass to a player. + """Request what to scoop or whom to pass in the given step of the turn. In each turn the simulator calls this serve function multiple times for each step for a single player, until the player has scooped 24 units of ice-cream or asked to pass to next player or made an invalid request. If you have scooped 24 units of ice-cream in a turn then you get one last step in that turn where you can specify to pass to a player. Args: top_layer (np.ndarray): Numpy 2d array of size (24, 15) containing flavor at each cell location From b543cbb485849f2d497571a0f19aa8f415b2b728 Mon Sep 17 00:00:00 2001 From: Naman Goyal Date: Thu, 7 Oct 2021 20:15:14 -0400 Subject: [PATCH 2/8] Improve comments --- players/g10_player.py | 6 +++--- players/g1_player.py | 6 +++--- players/g2_player.py | 6 +++--- players/g3_player.py | 6 +++--- players/g4_player.py | 6 +++--- players/g5_player.py | 6 +++--- players/g6_player.py | 6 +++--- players/g7_player.py | 6 +++--- players/g8_player.py | 6 +++--- players/g9_player.py | 6 +++--- random_player.py | 6 +++--- 11 files changed, 33 insertions(+), 33 deletions(-) diff --git a/players/g10_player.py b/players/g10_player.py index e7dba9c..ae7d787 100644 --- a/players/g10_player.py +++ b/players/g10_player.py @@ -26,10 +26,10 @@ def serve(self, top_layer: np.ndarray, curr_level: np.ndarray, player_idx: int, top_layer (np.ndarray): Numpy 2d array of size (24, 15) containing flavor at each cell location curr_level (np.ndarray): Numpy 2d array of size (24, 15) containing current level at each cell location from 8 to 0, where 8 is highest level at start and 0 means no icecream left at this level player_idx (int): index of your player, 0-indexed - get_flavors (Callable[[], List[int]]): list of all possible flavors + get_flavors (Callable[[], List[int]]): method which returns a list of all possible flavors get_player_count (Callable[[], int]): number of total players - get_served (Callable[[], List[Dict[int, int]]]): returns a list of dictionaries corresponding to each player, each dictionary at index i tells how units of a flavor are present in the bowl of the player with index i. E.g. lets say the fourth element is {1: 0, 2: 8...} means the corresponding player with index 4 has 0 units of flavor 1 and 8 units of flavor - get_turns_received (Callable[[], List[int]]): returns a list of integers corresponding to each player, each element at index i tells how many turns a player with index i has played so far. + get_served (Callable[[], List[Dict[int, int]]]): method which returns a list of dictionaries corresponding to each player, each dictionary at index i tells how units of a flavor are present in the bowl of the player with index i. E.g. lets say the fourth element is {1: 0, 2: 8...} means the corresponding player with index 4 has 0 units of flavor 1 and 8 units of flavor + get_turns_received (Callable[[], List[int]]): method which returns a list of integers corresponding to each player, each element at index i tells how many turns a player with index i has played so far. Returns: Dict[str, Union[Tuple[int],int]]: Return a dictionary of action to take in next step. diff --git a/players/g1_player.py b/players/g1_player.py index e7dba9c..ae7d787 100644 --- a/players/g1_player.py +++ b/players/g1_player.py @@ -26,10 +26,10 @@ def serve(self, top_layer: np.ndarray, curr_level: np.ndarray, player_idx: int, top_layer (np.ndarray): Numpy 2d array of size (24, 15) containing flavor at each cell location curr_level (np.ndarray): Numpy 2d array of size (24, 15) containing current level at each cell location from 8 to 0, where 8 is highest level at start and 0 means no icecream left at this level player_idx (int): index of your player, 0-indexed - get_flavors (Callable[[], List[int]]): list of all possible flavors + get_flavors (Callable[[], List[int]]): method which returns a list of all possible flavors get_player_count (Callable[[], int]): number of total players - get_served (Callable[[], List[Dict[int, int]]]): returns a list of dictionaries corresponding to each player, each dictionary at index i tells how units of a flavor are present in the bowl of the player with index i. E.g. lets say the fourth element is {1: 0, 2: 8...} means the corresponding player with index 4 has 0 units of flavor 1 and 8 units of flavor - get_turns_received (Callable[[], List[int]]): returns a list of integers corresponding to each player, each element at index i tells how many turns a player with index i has played so far. + get_served (Callable[[], List[Dict[int, int]]]): method which returns a list of dictionaries corresponding to each player, each dictionary at index i tells how units of a flavor are present in the bowl of the player with index i. E.g. lets say the fourth element is {1: 0, 2: 8...} means the corresponding player with index 4 has 0 units of flavor 1 and 8 units of flavor + get_turns_received (Callable[[], List[int]]): method which returns a list of integers corresponding to each player, each element at index i tells how many turns a player with index i has played so far. Returns: Dict[str, Union[Tuple[int],int]]: Return a dictionary of action to take in next step. diff --git a/players/g2_player.py b/players/g2_player.py index e7dba9c..ae7d787 100644 --- a/players/g2_player.py +++ b/players/g2_player.py @@ -26,10 +26,10 @@ def serve(self, top_layer: np.ndarray, curr_level: np.ndarray, player_idx: int, top_layer (np.ndarray): Numpy 2d array of size (24, 15) containing flavor at each cell location curr_level (np.ndarray): Numpy 2d array of size (24, 15) containing current level at each cell location from 8 to 0, where 8 is highest level at start and 0 means no icecream left at this level player_idx (int): index of your player, 0-indexed - get_flavors (Callable[[], List[int]]): list of all possible flavors + get_flavors (Callable[[], List[int]]): method which returns a list of all possible flavors get_player_count (Callable[[], int]): number of total players - get_served (Callable[[], List[Dict[int, int]]]): returns a list of dictionaries corresponding to each player, each dictionary at index i tells how units of a flavor are present in the bowl of the player with index i. E.g. lets say the fourth element is {1: 0, 2: 8...} means the corresponding player with index 4 has 0 units of flavor 1 and 8 units of flavor - get_turns_received (Callable[[], List[int]]): returns a list of integers corresponding to each player, each element at index i tells how many turns a player with index i has played so far. + get_served (Callable[[], List[Dict[int, int]]]): method which returns a list of dictionaries corresponding to each player, each dictionary at index i tells how units of a flavor are present in the bowl of the player with index i. E.g. lets say the fourth element is {1: 0, 2: 8...} means the corresponding player with index 4 has 0 units of flavor 1 and 8 units of flavor + get_turns_received (Callable[[], List[int]]): method which returns a list of integers corresponding to each player, each element at index i tells how many turns a player with index i has played so far. Returns: Dict[str, Union[Tuple[int],int]]: Return a dictionary of action to take in next step. diff --git a/players/g3_player.py b/players/g3_player.py index e7dba9c..ae7d787 100644 --- a/players/g3_player.py +++ b/players/g3_player.py @@ -26,10 +26,10 @@ def serve(self, top_layer: np.ndarray, curr_level: np.ndarray, player_idx: int, top_layer (np.ndarray): Numpy 2d array of size (24, 15) containing flavor at each cell location curr_level (np.ndarray): Numpy 2d array of size (24, 15) containing current level at each cell location from 8 to 0, where 8 is highest level at start and 0 means no icecream left at this level player_idx (int): index of your player, 0-indexed - get_flavors (Callable[[], List[int]]): list of all possible flavors + get_flavors (Callable[[], List[int]]): method which returns a list of all possible flavors get_player_count (Callable[[], int]): number of total players - get_served (Callable[[], List[Dict[int, int]]]): returns a list of dictionaries corresponding to each player, each dictionary at index i tells how units of a flavor are present in the bowl of the player with index i. E.g. lets say the fourth element is {1: 0, 2: 8...} means the corresponding player with index 4 has 0 units of flavor 1 and 8 units of flavor - get_turns_received (Callable[[], List[int]]): returns a list of integers corresponding to each player, each element at index i tells how many turns a player with index i has played so far. + get_served (Callable[[], List[Dict[int, int]]]): method which returns a list of dictionaries corresponding to each player, each dictionary at index i tells how units of a flavor are present in the bowl of the player with index i. E.g. lets say the fourth element is {1: 0, 2: 8...} means the corresponding player with index 4 has 0 units of flavor 1 and 8 units of flavor + get_turns_received (Callable[[], List[int]]): method which returns a list of integers corresponding to each player, each element at index i tells how many turns a player with index i has played so far. Returns: Dict[str, Union[Tuple[int],int]]: Return a dictionary of action to take in next step. diff --git a/players/g4_player.py b/players/g4_player.py index e7dba9c..ae7d787 100644 --- a/players/g4_player.py +++ b/players/g4_player.py @@ -26,10 +26,10 @@ def serve(self, top_layer: np.ndarray, curr_level: np.ndarray, player_idx: int, top_layer (np.ndarray): Numpy 2d array of size (24, 15) containing flavor at each cell location curr_level (np.ndarray): Numpy 2d array of size (24, 15) containing current level at each cell location from 8 to 0, where 8 is highest level at start and 0 means no icecream left at this level player_idx (int): index of your player, 0-indexed - get_flavors (Callable[[], List[int]]): list of all possible flavors + get_flavors (Callable[[], List[int]]): method which returns a list of all possible flavors get_player_count (Callable[[], int]): number of total players - get_served (Callable[[], List[Dict[int, int]]]): returns a list of dictionaries corresponding to each player, each dictionary at index i tells how units of a flavor are present in the bowl of the player with index i. E.g. lets say the fourth element is {1: 0, 2: 8...} means the corresponding player with index 4 has 0 units of flavor 1 and 8 units of flavor - get_turns_received (Callable[[], List[int]]): returns a list of integers corresponding to each player, each element at index i tells how many turns a player with index i has played so far. + get_served (Callable[[], List[Dict[int, int]]]): method which returns a list of dictionaries corresponding to each player, each dictionary at index i tells how units of a flavor are present in the bowl of the player with index i. E.g. lets say the fourth element is {1: 0, 2: 8...} means the corresponding player with index 4 has 0 units of flavor 1 and 8 units of flavor + get_turns_received (Callable[[], List[int]]): method which returns a list of integers corresponding to each player, each element at index i tells how many turns a player with index i has played so far. Returns: Dict[str, Union[Tuple[int],int]]: Return a dictionary of action to take in next step. diff --git a/players/g5_player.py b/players/g5_player.py index e7dba9c..ae7d787 100644 --- a/players/g5_player.py +++ b/players/g5_player.py @@ -26,10 +26,10 @@ def serve(self, top_layer: np.ndarray, curr_level: np.ndarray, player_idx: int, top_layer (np.ndarray): Numpy 2d array of size (24, 15) containing flavor at each cell location curr_level (np.ndarray): Numpy 2d array of size (24, 15) containing current level at each cell location from 8 to 0, where 8 is highest level at start and 0 means no icecream left at this level player_idx (int): index of your player, 0-indexed - get_flavors (Callable[[], List[int]]): list of all possible flavors + get_flavors (Callable[[], List[int]]): method which returns a list of all possible flavors get_player_count (Callable[[], int]): number of total players - get_served (Callable[[], List[Dict[int, int]]]): returns a list of dictionaries corresponding to each player, each dictionary at index i tells how units of a flavor are present in the bowl of the player with index i. E.g. lets say the fourth element is {1: 0, 2: 8...} means the corresponding player with index 4 has 0 units of flavor 1 and 8 units of flavor - get_turns_received (Callable[[], List[int]]): returns a list of integers corresponding to each player, each element at index i tells how many turns a player with index i has played so far. + get_served (Callable[[], List[Dict[int, int]]]): method which returns a list of dictionaries corresponding to each player, each dictionary at index i tells how units of a flavor are present in the bowl of the player with index i. E.g. lets say the fourth element is {1: 0, 2: 8...} means the corresponding player with index 4 has 0 units of flavor 1 and 8 units of flavor + get_turns_received (Callable[[], List[int]]): method which returns a list of integers corresponding to each player, each element at index i tells how many turns a player with index i has played so far. Returns: Dict[str, Union[Tuple[int],int]]: Return a dictionary of action to take in next step. diff --git a/players/g6_player.py b/players/g6_player.py index e7dba9c..ae7d787 100644 --- a/players/g6_player.py +++ b/players/g6_player.py @@ -26,10 +26,10 @@ def serve(self, top_layer: np.ndarray, curr_level: np.ndarray, player_idx: int, top_layer (np.ndarray): Numpy 2d array of size (24, 15) containing flavor at each cell location curr_level (np.ndarray): Numpy 2d array of size (24, 15) containing current level at each cell location from 8 to 0, where 8 is highest level at start and 0 means no icecream left at this level player_idx (int): index of your player, 0-indexed - get_flavors (Callable[[], List[int]]): list of all possible flavors + get_flavors (Callable[[], List[int]]): method which returns a list of all possible flavors get_player_count (Callable[[], int]): number of total players - get_served (Callable[[], List[Dict[int, int]]]): returns a list of dictionaries corresponding to each player, each dictionary at index i tells how units of a flavor are present in the bowl of the player with index i. E.g. lets say the fourth element is {1: 0, 2: 8...} means the corresponding player with index 4 has 0 units of flavor 1 and 8 units of flavor - get_turns_received (Callable[[], List[int]]): returns a list of integers corresponding to each player, each element at index i tells how many turns a player with index i has played so far. + get_served (Callable[[], List[Dict[int, int]]]): method which returns a list of dictionaries corresponding to each player, each dictionary at index i tells how units of a flavor are present in the bowl of the player with index i. E.g. lets say the fourth element is {1: 0, 2: 8...} means the corresponding player with index 4 has 0 units of flavor 1 and 8 units of flavor + get_turns_received (Callable[[], List[int]]): method which returns a list of integers corresponding to each player, each element at index i tells how many turns a player with index i has played so far. Returns: Dict[str, Union[Tuple[int],int]]: Return a dictionary of action to take in next step. diff --git a/players/g7_player.py b/players/g7_player.py index e7dba9c..ae7d787 100644 --- a/players/g7_player.py +++ b/players/g7_player.py @@ -26,10 +26,10 @@ def serve(self, top_layer: np.ndarray, curr_level: np.ndarray, player_idx: int, top_layer (np.ndarray): Numpy 2d array of size (24, 15) containing flavor at each cell location curr_level (np.ndarray): Numpy 2d array of size (24, 15) containing current level at each cell location from 8 to 0, where 8 is highest level at start and 0 means no icecream left at this level player_idx (int): index of your player, 0-indexed - get_flavors (Callable[[], List[int]]): list of all possible flavors + get_flavors (Callable[[], List[int]]): method which returns a list of all possible flavors get_player_count (Callable[[], int]): number of total players - get_served (Callable[[], List[Dict[int, int]]]): returns a list of dictionaries corresponding to each player, each dictionary at index i tells how units of a flavor are present in the bowl of the player with index i. E.g. lets say the fourth element is {1: 0, 2: 8...} means the corresponding player with index 4 has 0 units of flavor 1 and 8 units of flavor - get_turns_received (Callable[[], List[int]]): returns a list of integers corresponding to each player, each element at index i tells how many turns a player with index i has played so far. + get_served (Callable[[], List[Dict[int, int]]]): method which returns a list of dictionaries corresponding to each player, each dictionary at index i tells how units of a flavor are present in the bowl of the player with index i. E.g. lets say the fourth element is {1: 0, 2: 8...} means the corresponding player with index 4 has 0 units of flavor 1 and 8 units of flavor + get_turns_received (Callable[[], List[int]]): method which returns a list of integers corresponding to each player, each element at index i tells how many turns a player with index i has played so far. Returns: Dict[str, Union[Tuple[int],int]]: Return a dictionary of action to take in next step. diff --git a/players/g8_player.py b/players/g8_player.py index e7dba9c..ae7d787 100644 --- a/players/g8_player.py +++ b/players/g8_player.py @@ -26,10 +26,10 @@ def serve(self, top_layer: np.ndarray, curr_level: np.ndarray, player_idx: int, top_layer (np.ndarray): Numpy 2d array of size (24, 15) containing flavor at each cell location curr_level (np.ndarray): Numpy 2d array of size (24, 15) containing current level at each cell location from 8 to 0, where 8 is highest level at start and 0 means no icecream left at this level player_idx (int): index of your player, 0-indexed - get_flavors (Callable[[], List[int]]): list of all possible flavors + get_flavors (Callable[[], List[int]]): method which returns a list of all possible flavors get_player_count (Callable[[], int]): number of total players - get_served (Callable[[], List[Dict[int, int]]]): returns a list of dictionaries corresponding to each player, each dictionary at index i tells how units of a flavor are present in the bowl of the player with index i. E.g. lets say the fourth element is {1: 0, 2: 8...} means the corresponding player with index 4 has 0 units of flavor 1 and 8 units of flavor - get_turns_received (Callable[[], List[int]]): returns a list of integers corresponding to each player, each element at index i tells how many turns a player with index i has played so far. + get_served (Callable[[], List[Dict[int, int]]]): method which returns a list of dictionaries corresponding to each player, each dictionary at index i tells how units of a flavor are present in the bowl of the player with index i. E.g. lets say the fourth element is {1: 0, 2: 8...} means the corresponding player with index 4 has 0 units of flavor 1 and 8 units of flavor + get_turns_received (Callable[[], List[int]]): method which returns a list of integers corresponding to each player, each element at index i tells how many turns a player with index i has played so far. Returns: Dict[str, Union[Tuple[int],int]]: Return a dictionary of action to take in next step. diff --git a/players/g9_player.py b/players/g9_player.py index e7dba9c..ae7d787 100644 --- a/players/g9_player.py +++ b/players/g9_player.py @@ -26,10 +26,10 @@ def serve(self, top_layer: np.ndarray, curr_level: np.ndarray, player_idx: int, top_layer (np.ndarray): Numpy 2d array of size (24, 15) containing flavor at each cell location curr_level (np.ndarray): Numpy 2d array of size (24, 15) containing current level at each cell location from 8 to 0, where 8 is highest level at start and 0 means no icecream left at this level player_idx (int): index of your player, 0-indexed - get_flavors (Callable[[], List[int]]): list of all possible flavors + get_flavors (Callable[[], List[int]]): method which returns a list of all possible flavors get_player_count (Callable[[], int]): number of total players - get_served (Callable[[], List[Dict[int, int]]]): returns a list of dictionaries corresponding to each player, each dictionary at index i tells how units of a flavor are present in the bowl of the player with index i. E.g. lets say the fourth element is {1: 0, 2: 8...} means the corresponding player with index 4 has 0 units of flavor 1 and 8 units of flavor - get_turns_received (Callable[[], List[int]]): returns a list of integers corresponding to each player, each element at index i tells how many turns a player with index i has played so far. + get_served (Callable[[], List[Dict[int, int]]]): method which returns a list of dictionaries corresponding to each player, each dictionary at index i tells how units of a flavor are present in the bowl of the player with index i. E.g. lets say the fourth element is {1: 0, 2: 8...} means the corresponding player with index 4 has 0 units of flavor 1 and 8 units of flavor + get_turns_received (Callable[[], List[int]]): method which returns a list of integers corresponding to each player, each element at index i tells how many turns a player with index i has played so far. Returns: Dict[str, Union[Tuple[int],int]]: Return a dictionary of action to take in next step. diff --git a/random_player.py b/random_player.py index e7dba9c..ae7d787 100644 --- a/random_player.py +++ b/random_player.py @@ -26,10 +26,10 @@ def serve(self, top_layer: np.ndarray, curr_level: np.ndarray, player_idx: int, top_layer (np.ndarray): Numpy 2d array of size (24, 15) containing flavor at each cell location curr_level (np.ndarray): Numpy 2d array of size (24, 15) containing current level at each cell location from 8 to 0, where 8 is highest level at start and 0 means no icecream left at this level player_idx (int): index of your player, 0-indexed - get_flavors (Callable[[], List[int]]): list of all possible flavors + get_flavors (Callable[[], List[int]]): method which returns a list of all possible flavors get_player_count (Callable[[], int]): number of total players - get_served (Callable[[], List[Dict[int, int]]]): returns a list of dictionaries corresponding to each player, each dictionary at index i tells how units of a flavor are present in the bowl of the player with index i. E.g. lets say the fourth element is {1: 0, 2: 8...} means the corresponding player with index 4 has 0 units of flavor 1 and 8 units of flavor - get_turns_received (Callable[[], List[int]]): returns a list of integers corresponding to each player, each element at index i tells how many turns a player with index i has played so far. + get_served (Callable[[], List[Dict[int, int]]]): method which returns a list of dictionaries corresponding to each player, each dictionary at index i tells how units of a flavor are present in the bowl of the player with index i. E.g. lets say the fourth element is {1: 0, 2: 8...} means the corresponding player with index 4 has 0 units of flavor 1 and 8 units of flavor + get_turns_received (Callable[[], List[int]]): method which returns a list of integers corresponding to each player, each element at index i tells how many turns a player with index i has played so far. Returns: Dict[str, Union[Tuple[int],int]]: Return a dictionary of action to take in next step. From f55bfb07d105e4b9a9c06d5beaecb1c5fea82036 Mon Sep 17 00:00:00 2001 From: Naman Goyal Date: Thu, 7 Oct 2021 20:16:50 -0400 Subject: [PATCH 3/8] Improve comments --- players/g10_player.py | 2 +- players/g1_player.py | 2 +- players/g2_player.py | 2 +- players/g3_player.py | 2 +- players/g4_player.py | 2 +- players/g5_player.py | 2 +- players/g6_player.py | 2 +- players/g7_player.py | 2 +- players/g8_player.py | 2 +- players/g9_player.py | 2 +- random_player.py | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/players/g10_player.py b/players/g10_player.py index ae7d787..f92bab7 100644 --- a/players/g10_player.py +++ b/players/g10_player.py @@ -32,7 +32,7 @@ def serve(self, top_layer: np.ndarray, curr_level: np.ndarray, player_idx: int, get_turns_received (Callable[[], List[int]]): method which returns a list of integers corresponding to each player, each element at index i tells how many turns a player with index i has played so far. Returns: - Dict[str, Union[Tuple[int],int]]: Return a dictionary of action to take in next step. + Dict[str, Union[Tuple[int],int]]: Return a dictionary specifying what action to take in the next step. 2 possible return values {"action": "scoop", "values" : (i,j)} stating to scoop the 4 cells with index (i,j), (i+1,j), (i,j+1), (i+1,j+1) {"action": "pass", "values" : i} pass to next player with index i diff --git a/players/g1_player.py b/players/g1_player.py index ae7d787..f92bab7 100644 --- a/players/g1_player.py +++ b/players/g1_player.py @@ -32,7 +32,7 @@ def serve(self, top_layer: np.ndarray, curr_level: np.ndarray, player_idx: int, get_turns_received (Callable[[], List[int]]): method which returns a list of integers corresponding to each player, each element at index i tells how many turns a player with index i has played so far. Returns: - Dict[str, Union[Tuple[int],int]]: Return a dictionary of action to take in next step. + Dict[str, Union[Tuple[int],int]]: Return a dictionary specifying what action to take in the next step. 2 possible return values {"action": "scoop", "values" : (i,j)} stating to scoop the 4 cells with index (i,j), (i+1,j), (i,j+1), (i+1,j+1) {"action": "pass", "values" : i} pass to next player with index i diff --git a/players/g2_player.py b/players/g2_player.py index ae7d787..f92bab7 100644 --- a/players/g2_player.py +++ b/players/g2_player.py @@ -32,7 +32,7 @@ def serve(self, top_layer: np.ndarray, curr_level: np.ndarray, player_idx: int, get_turns_received (Callable[[], List[int]]): method which returns a list of integers corresponding to each player, each element at index i tells how many turns a player with index i has played so far. Returns: - Dict[str, Union[Tuple[int],int]]: Return a dictionary of action to take in next step. + Dict[str, Union[Tuple[int],int]]: Return a dictionary specifying what action to take in the next step. 2 possible return values {"action": "scoop", "values" : (i,j)} stating to scoop the 4 cells with index (i,j), (i+1,j), (i,j+1), (i+1,j+1) {"action": "pass", "values" : i} pass to next player with index i diff --git a/players/g3_player.py b/players/g3_player.py index ae7d787..f92bab7 100644 --- a/players/g3_player.py +++ b/players/g3_player.py @@ -32,7 +32,7 @@ def serve(self, top_layer: np.ndarray, curr_level: np.ndarray, player_idx: int, get_turns_received (Callable[[], List[int]]): method which returns a list of integers corresponding to each player, each element at index i tells how many turns a player with index i has played so far. Returns: - Dict[str, Union[Tuple[int],int]]: Return a dictionary of action to take in next step. + Dict[str, Union[Tuple[int],int]]: Return a dictionary specifying what action to take in the next step. 2 possible return values {"action": "scoop", "values" : (i,j)} stating to scoop the 4 cells with index (i,j), (i+1,j), (i,j+1), (i+1,j+1) {"action": "pass", "values" : i} pass to next player with index i diff --git a/players/g4_player.py b/players/g4_player.py index ae7d787..f92bab7 100644 --- a/players/g4_player.py +++ b/players/g4_player.py @@ -32,7 +32,7 @@ def serve(self, top_layer: np.ndarray, curr_level: np.ndarray, player_idx: int, get_turns_received (Callable[[], List[int]]): method which returns a list of integers corresponding to each player, each element at index i tells how many turns a player with index i has played so far. Returns: - Dict[str, Union[Tuple[int],int]]: Return a dictionary of action to take in next step. + Dict[str, Union[Tuple[int],int]]: Return a dictionary specifying what action to take in the next step. 2 possible return values {"action": "scoop", "values" : (i,j)} stating to scoop the 4 cells with index (i,j), (i+1,j), (i,j+1), (i+1,j+1) {"action": "pass", "values" : i} pass to next player with index i diff --git a/players/g5_player.py b/players/g5_player.py index ae7d787..f92bab7 100644 --- a/players/g5_player.py +++ b/players/g5_player.py @@ -32,7 +32,7 @@ def serve(self, top_layer: np.ndarray, curr_level: np.ndarray, player_idx: int, get_turns_received (Callable[[], List[int]]): method which returns a list of integers corresponding to each player, each element at index i tells how many turns a player with index i has played so far. Returns: - Dict[str, Union[Tuple[int],int]]: Return a dictionary of action to take in next step. + Dict[str, Union[Tuple[int],int]]: Return a dictionary specifying what action to take in the next step. 2 possible return values {"action": "scoop", "values" : (i,j)} stating to scoop the 4 cells with index (i,j), (i+1,j), (i,j+1), (i+1,j+1) {"action": "pass", "values" : i} pass to next player with index i diff --git a/players/g6_player.py b/players/g6_player.py index ae7d787..f92bab7 100644 --- a/players/g6_player.py +++ b/players/g6_player.py @@ -32,7 +32,7 @@ def serve(self, top_layer: np.ndarray, curr_level: np.ndarray, player_idx: int, get_turns_received (Callable[[], List[int]]): method which returns a list of integers corresponding to each player, each element at index i tells how many turns a player with index i has played so far. Returns: - Dict[str, Union[Tuple[int],int]]: Return a dictionary of action to take in next step. + Dict[str, Union[Tuple[int],int]]: Return a dictionary specifying what action to take in the next step. 2 possible return values {"action": "scoop", "values" : (i,j)} stating to scoop the 4 cells with index (i,j), (i+1,j), (i,j+1), (i+1,j+1) {"action": "pass", "values" : i} pass to next player with index i diff --git a/players/g7_player.py b/players/g7_player.py index ae7d787..f92bab7 100644 --- a/players/g7_player.py +++ b/players/g7_player.py @@ -32,7 +32,7 @@ def serve(self, top_layer: np.ndarray, curr_level: np.ndarray, player_idx: int, get_turns_received (Callable[[], List[int]]): method which returns a list of integers corresponding to each player, each element at index i tells how many turns a player with index i has played so far. Returns: - Dict[str, Union[Tuple[int],int]]: Return a dictionary of action to take in next step. + Dict[str, Union[Tuple[int],int]]: Return a dictionary specifying what action to take in the next step. 2 possible return values {"action": "scoop", "values" : (i,j)} stating to scoop the 4 cells with index (i,j), (i+1,j), (i,j+1), (i+1,j+1) {"action": "pass", "values" : i} pass to next player with index i diff --git a/players/g8_player.py b/players/g8_player.py index ae7d787..f92bab7 100644 --- a/players/g8_player.py +++ b/players/g8_player.py @@ -32,7 +32,7 @@ def serve(self, top_layer: np.ndarray, curr_level: np.ndarray, player_idx: int, get_turns_received (Callable[[], List[int]]): method which returns a list of integers corresponding to each player, each element at index i tells how many turns a player with index i has played so far. Returns: - Dict[str, Union[Tuple[int],int]]: Return a dictionary of action to take in next step. + Dict[str, Union[Tuple[int],int]]: Return a dictionary specifying what action to take in the next step. 2 possible return values {"action": "scoop", "values" : (i,j)} stating to scoop the 4 cells with index (i,j), (i+1,j), (i,j+1), (i+1,j+1) {"action": "pass", "values" : i} pass to next player with index i diff --git a/players/g9_player.py b/players/g9_player.py index ae7d787..f92bab7 100644 --- a/players/g9_player.py +++ b/players/g9_player.py @@ -32,7 +32,7 @@ def serve(self, top_layer: np.ndarray, curr_level: np.ndarray, player_idx: int, get_turns_received (Callable[[], List[int]]): method which returns a list of integers corresponding to each player, each element at index i tells how many turns a player with index i has played so far. Returns: - Dict[str, Union[Tuple[int],int]]: Return a dictionary of action to take in next step. + Dict[str, Union[Tuple[int],int]]: Return a dictionary specifying what action to take in the next step. 2 possible return values {"action": "scoop", "values" : (i,j)} stating to scoop the 4 cells with index (i,j), (i+1,j), (i,j+1), (i+1,j+1) {"action": "pass", "values" : i} pass to next player with index i diff --git a/random_player.py b/random_player.py index ae7d787..f92bab7 100644 --- a/random_player.py +++ b/random_player.py @@ -32,7 +32,7 @@ def serve(self, top_layer: np.ndarray, curr_level: np.ndarray, player_idx: int, get_turns_received (Callable[[], List[int]]): method which returns a list of integers corresponding to each player, each element at index i tells how many turns a player with index i has played so far. Returns: - Dict[str, Union[Tuple[int],int]]: Return a dictionary of action to take in next step. + Dict[str, Union[Tuple[int],int]]: Return a dictionary specifying what action to take in the next step. 2 possible return values {"action": "scoop", "values" : (i,j)} stating to scoop the 4 cells with index (i,j), (i+1,j), (i,j+1), (i+1,j+1) {"action": "pass", "values" : i} pass to next player with index i From 0600be422e09a200fc110b8347a8090ab0fee5e6 Mon Sep 17 00:00:00 2001 From: Naman Goyal Date: Thu, 7 Oct 2021 20:20:39 -0400 Subject: [PATCH 4/8] Fix comments --- players/g10_player.py | 2 +- players/g1_player.py | 2 +- players/g2_player.py | 2 +- players/g3_player.py | 2 +- players/g4_player.py | 2 +- players/g5_player.py | 2 +- players/g6_player.py | 2 +- players/g7_player.py | 2 +- players/g8_player.py | 2 +- players/g9_player.py | 2 +- random_player.py | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/players/g10_player.py b/players/g10_player.py index f92bab7..a105a9c 100644 --- a/players/g10_player.py +++ b/players/g10_player.py @@ -27,7 +27,7 @@ def serve(self, top_layer: np.ndarray, curr_level: np.ndarray, player_idx: int, curr_level (np.ndarray): Numpy 2d array of size (24, 15) containing current level at each cell location from 8 to 0, where 8 is highest level at start and 0 means no icecream left at this level player_idx (int): index of your player, 0-indexed get_flavors (Callable[[], List[int]]): method which returns a list of all possible flavors - get_player_count (Callable[[], int]): number of total players + get_player_count (Callable[[], int]): method which returns number of total players get_served (Callable[[], List[Dict[int, int]]]): method which returns a list of dictionaries corresponding to each player, each dictionary at index i tells how units of a flavor are present in the bowl of the player with index i. E.g. lets say the fourth element is {1: 0, 2: 8...} means the corresponding player with index 4 has 0 units of flavor 1 and 8 units of flavor get_turns_received (Callable[[], List[int]]): method which returns a list of integers corresponding to each player, each element at index i tells how many turns a player with index i has played so far. diff --git a/players/g1_player.py b/players/g1_player.py index f92bab7..a105a9c 100644 --- a/players/g1_player.py +++ b/players/g1_player.py @@ -27,7 +27,7 @@ def serve(self, top_layer: np.ndarray, curr_level: np.ndarray, player_idx: int, curr_level (np.ndarray): Numpy 2d array of size (24, 15) containing current level at each cell location from 8 to 0, where 8 is highest level at start and 0 means no icecream left at this level player_idx (int): index of your player, 0-indexed get_flavors (Callable[[], List[int]]): method which returns a list of all possible flavors - get_player_count (Callable[[], int]): number of total players + get_player_count (Callable[[], int]): method which returns number of total players get_served (Callable[[], List[Dict[int, int]]]): method which returns a list of dictionaries corresponding to each player, each dictionary at index i tells how units of a flavor are present in the bowl of the player with index i. E.g. lets say the fourth element is {1: 0, 2: 8...} means the corresponding player with index 4 has 0 units of flavor 1 and 8 units of flavor get_turns_received (Callable[[], List[int]]): method which returns a list of integers corresponding to each player, each element at index i tells how many turns a player with index i has played so far. diff --git a/players/g2_player.py b/players/g2_player.py index f92bab7..a105a9c 100644 --- a/players/g2_player.py +++ b/players/g2_player.py @@ -27,7 +27,7 @@ def serve(self, top_layer: np.ndarray, curr_level: np.ndarray, player_idx: int, curr_level (np.ndarray): Numpy 2d array of size (24, 15) containing current level at each cell location from 8 to 0, where 8 is highest level at start and 0 means no icecream left at this level player_idx (int): index of your player, 0-indexed get_flavors (Callable[[], List[int]]): method which returns a list of all possible flavors - get_player_count (Callable[[], int]): number of total players + get_player_count (Callable[[], int]): method which returns number of total players get_served (Callable[[], List[Dict[int, int]]]): method which returns a list of dictionaries corresponding to each player, each dictionary at index i tells how units of a flavor are present in the bowl of the player with index i. E.g. lets say the fourth element is {1: 0, 2: 8...} means the corresponding player with index 4 has 0 units of flavor 1 and 8 units of flavor get_turns_received (Callable[[], List[int]]): method which returns a list of integers corresponding to each player, each element at index i tells how many turns a player with index i has played so far. diff --git a/players/g3_player.py b/players/g3_player.py index f92bab7..a105a9c 100644 --- a/players/g3_player.py +++ b/players/g3_player.py @@ -27,7 +27,7 @@ def serve(self, top_layer: np.ndarray, curr_level: np.ndarray, player_idx: int, curr_level (np.ndarray): Numpy 2d array of size (24, 15) containing current level at each cell location from 8 to 0, where 8 is highest level at start and 0 means no icecream left at this level player_idx (int): index of your player, 0-indexed get_flavors (Callable[[], List[int]]): method which returns a list of all possible flavors - get_player_count (Callable[[], int]): number of total players + get_player_count (Callable[[], int]): method which returns number of total players get_served (Callable[[], List[Dict[int, int]]]): method which returns a list of dictionaries corresponding to each player, each dictionary at index i tells how units of a flavor are present in the bowl of the player with index i. E.g. lets say the fourth element is {1: 0, 2: 8...} means the corresponding player with index 4 has 0 units of flavor 1 and 8 units of flavor get_turns_received (Callable[[], List[int]]): method which returns a list of integers corresponding to each player, each element at index i tells how many turns a player with index i has played so far. diff --git a/players/g4_player.py b/players/g4_player.py index f92bab7..a105a9c 100644 --- a/players/g4_player.py +++ b/players/g4_player.py @@ -27,7 +27,7 @@ def serve(self, top_layer: np.ndarray, curr_level: np.ndarray, player_idx: int, curr_level (np.ndarray): Numpy 2d array of size (24, 15) containing current level at each cell location from 8 to 0, where 8 is highest level at start and 0 means no icecream left at this level player_idx (int): index of your player, 0-indexed get_flavors (Callable[[], List[int]]): method which returns a list of all possible flavors - get_player_count (Callable[[], int]): number of total players + get_player_count (Callable[[], int]): method which returns number of total players get_served (Callable[[], List[Dict[int, int]]]): method which returns a list of dictionaries corresponding to each player, each dictionary at index i tells how units of a flavor are present in the bowl of the player with index i. E.g. lets say the fourth element is {1: 0, 2: 8...} means the corresponding player with index 4 has 0 units of flavor 1 and 8 units of flavor get_turns_received (Callable[[], List[int]]): method which returns a list of integers corresponding to each player, each element at index i tells how many turns a player with index i has played so far. diff --git a/players/g5_player.py b/players/g5_player.py index f92bab7..a105a9c 100644 --- a/players/g5_player.py +++ b/players/g5_player.py @@ -27,7 +27,7 @@ def serve(self, top_layer: np.ndarray, curr_level: np.ndarray, player_idx: int, curr_level (np.ndarray): Numpy 2d array of size (24, 15) containing current level at each cell location from 8 to 0, where 8 is highest level at start and 0 means no icecream left at this level player_idx (int): index of your player, 0-indexed get_flavors (Callable[[], List[int]]): method which returns a list of all possible flavors - get_player_count (Callable[[], int]): number of total players + get_player_count (Callable[[], int]): method which returns number of total players get_served (Callable[[], List[Dict[int, int]]]): method which returns a list of dictionaries corresponding to each player, each dictionary at index i tells how units of a flavor are present in the bowl of the player with index i. E.g. lets say the fourth element is {1: 0, 2: 8...} means the corresponding player with index 4 has 0 units of flavor 1 and 8 units of flavor get_turns_received (Callable[[], List[int]]): method which returns a list of integers corresponding to each player, each element at index i tells how many turns a player with index i has played so far. diff --git a/players/g6_player.py b/players/g6_player.py index f92bab7..a105a9c 100644 --- a/players/g6_player.py +++ b/players/g6_player.py @@ -27,7 +27,7 @@ def serve(self, top_layer: np.ndarray, curr_level: np.ndarray, player_idx: int, curr_level (np.ndarray): Numpy 2d array of size (24, 15) containing current level at each cell location from 8 to 0, where 8 is highest level at start and 0 means no icecream left at this level player_idx (int): index of your player, 0-indexed get_flavors (Callable[[], List[int]]): method which returns a list of all possible flavors - get_player_count (Callable[[], int]): number of total players + get_player_count (Callable[[], int]): method which returns number of total players get_served (Callable[[], List[Dict[int, int]]]): method which returns a list of dictionaries corresponding to each player, each dictionary at index i tells how units of a flavor are present in the bowl of the player with index i. E.g. lets say the fourth element is {1: 0, 2: 8...} means the corresponding player with index 4 has 0 units of flavor 1 and 8 units of flavor get_turns_received (Callable[[], List[int]]): method which returns a list of integers corresponding to each player, each element at index i tells how many turns a player with index i has played so far. diff --git a/players/g7_player.py b/players/g7_player.py index f92bab7..a105a9c 100644 --- a/players/g7_player.py +++ b/players/g7_player.py @@ -27,7 +27,7 @@ def serve(self, top_layer: np.ndarray, curr_level: np.ndarray, player_idx: int, curr_level (np.ndarray): Numpy 2d array of size (24, 15) containing current level at each cell location from 8 to 0, where 8 is highest level at start and 0 means no icecream left at this level player_idx (int): index of your player, 0-indexed get_flavors (Callable[[], List[int]]): method which returns a list of all possible flavors - get_player_count (Callable[[], int]): number of total players + get_player_count (Callable[[], int]): method which returns number of total players get_served (Callable[[], List[Dict[int, int]]]): method which returns a list of dictionaries corresponding to each player, each dictionary at index i tells how units of a flavor are present in the bowl of the player with index i. E.g. lets say the fourth element is {1: 0, 2: 8...} means the corresponding player with index 4 has 0 units of flavor 1 and 8 units of flavor get_turns_received (Callable[[], List[int]]): method which returns a list of integers corresponding to each player, each element at index i tells how many turns a player with index i has played so far. diff --git a/players/g8_player.py b/players/g8_player.py index f92bab7..a105a9c 100644 --- a/players/g8_player.py +++ b/players/g8_player.py @@ -27,7 +27,7 @@ def serve(self, top_layer: np.ndarray, curr_level: np.ndarray, player_idx: int, curr_level (np.ndarray): Numpy 2d array of size (24, 15) containing current level at each cell location from 8 to 0, where 8 is highest level at start and 0 means no icecream left at this level player_idx (int): index of your player, 0-indexed get_flavors (Callable[[], List[int]]): method which returns a list of all possible flavors - get_player_count (Callable[[], int]): number of total players + get_player_count (Callable[[], int]): method which returns number of total players get_served (Callable[[], List[Dict[int, int]]]): method which returns a list of dictionaries corresponding to each player, each dictionary at index i tells how units of a flavor are present in the bowl of the player with index i. E.g. lets say the fourth element is {1: 0, 2: 8...} means the corresponding player with index 4 has 0 units of flavor 1 and 8 units of flavor get_turns_received (Callable[[], List[int]]): method which returns a list of integers corresponding to each player, each element at index i tells how many turns a player with index i has played so far. diff --git a/players/g9_player.py b/players/g9_player.py index f92bab7..a105a9c 100644 --- a/players/g9_player.py +++ b/players/g9_player.py @@ -27,7 +27,7 @@ def serve(self, top_layer: np.ndarray, curr_level: np.ndarray, player_idx: int, curr_level (np.ndarray): Numpy 2d array of size (24, 15) containing current level at each cell location from 8 to 0, where 8 is highest level at start and 0 means no icecream left at this level player_idx (int): index of your player, 0-indexed get_flavors (Callable[[], List[int]]): method which returns a list of all possible flavors - get_player_count (Callable[[], int]): number of total players + get_player_count (Callable[[], int]): method which returns number of total players get_served (Callable[[], List[Dict[int, int]]]): method which returns a list of dictionaries corresponding to each player, each dictionary at index i tells how units of a flavor are present in the bowl of the player with index i. E.g. lets say the fourth element is {1: 0, 2: 8...} means the corresponding player with index 4 has 0 units of flavor 1 and 8 units of flavor get_turns_received (Callable[[], List[int]]): method which returns a list of integers corresponding to each player, each element at index i tells how many turns a player with index i has played so far. diff --git a/random_player.py b/random_player.py index f92bab7..a105a9c 100644 --- a/random_player.py +++ b/random_player.py @@ -27,7 +27,7 @@ def serve(self, top_layer: np.ndarray, curr_level: np.ndarray, player_idx: int, curr_level (np.ndarray): Numpy 2d array of size (24, 15) containing current level at each cell location from 8 to 0, where 8 is highest level at start and 0 means no icecream left at this level player_idx (int): index of your player, 0-indexed get_flavors (Callable[[], List[int]]): method which returns a list of all possible flavors - get_player_count (Callable[[], int]): number of total players + get_player_count (Callable[[], int]): method which returns number of total players get_served (Callable[[], List[Dict[int, int]]]): method which returns a list of dictionaries corresponding to each player, each dictionary at index i tells how units of a flavor are present in the bowl of the player with index i. E.g. lets say the fourth element is {1: 0, 2: 8...} means the corresponding player with index 4 has 0 units of flavor 1 and 8 units of flavor get_turns_received (Callable[[], List[int]]): method which returns a list of integers corresponding to each player, each element at index i tells how many turns a player with index i has played so far. From fa3d528c1647a7275dc0dc811901464eeb9f25ed Mon Sep 17 00:00:00 2001 From: Naman Goyal Date: Thu, 7 Oct 2021 20:27:29 -0400 Subject: [PATCH 5/8] Move random_player to players --- main.py | 2 +- random_player.py => players/random_player.py | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename random_player.py => players/random_player.py (100%) diff --git a/main.py b/main.py index 0aaf4d4..904e686 100644 --- a/main.py +++ b/main.py @@ -8,7 +8,7 @@ import json import logging import argparse -from random_player import Player as Random_Player +from players.random_player import Player as Random_Player from players.g1_player import Player as G1_Player from players.g2_player import Player as G2_Player from players.g3_player import Player as G3_Player diff --git a/random_player.py b/players/random_player.py similarity index 100% rename from random_player.py rename to players/random_player.py From a107a9670a3d674ad92ddcc798659f373cc0c577 Mon Sep 17 00:00:00 2001 From: Naman Goyal <22537996+thenamangoyal@users.noreply.github.com> Date: Fri, 8 Oct 2021 06:05:19 +0530 Subject: [PATCH 6/8] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 3b86fd4..ad588eb 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ +[Documentation](https://docs.google.com/document/d/1wCQZNEupmkwjPrOVFU3S3sMxz16ph3gBDZg0aunx46Q/edit?usp=sharing) + ## Installation Requires **python3.6** From dc5a18ef0882f77c771ff8593b9f83d6a71e3c49 Mon Sep 17 00:00:00 2001 From: Naman Goyal Date: Thu, 7 Oct 2021 21:33:55 -0400 Subject: [PATCH 7/8] Add option to play automatically --- main.py | 15 ++++++++++++--- res/style.css | 37 +++++++++++++++++++++++++++++-------- 2 files changed, 41 insertions(+), 11 deletions(-) diff --git a/main.py b/main.py index 904e686..4f1b79c 100644 --- a/main.py +++ b/main.py @@ -71,7 +71,7 @@ def __init__(self, args): self.served_this_turn = None if self.use_gui: - start(IceCreamApp, address=args.address, port=args.port, start_browser=not(args.no_browser), userdata=(self, None)) + start(IceCreamApp, address=args.address, port=args.port, start_browser=not(args.no_browser), update_interval=0.5, userdata=(self, None)) else: self.logger.debug("No GUI flag specified") self.play_all() @@ -282,11 +282,15 @@ def main(self, *userdata): mainContainer.style['justify-content'] = 'center' mainContainer.style['align-items'] = 'center' - bt_hbox = gui.HBox(width="30%", style={'text-align': 'center', 'margin': 'auto'}) + bt_hbox = gui.HBox(width="40%", style={'text-align': 'center', 'margin': 'auto'}) play_step_bt = gui.Button("Play Step") play_turn_bt = gui.Button("Play Turn") play_all_bt = gui.Button("Play All") - bt_hbox.append([play_step_bt, play_turn_bt, play_all_bt]) + + self.automatic_play = gui.CheckBoxLabel("Play Automatically") + self.automatic_play.attributes["class"] = "checkbox" + + bt_hbox.append([play_step_bt, play_turn_bt, play_all_bt, self.automatic_play]) play_step_bt.onclick.do(self.play_step_bt_press) play_turn_bt.onclick.do(self.play_turn_bt_press) @@ -325,6 +329,11 @@ def main(self, *userdata): return mainContainer + def idle(self): + if self.automatic_play.get_value(): + self.ice_cream_game.play(run_stepwise=True) + + def update_score_table(self): for player_idx, score in enumerate(self.ice_cream_game.player_scores): self.score_table.item_at(0, player_idx).set_text("{}".format(self.ice_cream_game.player_names[player_idx])) diff --git a/res/style.css b/res/style.css index c20d1e2..4544a86 100644 --- a/res/style.css +++ b/res/style.css @@ -1,15 +1,15 @@ .hoverable:hover { opacity: 1; background: rgba(0, 0, 0, 0.5); - -webkit-box-shadow:inset 0px 0px 0px 4px rgba(0,0,0,0.25); - -moz-box-shadow:inset 0px 0px 0px 4px rgba(0,0,0,0.25); - box-shadow:inset 0px 0px 0px 4px rgba(0,0,0,0.25) + -webkit-box-shadow: inset 0px 0px 0px 4px rgba(0, 0, 0, 0.25); + -moz-box-shadow: inset 0px 0px 0px 4px rgba(0, 0, 0, 0.25); + box-shadow: inset 0px 0px 0px 4px rgba(0, 0, 0, 0.25) } .hoverable { margin: 0 auto; line-height: 46px; - height:100%; + height: 100%; width: 100%; color: #ffffff; opacity: 0; @@ -22,7 +22,7 @@ button { display: inline; font-weight: 500; letter-spacing: 0; - padding:10px; + padding: 10px; overflow: hidden; overflow-x: hidden; overflow-y: hidden; @@ -34,11 +34,13 @@ button { vertical-align: middle; background: rgb(80, 80, 80); color: rgb(255, 255, 255); - box-shadow: 3px 3px 5px rgb(150,150,150); + box-shadow: 3px 3px 5px rgb(150, 150, 150); } + button:hover { - background: rgb(20,20,20); + background: rgb(20, 20, 20); } + button:disabled { background-color: #ddd; background: #ddd; @@ -47,6 +49,25 @@ button:disabled { cursor: default; color: #9F9F9F; } -button:active{ + +button:active { box-shadow: 0 4px 5px 0 rgba(0, 0, 0, .2), 0 1px 1px 0 rgba(0, 0, 0, .12), 0 2px 0px -1px rgba(0, 0, 0, .2); +} + +.checkbox p { + font-weight: 500; + margin-left: 5px; +} + +.checkbox input[type='checkbox'] { + margin-left: 20px; + width: 20px; + height: 20px; + background: #ccc; + border-radius: 5px; + border: 2px solid #555; +} + +.checkbox input[type='checkbox']:checked { + background: #2196F3; } \ No newline at end of file From 42224c496d26720da7a49d6490e5d317f8eb85eb Mon Sep 17 00:00:00 2001 From: Naman Goyal Date: Sat, 9 Oct 2021 00:10:48 -0400 Subject: [PATCH 8/8] Fix wrong comment on flavor preference order --- players/g10_player.py | 2 +- players/g1_player.py | 2 +- players/g2_player.py | 2 +- players/g3_player.py | 2 +- players/g4_player.py | 2 +- players/g5_player.py | 2 +- players/g6_player.py | 2 +- players/g7_player.py | 2 +- players/g8_player.py | 2 +- players/g9_player.py | 2 +- players/random_player.py | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/players/g10_player.py b/players/g10_player.py index a105a9c..d010269 100644 --- a/players/g10_player.py +++ b/players/g10_player.py @@ -10,7 +10,7 @@ def __init__(self, flavor_preference: List[int], rng: np.random.Generator, logge """Initialise the player with given preference. Args: - flavor_preference (List[int]): flavor preference, least flavored flavor is first element in the list and most flavored is most preferred + flavor_preference (List[int]): flavor preference, most flavored flavor is first element in the list and last element is least preferred flavor rng (np.random.Generator): numpy random number generator, use this for same player behvior across run logger (logging.Logger): logger use this like logger.info("message") """ diff --git a/players/g1_player.py b/players/g1_player.py index a105a9c..d010269 100644 --- a/players/g1_player.py +++ b/players/g1_player.py @@ -10,7 +10,7 @@ def __init__(self, flavor_preference: List[int], rng: np.random.Generator, logge """Initialise the player with given preference. Args: - flavor_preference (List[int]): flavor preference, least flavored flavor is first element in the list and most flavored is most preferred + flavor_preference (List[int]): flavor preference, most flavored flavor is first element in the list and last element is least preferred flavor rng (np.random.Generator): numpy random number generator, use this for same player behvior across run logger (logging.Logger): logger use this like logger.info("message") """ diff --git a/players/g2_player.py b/players/g2_player.py index a105a9c..d010269 100644 --- a/players/g2_player.py +++ b/players/g2_player.py @@ -10,7 +10,7 @@ def __init__(self, flavor_preference: List[int], rng: np.random.Generator, logge """Initialise the player with given preference. Args: - flavor_preference (List[int]): flavor preference, least flavored flavor is first element in the list and most flavored is most preferred + flavor_preference (List[int]): flavor preference, most flavored flavor is first element in the list and last element is least preferred flavor rng (np.random.Generator): numpy random number generator, use this for same player behvior across run logger (logging.Logger): logger use this like logger.info("message") """ diff --git a/players/g3_player.py b/players/g3_player.py index a105a9c..d010269 100644 --- a/players/g3_player.py +++ b/players/g3_player.py @@ -10,7 +10,7 @@ def __init__(self, flavor_preference: List[int], rng: np.random.Generator, logge """Initialise the player with given preference. Args: - flavor_preference (List[int]): flavor preference, least flavored flavor is first element in the list and most flavored is most preferred + flavor_preference (List[int]): flavor preference, most flavored flavor is first element in the list and last element is least preferred flavor rng (np.random.Generator): numpy random number generator, use this for same player behvior across run logger (logging.Logger): logger use this like logger.info("message") """ diff --git a/players/g4_player.py b/players/g4_player.py index a105a9c..d010269 100644 --- a/players/g4_player.py +++ b/players/g4_player.py @@ -10,7 +10,7 @@ def __init__(self, flavor_preference: List[int], rng: np.random.Generator, logge """Initialise the player with given preference. Args: - flavor_preference (List[int]): flavor preference, least flavored flavor is first element in the list and most flavored is most preferred + flavor_preference (List[int]): flavor preference, most flavored flavor is first element in the list and last element is least preferred flavor rng (np.random.Generator): numpy random number generator, use this for same player behvior across run logger (logging.Logger): logger use this like logger.info("message") """ diff --git a/players/g5_player.py b/players/g5_player.py index a105a9c..d010269 100644 --- a/players/g5_player.py +++ b/players/g5_player.py @@ -10,7 +10,7 @@ def __init__(self, flavor_preference: List[int], rng: np.random.Generator, logge """Initialise the player with given preference. Args: - flavor_preference (List[int]): flavor preference, least flavored flavor is first element in the list and most flavored is most preferred + flavor_preference (List[int]): flavor preference, most flavored flavor is first element in the list and last element is least preferred flavor rng (np.random.Generator): numpy random number generator, use this for same player behvior across run logger (logging.Logger): logger use this like logger.info("message") """ diff --git a/players/g6_player.py b/players/g6_player.py index a105a9c..d010269 100644 --- a/players/g6_player.py +++ b/players/g6_player.py @@ -10,7 +10,7 @@ def __init__(self, flavor_preference: List[int], rng: np.random.Generator, logge """Initialise the player with given preference. Args: - flavor_preference (List[int]): flavor preference, least flavored flavor is first element in the list and most flavored is most preferred + flavor_preference (List[int]): flavor preference, most flavored flavor is first element in the list and last element is least preferred flavor rng (np.random.Generator): numpy random number generator, use this for same player behvior across run logger (logging.Logger): logger use this like logger.info("message") """ diff --git a/players/g7_player.py b/players/g7_player.py index a105a9c..d010269 100644 --- a/players/g7_player.py +++ b/players/g7_player.py @@ -10,7 +10,7 @@ def __init__(self, flavor_preference: List[int], rng: np.random.Generator, logge """Initialise the player with given preference. Args: - flavor_preference (List[int]): flavor preference, least flavored flavor is first element in the list and most flavored is most preferred + flavor_preference (List[int]): flavor preference, most flavored flavor is first element in the list and last element is least preferred flavor rng (np.random.Generator): numpy random number generator, use this for same player behvior across run logger (logging.Logger): logger use this like logger.info("message") """ diff --git a/players/g8_player.py b/players/g8_player.py index a105a9c..d010269 100644 --- a/players/g8_player.py +++ b/players/g8_player.py @@ -10,7 +10,7 @@ def __init__(self, flavor_preference: List[int], rng: np.random.Generator, logge """Initialise the player with given preference. Args: - flavor_preference (List[int]): flavor preference, least flavored flavor is first element in the list and most flavored is most preferred + flavor_preference (List[int]): flavor preference, most flavored flavor is first element in the list and last element is least preferred flavor rng (np.random.Generator): numpy random number generator, use this for same player behvior across run logger (logging.Logger): logger use this like logger.info("message") """ diff --git a/players/g9_player.py b/players/g9_player.py index a105a9c..d010269 100644 --- a/players/g9_player.py +++ b/players/g9_player.py @@ -10,7 +10,7 @@ def __init__(self, flavor_preference: List[int], rng: np.random.Generator, logge """Initialise the player with given preference. Args: - flavor_preference (List[int]): flavor preference, least flavored flavor is first element in the list and most flavored is most preferred + flavor_preference (List[int]): flavor preference, most flavored flavor is first element in the list and last element is least preferred flavor rng (np.random.Generator): numpy random number generator, use this for same player behvior across run logger (logging.Logger): logger use this like logger.info("message") """ diff --git a/players/random_player.py b/players/random_player.py index a105a9c..d010269 100644 --- a/players/random_player.py +++ b/players/random_player.py @@ -10,7 +10,7 @@ def __init__(self, flavor_preference: List[int], rng: np.random.Generator, logge """Initialise the player with given preference. Args: - flavor_preference (List[int]): flavor preference, least flavored flavor is first element in the list and most flavored is most preferred + flavor_preference (List[int]): flavor preference, most flavored flavor is first element in the list and last element is least preferred flavor rng (np.random.Generator): numpy random number generator, use this for same player behvior across run logger (logging.Logger): logger use this like logger.info("message") """