diff --git a/cooperative_cuisine/counters.py b/cooperative_cuisine/counters.py index 991074a33ca8b97c432d6be23cfcbb0db48b1644..7220f1baf70511db15fb80bd46d0a2185da1acf6 100644 --- a/cooperative_cuisine/counters.py +++ b/cooperative_cuisine/counters.py @@ -157,7 +157,8 @@ class Counter: on_hands: Will the item be put on empty hands or on a cooking equipment. player: The player name that tries to pick up from the counter. - Returns: The item which the counter is occupied by. None if nothing is there. + Returns: + The item which the counter is occupied by. None if nothing is there. """ self.hook(PRE_COUNTER_PICK_UP, counter=self, on_hands=on_hands, player=player) if on_hands: @@ -202,8 +203,8 @@ class Counter: item: The item for which to check, if it can be placed on the counter. - Returns: True if the item can be placed on the counter, False if not. - + Returns: + True if the item can be placed on the counter, False if not. """ return self.occupied_by is None or self.occupied_by.can_combine(item) diff --git a/cooperative_cuisine/environment.py b/cooperative_cuisine/environment.py index 57c957ae8b154a59594c3b06a43b1a89e3670988..04e1409c5abf7bac64052339019d1955f6ec253e 100644 --- a/cooperative_cuisine/environment.py +++ b/cooperative_cuisine/environment.py @@ -107,7 +107,7 @@ class Environment: layout_config: Path | str, item_info: Path | str, as_files: bool = True, - env_name: str = "overcooked_sim", + env_name: str = "cooperative_cuisine_1", seed: int = 56789223842348, ): """Constructor of the Environment. @@ -471,8 +471,8 @@ class Environment: player_id: The player for which to get the state. additional_key_values: Additional dict that is added to the state - Returns: The state of the game as a dict. - + Returns: + The state of the game as a dict. """ if player_id in self.players: self.hook(PRE_STATE, player_id=player_id) @@ -524,7 +524,8 @@ class Environment: player_id: The player for which to get the state. additional_key_values: Additional dict that is added to the state - Returns: The state of the game formatted as a json-string + Returns: + The state of the game formatted as a json-string """ state = self.get_state(player_id, additional_key_values) diff --git a/cooperative_cuisine/game_server.py b/cooperative_cuisine/game_server.py index 093f30761eff6754c549a311af809e9dbc56f1a2..f9b2fbdb8b76163bbdf0c02d46dc2972a012e5a1 100644 --- a/cooperative_cuisine/game_server.py +++ b/cooperative_cuisine/game_server.py @@ -280,9 +280,9 @@ class EnvironmentHandler: Args: player_hash (str): The unique identifier of the player. - Returns: str: The state representation of the environment for a player. Is + Returns: + str: The state representation of the environment for a player. Is `cooperative_cuisine.state_representation.StateRepresentation` as a json. - """ if ( player_hash in self.player_data diff --git a/cooperative_cuisine/pygame_2d_vis/__init__.py b/cooperative_cuisine/pygame_2d_vis/__init__.py index a90ff6d13ec4e4d4db946e9733135caf52a77f9a..c6af81b3aade3d2245e5e9e7da26abc028f5eeb2 100644 --- a/cooperative_cuisine/pygame_2d_vis/__init__.py +++ b/cooperative_cuisine/pygame_2d_vis/__init__.py @@ -1,7 +1,7 @@ """ 2D visualization of the CooperativeCuisine. -You can select the layout and start an environment: +You will play the levels accordingly to the study config: - You can play the CooperativeCuisine. You can quit the application in the top right or end the level in the bottom right - The orders are pictured in the top, the current score in the bottom left and the remaining time in the bottom - The final screen after ending a level shows the score diff --git a/cooperative_cuisine/study_server.py b/cooperative_cuisine/study_server.py index 2f794f0e94dc0e03476aff7fd1e5ef158a8e7bdb..fe69626bb9831a82314049d2265f230d690c77b6 100644 --- a/cooperative_cuisine/study_server.py +++ b/cooperative_cuisine/study_server.py @@ -150,7 +150,8 @@ class Study: Args: num_participants: Number of participants wished to be added. - Returns: True of the participants fit in this study, False if not. + Returns: + True of the participants fit in this study, False if not. """ filled = ( self.num_connected_players + num_participants @@ -165,8 +166,11 @@ class Study: Args: level: LevelConfig which contains the paths to the env config, layout and item info files. - Returns: EnvironmentData which contains information about the newly created environment. - Raises: ValueError if the gameserver returned a conflict, HTTPError with 500 if the game server crashes. + Returns: + EnvironmentData which contains information about the newly created environment. + + Raises: + ValueError if the gameserver returned a conflict, HTTPError with 500 if the game server crashes. """ item_info_path = expand_path(level["item_info_path"]) @@ -279,9 +283,12 @@ class Study: Args: participant_id: The participant id which requests the connections. - Returns: The player info for the game server connections, level name and - information if the level is the last one and which recipes are possible in the level. - Raises: HTTPException(409) if the player is not found in the dictionary keys which saves the connections. + Returns: + The player info for the game server connections, level name and information if the level is the last + one and which recipes are possible in the level. + + Raises: + HTTPException(409) if the player is not found in the dictionary keys which saves the connections. """ if participant_id in self.participant_id_to_player_info.keys(): player_info = self.participant_id_to_player_info[participant_id] @@ -446,9 +453,12 @@ class StudyManager: Args: participant_id: ID of the participant. - Returns: The player info for the game server connections, level name and - information if the level is the last one and which recipes are possible in the level. - Raises: HTTPException(409) if the player not registered in any study. + Returns: + The player info for the game server connections, level name and information if the level is the last one and + which recipes are possible in the level. + + Raises: + HTTPException(409) if the player not registered in any study. """ if participant_id in self.running_tutorials.keys(): tutorial_env = self.running_tutorials[participant_id] @@ -596,7 +606,8 @@ async def get_game_connection( Args: participant_id: ID of the requesting participant. - Returns: A dict containing the game server connection information and information about the current level. + Returns: + A dict containing the game server connection information and information about the current level. """ player_info, level_info = study_manager.get_participant_game_connection( diff --git a/cooperative_cuisine/utils.py b/cooperative_cuisine/utils.py index fd1effc447897b7b5475e546f30e899b277e5022..102c340a182bf99e1a32ba257f8a215e15d3be97 100644 --- a/cooperative_cuisine/utils.py +++ b/cooperative_cuisine/utils.py @@ -170,7 +170,8 @@ def get_closest(point: npt.NDArray[float], counters: list[Counter]): point: The point in the env for which to find the closest counter counters: List of objects with a `pos` attribute to compare to. - Returns: The closest counter for the given point. + Returns: + The closest counter for the given point. """ return counters[