Skip to content

Commit

Permalink
feat: Add into the deep highscore submissions
Browse files Browse the repository at this point in the history
  • Loading branch information
NicholasBottone committed Sep 27, 2024
1 parent 80a217e commit 8a2ea21
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions highscores/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ def submit_ultimate_goal(score_obj: Score) -> Union[str, None]:
return submit_score(score_obj, ultimate_goal_clean_code_check)


def submit_into_the_deep(score_obj: Score) -> Union[str, None]:
return submit_score(score_obj, into_the_deep_clean_code_check)


def decode_time_data(in_string: str) -> str:
out_bytes = ""

Expand Down Expand Up @@ -292,6 +296,10 @@ def ultimate_goal_clean_code_check(score_obj: Score) -> Union[str, None]:
return clean_code_check(score_obj, check_ultimate_goal_game_settings, check_score)


def into_the_deep_clean_code_check(score_obj: Score) -> Union[str, None]:
return clean_code_check(score_obj, check_into_the_deep_game_settings, check_subtraction_score)


def extract_clean_code_info(score_obj: Score) -> tuple[str, list[str], str, str, str, str, str]:
""" Extracts the relevant information from the clean code.
:param score_obj: Score object to extract from
Expand Down Expand Up @@ -508,6 +516,16 @@ def check_ultimate_goal_game_settings(game_options: list, restart_option: str, g
return None # No error


def check_into_the_deep_game_settings(game_options: list, restart_option: str, game_index: str) -> Union[str, None]:
""" Checks if the Into The Deep game settings are valid.
:return: None if the settings are valid, or a response with an error message if they are not.
"""
if (game_index != '18'):
return 'Wrong game! This form is for Into The Deep.'

return None # No error


def check_robot_type(score_obj: Score, robot_model: str) -> Union[str, None]:
""" Checks if the robot model is valid.
:return: None if the robot model is valid, or a response with an error message if it is not.
Expand Down Expand Up @@ -675,6 +693,7 @@ def check_time_data(score_obj: Score) -> Union[str, None]:
"cr": submit_crescendo,
"hs": submit_high_stakes,
"ug": submit_ultimate_goal,
"id": submit_into_the_deep,
}

game_to_submit_func = {
Expand All @@ -690,4 +709,5 @@ def check_time_data(score_obj: Score) -> Union[str, None]:
"Crescendo": submit_crescendo,
"High Stakes": submit_high_stakes,
"Ultimate Goal": submit_ultimate_goal,
"INTO THE DEEP": submit_into_the_deep,
}

0 comments on commit 8a2ea21

Please sign in to comment.