Skip to content

Commit 023a140

Browse files
committed
Fix Python CAPI Bugs
2 parents ce9aaff + 7db5121 commit 023a140

File tree

950 files changed

+38920
-2108
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

950 files changed

+38920
-2108
lines changed

CAPI/python/PyAPI/AI.py

+23-19
Original file line numberDiff line numberDiff line change
@@ -6,41 +6,45 @@
66

77
import time
88

9+
910
class Setting:
1011
# 为假则play()期间确保游戏状态不更新,为真则只保证游戏状态在调用相关方法时不更新,大致一帧更新一次
1112
@staticmethod
1213
def asynchronous() -> bool:
1314
return False
14-
15+
16+
1517
numOfGridPerCell: Final[int] = 1000
1618

19+
1720
class AssistFunction:
1821
@staticmethod
1922
def CellToGrid(cell: int) -> int:
20-
return cell*numOfGridPerCell+numOfGridPerCell//2
21-
23+
return cell * numOfGridPerCell + numOfGridPerCell // 2
24+
2225
@staticmethod
2326
def GridToCell(grid: int) -> int:
24-
return grid//numOfGridPerCell
25-
27+
return grid // numOfGridPerCell
28+
29+
2630
class AI(IAI):
27-
def __init__(self,pID:int):
28-
self.__playerID=pID
31+
def __init__(self, pID: int):
32+
self.__playerID = pID
2933

30-
def ShipPlay(self,api:IShipAPI)->None:
31-
#公共操作
34+
def ShipPlay(self, api: IShipAPI) -> None:
35+
# 公共操作
3236

33-
if self.__playerID==0:
34-
#player0的操作
37+
if self.__playerID == 0:
38+
# player0的操作
3539
return
36-
elif self.__playerID==1:
37-
#player1的操作
40+
elif self.__playerID == 1:
41+
# player1的操作
3842
return
39-
elif self.__playerID==2:
40-
#player2的操作
43+
elif self.__playerID == 2:
44+
# player2的操作
4145
return
4246
return
43-
44-
def TeamPlay(self,api:ITeamAPI)->None:
45-
#操作
46-
return
47+
48+
def TeamPlay(self, api: ITeamAPI) -> None:
49+
# 操作
50+
return

0 commit comments

Comments
 (0)