You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
尽管不涉及错误,也不影响什么,
双重循环看起来还是很不舒服,毕竟0(1)的问题变成了0(n^2)的问题了,做如下修改比较好:
def click1(self, event): #click1 because keyword repetition
size = self.board.width
current_player = self.board.get_current_player()
if current_player == 1:
# for i in range(size):
# for j in range(size):
i=(event.x)//30
j=(event.y)//30
ri=(event.x)%30
rj=(event.y)%30
i=i-1 if ri<15 else i
j=j-1 if rj<15 else j
尽管不涉及错误,也不影响什么,
双重循环看起来还是很不舒服,毕竟0(1)的问题变成了0(n^2)的问题了,做如下修改比较好:
def click1(self, event): #click1 because keyword repetition
size = self.board.width
current_player = self.board.get_current_player()
if current_player == 1:
# for i in range(size):
# for j in range(size):
i=(event.x)//30
j=(event.y)//30
ri=(event.x)%30
rj=(event.y)%30
i=i-1 if ri<15 else i
j=j-1 if rj<15 else j
The text was updated successfully, but these errors were encountered: