added german documentation to seeding and double elimination api/ gamestate

This commit is contained in:
Joel Klimont 2022-11-09 03:25:27 +01:00
parent de9b671f29
commit 369692b619
8 changed files with 107 additions and 24 deletions

View file

@ -29,7 +29,12 @@ API_URL_GET_SCORES = API_URL + "getScores"
class Position:
"""Datastructure for holding a position
"""
Datenstruktur, welche eine Position representiert.
:ivar x: X Position in Centimeter
:ivar y: Y Position in Centimeter
:ivar degrees: Rotation in Grad von -180 bis 180
"""
def __init__(self, x, y, degrees):
@ -57,13 +62,14 @@ class Position:
class DoubleElim:
"""Class used for communicating with double elimination api
"""Klasse für die Kommunikation mit Double Elimination Api
"""
@staticmethod
def get_pos() -> Tuple[Position, int]:
"""Makes the /api/getPos call to the api.
:return: A Position object with robot position
"""Führt den /api/getPos Aufruf an die API aus.
:return: Ein Objekt der Klasse :class:`.Position` mit der Position des Roboters und der Status Code
:rtype: Tuple[Position, int]
"""
res = requests.get(API_URL_GET_POS)
@ -80,8 +86,9 @@ class DoubleElim:
@staticmethod
def get_opponent() -> Tuple[Position, int]:
"""Makes the /api/getOp call to the api.
:return: A Position object with opponents robot position
"""Führt den /api/getOp Aufruf an die API aus.
:return: Ein Objekt der Klasse :class:`.Position` mit der Position des gegnerischen Roboters relativ zum eigenen Roboter und der Status Code
:rtype: Tuple[Position, int]
"""
res = requests.get(API_URL_GET_OP)
@ -98,8 +105,9 @@ class DoubleElim:
@staticmethod
def get_goal() -> Tuple[Position, int]:
"""Makes the /api/getGoal call to the api.
:return: A Position object with x and y coordinates of the goal, rotation is always -1
"""Führt den /api/getGoal Aufruf an die API aus.
:return: Ein Objekt der Klasse :class:`.Position` mit der Position des Ziels relativ zum eigenen Roboter und der Status Code
:rtype: Tuple[Position, int]
"""
res = requests.get(API_URL_GET_GOAL)
@ -116,8 +124,9 @@ class DoubleElim:
@staticmethod
def get_items() -> Tuple[List[Dict], int]:
"""Makes the /api/getItems call to the api.
:return: A list will all items currently on the game field. Items are dictionaries that look like: {"id": 0, "x": 0, "y": 0}
"""Führt den /api/getItems Aufruf an die API aus.
:return: Eine Liste aller Items, die sich derzeit auf dem Spielfeld befinden. Items sind "dictionaries", die wie folgt aussehen: {"id": 0, "x": 0, "y": 0}
:rtype: Tuple[List[Dict], int]
"""
res = requests.get(API_URL_GET_ITEMS)
@ -134,8 +143,9 @@ class DoubleElim:
@staticmethod
def get_scores() -> Tuple[Dict, int]:
"""Makes the /api/getScores call to the api.
:return: A dictionary with all scores included like: {"self":2,"opponent":0}
"""Führt den /api/getScores Aufruf an die API aus.
:return: Ein "dictionary" mit dem eignen Score und dem des Gegners: {"self":2,"opponent":0}
:rtype: Tuple[Dict, int]
"""
res = requests.get(API_URL_GET_SCORES)