Skip to content

Commit

Permalink
Fix Python CAPI Bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
GuoWQ222 committed Mar 4, 2024
2 parents ce9aaff + 7db5121 commit 023a140
Show file tree
Hide file tree
Showing 950 changed files with 38,920 additions and 2,108 deletions.
42 changes: 23 additions & 19 deletions CAPI/python/PyAPI/AI.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,41 +6,45 @@

import time


class Setting:
# 为假则play()期间确保游戏状态不更新,为真则只保证游戏状态在调用相关方法时不更新,大致一帧更新一次
@staticmethod
def asynchronous() -> bool:
return False



numOfGridPerCell: Final[int] = 1000


class AssistFunction:
@staticmethod
def CellToGrid(cell: int) -> int:
return cell*numOfGridPerCell+numOfGridPerCell//2
return cell * numOfGridPerCell + numOfGridPerCell // 2

@staticmethod
def GridToCell(grid: int) -> int:
return grid//numOfGridPerCell

return grid // numOfGridPerCell


class AI(IAI):
def __init__(self,pID:int):
self.__playerID=pID
def __init__(self, pID: int):
self.__playerID = pID

def ShipPlay(self,api:IShipAPI)->None:
#公共操作
def ShipPlay(self, api: IShipAPI) -> None:
# 公共操作

if self.__playerID==0:
#player0的操作
if self.__playerID == 0:
# player0的操作
return
elif self.__playerID==1:
#player1的操作
elif self.__playerID == 1:
# player1的操作
return
elif self.__playerID==2:
#player2的操作
elif self.__playerID == 2:
# player2的操作
return
return
def TeamPlay(self,api:ITeamAPI)->None:
#操作
return

def TeamPlay(self, api: ITeamAPI) -> None:
# 操作
return
Loading

0 comments on commit 023a140

Please sign in to comment.