Skip to content

Commit

Permalink
Merge pull request #357 from asdawej/dev-docs
Browse files Browse the repository at this point in the history
Add docs for PyAPI
  • Loading branch information
DragonAura authored May 11, 2024
2 parents 7b38277 + 6d944fa commit 1f5815a
Show file tree
Hide file tree
Showing 5 changed files with 256 additions and 34 deletions.
14 changes: 7 additions & 7 deletions CAPI/python/PyAPI/API.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ def __init__(self, logic: ILogic) -> None:
self.__logic = logic
self.__pool = ThreadPoolExecutor(20)

def Move(self, timeInMilliseconds: int, angle: float) -> Future[bool]:
return self.__pool.submit(self.__logic.Move, timeInMilliseconds, angle)
def Move(self, timeInMilliseconds: int, angleInRadian: float) -> Future[bool]:
return self.__pool.submit(self.__logic.Move, timeInMilliseconds, angleInRadian)

def MoveRight(self, timeInMilliseconds: int) -> Future[bool]:
return self.Move(timeInMilliseconds, pi * 0.5)
Expand All @@ -25,8 +25,8 @@ def MoveUp(self, timeInMilliseconds: int) -> Future[bool]:
def MoveDown(self, timeInMilliseconds: int) -> Future[bool]:
return self.Move(timeInMilliseconds, 0)

def Attack(self, angle: float) -> Future[bool]:
return self.__pool.submit(self.__logic.Attack, angle)
def Attack(self, angleInRadian: float) -> Future[bool]:
return self.__pool.submit(self.__logic.Attack, angleInRadian)

def Recover(self, recover: int) -> Future[bool]:
return self.__pool.submit(self.__logic.Recover, recover)
Expand Down Expand Up @@ -76,7 +76,7 @@ def GetFullMap(self) -> List[List[THUAI7.PlaceType]]:
def GetPlaceType(self, cellX: int, cellY: int) -> THUAI7.PlaceType:
return self.__logic.GetPlaceType(cellX, cellY)

def GetConstructionState(self, cellX: int, cellY: int) -> tuple:
def GetConstructionState(self, cellX: int, cellY: int) -> Tuple[int, int]:
return self.__logic.GetConstructionState(cellX, cellY)

def GetWormholeHp(self, cellX: int, cellY: int) -> int:
Expand Down Expand Up @@ -112,7 +112,7 @@ def HaveView(self, gridX: int, gridY: int) -> bool:
self.GetSelfInfo().viewRange,
)

def Print(self, cont: str) -> None:
def Print(self, string: str) -> None:
pass

def PrintShip(self) -> None:
Expand Down Expand Up @@ -184,7 +184,7 @@ def GetFullMap(self) -> List[List[THUAI7.PlaceType]]:
def GetPlaceType(self, cellX: int, cellY: int) -> THUAI7.PlaceType:
return self.__logic.GetPlaceType(cellX, cellY)

def GetConstructionState(self, cellX: int, cellY: int) -> tuple:
def GetConstructionState(self, cellX: int, cellY: int) -> Tuple[int, int]:
return self.__logic.GetConstructionState(cellX, cellY)

def GetWormholeHp(self, cellX: int, cellY: int) -> int:
Expand Down
8 changes: 4 additions & 4 deletions CAPI/python/PyAPI/DebugAPI.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def GetFullMap(self) -> List[List[THUAI7.PlaceType]]:
def GetPlaceType(self, cellX: int, cellY: int) -> THUAI7.PlaceType:
return self.__logic.GetPlaceType(cellX, cellY)

def GetConstructionState(self, cellX: int, cellY: int) -> tuple:
def GetConstructionState(self, cellX: int, cellY: int) -> Tuple[int, int]:
return self.__logic.GetConstructionState(cellX, cellY)

def GetWormholeHp(self, cellX: int, cellY: int) -> int:
Expand Down Expand Up @@ -235,8 +235,8 @@ def HaveView(self, gridX: int, gridY: int) -> bool:
self.GetSelfInfo().viewRange,
)

def Print(self, cont: str) -> None:
self.__logger.info(cont)
def Print(self, string: str) -> None:
self.__logger.info(string)

def PrintShip(self) -> None:
for ship in self.__logic.GetShips():
Expand Down Expand Up @@ -440,7 +440,7 @@ def GetFullMap(self) -> List[List[THUAI7.PlaceType]]:
def GetPlaceType(self, cellX: int, cellY: int) -> THUAI7.PlaceType:
return self.__logic.GetPlaceType(cellX, cellY)

def GetConstructionState(self, cellX: int, cellY: int) -> tuple:
def GetConstructionState(self, cellX: int, cellY: int) -> Tuple[int, int]:
return self.__logic.GetConstructionState(cellX, cellY)

def GetWormholeHp(self, cellX: int, cellY: int) -> int:
Expand Down
Loading

0 comments on commit 1f5815a

Please sign in to comment.