|
Zappy - Year end project 2
This is a project that Epitech asked us to create in order to allow us to reveiw the notions of the current year.
|

Public Member Functions | |
| None | __init__ (self, GlobalVariables global_variables) |
| int | dispatcher (self, dict[Commands, any] response) |
Protected Member Functions | |
| int | _create_random_seed (self) |
| None | _forward (self) |
| None | _left (self) |
| None | _right (self) |
| int | _my_randint (self, int minimum=0, int maximum=3) |
| None | _change_my_mind (self) |
| None | _update_ai_status (self, int status) |
| int | _process_welcome (self, str data) |
| int | _process_client_number (self, str data) |
| int | _process_map_dimensions (self, str data) |
| bool | _can_evolve (self, str command) |
| int | _exit_error (self, str string) |
| None | _append_look_command (self) |
| str | _to_human_readable (self, int code) |
| int | _calculate_next_move (self, dict[Commands, any] response) |
Protected Attributes | |
| _forward | |
| _left | |
_summary_
This is the class in charge of containing the ai which provides a purpose for this program
Args:
Thread (_type_): _description_: The class that is to be used in order to start threads
Definition at line 16 of file logistics.py.
| None logistics.Logistics.__init__ | ( | self, | |
| GlobalVariables | global_variables ) |
Definition at line 24 of file logistics.py.
|
protected |
_summary_
This function appends the look command to the response buffer.
Definition at line 259 of file logistics.py.
|
protected |
_summary_
This function will calculate the next move based on the response from the server.
Args:
response (dict[Commands, any]): _description_: The query that came in from the tcp protocol.
Returns:
int: _description_: The status of the execution.
Definition at line 285 of file logistics.py.
|
protected |
_summary_
This function checks if the ai can evolve.
Args:
command (str | list): _description_: The content of the Look response
Returns:
bool: _description_: Returns True if the ai can get to the next level, otherwise False is returned.
Definition at line 214 of file logistics.py.
|
protected |
_summary_ This function is the one in charge of creating a random movement
Definition at line 110 of file logistics.py.
|
protected |
_summary_
Generate a random seed
Returns:
int: _description_
Definition at line 44 of file logistics.py.
|
protected |
_summary_
This function should never be triggered in a normal use case.
This function will send an error message and set the global status to self.global_variable.error
Returns:
int: _description_: The error status defined in global_variables
Definition at line 246 of file logistics.py.
|
protected |
_summary_
Add the forward command
Definition at line 55 of file logistics.py.
|
protected |
_summary_
Add the left command
Definition at line 68 of file logistics.py.
|
protected |
_summary_
This is a function that will be used in order to provide a randome number without using the random library.
Definition at line 94 of file logistics.py.
|
protected |
_summary_
This function will check if we have received the client number
Args:
data (str): _description_: The incoming data
Returns:
int: _description_: The status of the processed data
Definition at line 158 of file logistics.py.
|
protected |
_summary_
This is a function that will make sure that the dimensions of the map.
Args:
data (str): _description_
Returns:
int: _description_
Definition at line 180 of file logistics.py.
|
protected |
_summary_
This function will set the variables corresponding to the initialisation process
Returns:
int: _description_: The processing status
Definition at line 135 of file logistics.py.
|
protected |
_summary_
Add the right command
Definition at line 81 of file logistics.py.
|
protected |
_summary_
Replace the code with the corresponding state.
Args:
code (int): _description_: The corresponding code
Returns:
str: _description_: The corresponding text that the human can understand
Definition at line 272 of file logistics.py.
|
protected |
_summary_
This function works like a onetime valve, if one error ever gets raised, the variable will never go back to 0.
Args:
status (int): _description_: the run status of the previous function
Definition at line 121 of file logistics.py.
| int logistics.Logistics.dispatcher | ( | self, | |
| dict[Commands, any] | response ) |
_summary_
Args:
response (str): _description_: The converted response
Returns:
int: _description_: The status response of the program
Definition at line 343 of file logistics.py.
|
protected |
Definition at line 39 of file logistics.py.
|
protected |
Definition at line 40 of file logistics.py.
| logistics.Logistics.client_coordinates |
Definition at line 28 of file logistics.py.
| logistics.Logistics.client_number |
Definition at line 27 of file logistics.py.
| logistics.Logistics.client_number_received |
Definition at line 177 of file logistics.py.
| logistics.Logistics.direction_options |
Definition at line 38 of file logistics.py.
| logistics.Logistics.direction_options_list |
Definition at line 37 of file logistics.py.
| logistics.Logistics.global_variables |
Definition at line 25 of file logistics.py.
| logistics.Logistics.initialisation_complete |
Definition at line 31 of file logistics.py.
| logistics.Logistics.nb_responses |
Definition at line 33 of file logistics.py.
| logistics.Logistics.random_seed |
Definition at line 35 of file logistics.py.
| logistics.Logistics.sabotage |
Definition at line 36 of file logistics.py.
| logistics.Logistics.tile_content |
Definition at line 34 of file logistics.py.
| logistics.Logistics.welcome_received |
Definition at line 29 of file logistics.py.