From 23bcbedd183c7afe1d5ded8dd390a33ff1782862 Mon Sep 17 00:00:00 2001 From: huangjielun <2872405629@qq.com> Date: Thu, 1 Sep 2022 14:52:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=80=81=E9=B9=B0bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.py | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/src/main.py b/src/main.py index 6f9979c..15d6873 100644 --- a/src/main.py +++ b/src/main.py @@ -142,7 +142,7 @@ def ismove(old_x,old_y,x,y,id,MAP,MAP1): if id == 1: if MAP[x][y] == 16: return 0 - if abs(x - old_x) == 1 and old_y == y and (MAP[x][y] == 0 or MAP[x][y] == 20 or MAP[x][y] == 15 or MAP[x][y] == 17 or MAP[x][y] == 18 or MAP[x][y] == 14 or MAP1[x][y] == 15): + if abs(x - old_x) == 1 and old_y == y and (MAP[x][y] == 0 or MAP[x][y] == 20 or MAP[x][y] == 15 or MAP[x][y] == 17 or MAP[x][y] == 18 or MAP[x][y] == 14 or MAP1[x][y] == 15 or MAP[x][y] == 8): if MAP[x][y] == 14 and MAP1[old_x][old_y] == 20: return 0 if MAP[x][y] == 14 and MAP1[old_x][old_y] != 20: @@ -158,7 +158,7 @@ def ismove(old_x,old_y,x,y,id,MAP,MAP1): r_animals -= 1 return 1 return 1 - elif old_x == x and abs(y - old_y) == 1 and (MAP[x][y] == 0 or MAP[x][y] == 20 or MAP[x][y] == 15 or MAP[x][y] == 17 or MAP[x][y] == 18 or MAP[x][y] == 14 or MAP1[x][y] == 15): + elif old_x == x and abs(y - old_y) == 1 and (MAP[x][y] == 0 or MAP[x][y] == 20 or MAP[x][y] == 15 or MAP[x][y] == 17 or MAP[x][y] == 18 or MAP[x][y] == 14 or MAP1[x][y] == 15 or MAP[x][y] == 8): if MAP[x][y] == 14 and MAP1[old_x][old_y] == 20: return 0 if MAP[x][y] == 14 and MAP1[old_x][old_y] != 20: @@ -182,7 +182,7 @@ def ismove(old_x,old_y,x,y,id,MAP,MAP1): if x == old_x and (MAP[x][y] == 0 or MAP[x][y] == 15 or MAP[x][y] == 17 or MAP[x][y] == 18 or MAP1[x][y] == 15 or 8<=MAP[x][y]<=9): if y > old_y: for i in range(old_y+1,y): - if (MAP[x][i] != 0 and MAP[x][i] != 20 and MAP[x][i] != 15 and MAP[x][i] != 17 and MAP[x][i] != 16 and MAP[x][i] != 18): + if (MAP[x][i] != 0 and MAP[x][i] != 20 and MAP[x][i] != 15 and MAP[x][i] != 16 and MAP[x][i] != 18): return 0 if 8<=MAP[x][y]<=9: if MAP[x][y] == 8: @@ -202,7 +202,7 @@ def ismove(old_x,old_y,x,y,id,MAP,MAP1): return 1 else: for i in range(y+1,old_y): - if (MAP[x][i] != 0 and MAP[x][i] != 20 and MAP[x][i] != 15 and MAP[x][i] != 17 and MAP[x][i] != 16 and MAP[x][i] != 18 ): + if (MAP[x][i] != 0 and MAP[x][i] != 20 and MAP[x][i] != 15 and MAP[x][i] != 16 and MAP[x][i] != 18 ): return 0 if 8<=MAP[x][y]<=9: if MAP[x][y] == 8: @@ -223,7 +223,7 @@ def ismove(old_x,old_y,x,y,id,MAP,MAP1): elif y == old_y and (MAP[x][y] == 0 or MAP[x][y] == 15 or MAP[x][y] == 17 or MAP[x][y] == 18 or MAP1[x][y] == 15 or 8<=MAP[x][y]<=9): if x > old_x: for i in range(old_x+1,x): - if (MAP[i][y] != 0 and MAP[i][y] != 20 and MAP[i][y] != 15 and MAP[i][y] != 17 and MAP[i][y] != 16 and MAP[i][y] != 18): + if (MAP[i][y] != 0 and MAP[i][y] != 20 and MAP[i][y] != 15 and MAP[i][y] != 16 and MAP[i][y] != 18): return 0 if 8<=MAP[x][y]<=9: if MAP[x][y] == 8: @@ -243,7 +243,7 @@ def ismove(old_x,old_y,x,y,id,MAP,MAP1): return 1 else : for i in range(x+1,old_x): - if (MAP[i][y] != 0 and MAP[i][y] != 20 and MAP[i][y] != 15 and MAP[i][y] != 17 and MAP[i][y] != 16 and MAP[i][y] != 18): + if (MAP[i][y] != 0 and MAP[i][y] != 20 and MAP[i][y] != 15 and MAP[i][y] != 16 and MAP[i][y] != 18): return 0 if 8<=MAP[x][y]<=9: if MAP[x][y] == 8: @@ -531,7 +531,7 @@ def ismove(old_x,old_y,x,y,id,MAP,MAP1): elif id == 8: if MAP[x][y] == 18: return 0 - if abs(x - old_x) == 1 and old_y == y and (MAP[x][y] == 0 or MAP[x][y] == 20 or MAP[x][y] == 17 or MAP[x][y] == 15 or MAP[x][y] == 16 or MAP[x][y] == 7 or MAP1[x][y] == 17): + if abs(x - old_x) == 1 and old_y == y and (MAP[x][y] == 0 or MAP[x][y] == 20 or MAP[x][y] == 17 or MAP[x][y] == 15 or MAP[x][y] == 16 or MAP[x][y] == 7 or MAP1[x][y] == 17 or MAP[x][y] == 1): if MAP[x][y] == 7: if MAP1[old_x][old_y] != 20: ID[7] = 0 @@ -548,7 +548,7 @@ def ismove(old_x,old_y,x,y,id,MAP,MAP1): l_animals -= 1 return 1 return 1 - elif old_x == x and abs(y - old_y) == 1 and (MAP[x][y] == 0 or MAP[x][y] == 20 or MAP[x][y] == 17 or MAP[x][y] == 15 or MAP[x][y] == 16 or MAP[x][y] == 7 or MAP1[x][y] == 17): + elif old_x == x and abs(y - old_y) == 1 and (MAP[x][y] == 0 or MAP[x][y] == 20 or MAP[x][y] == 17 or MAP[x][y] == 15 or MAP[x][y] == 16 or MAP[x][y] == 7 or MAP1[x][y] == 17 or MAP[x][y] == 1): if MAP[x][y] == 7: if MAP1[old_x][old_y] != 20: ID[7] = 0 @@ -573,7 +573,7 @@ def ismove(old_x,old_y,x,y,id,MAP,MAP1): if x == old_x and (MAP[x][y] == 0 or MAP[x][y] == 15 or MAP[x][y] == 17 or MAP[x][y] == 16 or MAP1[x][y] == 17 or 1<=MAP[x][y]<=2): if y > old_y: for i in range(old_y + 1, y): - if (MAP[x][i] != 0 and MAP[x][i] != 20 and MAP[x][i] != 17 and MAP[i][y] != 15 and MAP[x][i] != 18): + if (MAP[x][i] != 0 and MAP[x][i] != 20 and MAP[x][i] != 17 and MAP[x][i] != 18): return 0 if 1 <= MAP[x][y] <= 2: if MAP[x][y] == 1: @@ -593,7 +593,7 @@ def ismove(old_x,old_y,x,y,id,MAP,MAP1): return 1 else: for i in range(y + 1, old_y): - if (MAP[x][i] != 0 and MAP[x][i] != 20 and MAP[x][i] != 17 and MAP[i][y] != 15 and MAP[x][i] != 18): + if (MAP[x][i] != 0 and MAP[x][i] != 20 and MAP[x][i] != 17 and MAP[x][i] != 18): return 0 if 1 <= MAP[x][y] <= 2: if MAP[x][y] == 1: @@ -614,7 +614,7 @@ def ismove(old_x,old_y,x,y,id,MAP,MAP1): elif y == old_y and (MAP[x][y] == 0 or MAP[x][y] == 15 or MAP[x][y] == 17 or MAP[x][y] == 16 or MAP1[x][y] == 17 or 1<=MAP[x][y]<=2): if x > old_x: for i in range(old_x + 1, x): - if (MAP[i][y] != 0 and MAP[i][y] != 20 and MAP[i][y] != 17 and MAP[i][y] != 15 and MAP[i][y] != 18): + if (MAP[i][y] != 0 and MAP[i][y] != 20 and MAP[i][y] != 17 and MAP[i][y] != 18): return 0 if 1 <= MAP[x][y] <= 2: if MAP[x][y] == 1: @@ -634,7 +634,7 @@ def ismove(old_x,old_y,x,y,id,MAP,MAP1): return 1 else: for i in range(x + 1, old_x): - if (MAP[i][y] != 0 and MAP[i][y] != 20 and MAP[i][y] != 17 and MAP[i][y] != 15 and MAP[i][y] != 18): + if (MAP[i][y] != 0 and MAP[i][y] != 20 and MAP[i][y] != 17 and MAP[i][y] != 18): return 0 if 1 <= MAP[x][y] <= 2: if MAP[x][y] == 1: @@ -955,7 +955,7 @@ def left_move(old_x,old_y,x,y,id,MAP,MAP1): if id == 8: if MAP[x][y] == 18: return 0 - if abs(x - old_x) == 1 and old_y == y and (MAP[x][y] == 0 or MAP[x][y] == 20 or MAP[x][y] == 17 or MAP[x][y] == 15 or MAP[x][y] == 16 or MAP[x][y] == 7 or MAP1[x][y] == 17): + if abs(x - old_x) == 1 and old_y == y and (MAP[x][y] == 0 or MAP[x][y] == 20 or MAP[x][y] == 17 or MAP[x][y] == 15 or MAP[x][y] == 16 or MAP[x][y] == 7 or MAP1[x][y] == 17 or MAP[x][y] == 1): if MAP[x][y] == 7: if MAP1[old_x][old_y] != 20: return 1 @@ -966,7 +966,7 @@ def left_move(old_x,old_y,x,y,id,MAP,MAP1): if MAP1[x][y] == 17 and 1<=MAP[x][y]<=7: return 1 return 1 - elif old_x == x and abs(y - old_y) == 1 and (MAP[x][y] == 0 or MAP[x][y] == 20 or MAP[x][y] == 17 or MAP[x][y] == 15 or MAP[x][y] == 16 or MAP[x][y] == 7 or MAP1[x][y] == 17): + elif old_x == x and abs(y - old_y) == 1 and (MAP[x][y] == 0 or MAP[x][y] == 20 or MAP[x][y] == 17 or MAP[x][y] == 15 or MAP[x][y] == 16 or MAP[x][y] == 7 or MAP1[x][y] == 17 or MAP[x][y] == 1): if MAP[x][y] == 7: if MAP1[old_x][old_y] != 20: return 1 @@ -985,7 +985,7 @@ def left_move(old_x,old_y,x,y,id,MAP,MAP1): if x == old_x and (MAP[x][y] == 0 or MAP[x][y] == 15 or MAP[x][y] == 17 or MAP[x][y] == 16 or MAP1[x][y] == 17 or 1<=MAP[x][y]<=2): if y > old_y: for i in range(old_y + 1, y): - if (MAP[x][i] != 0 and MAP[x][i] != 20 and MAP[x][i] != 17 and MAP[i][y] != 15 and MAP[x][i] != 18): + if (MAP[x][i] != 0 and MAP[x][i] != 20 and MAP[x][i] != 17 and MAP[x][i] != 18): return 0 if 1 <= MAP[x][y] <= 2: if MAP[x][y] == 1: @@ -999,7 +999,7 @@ def left_move(old_x,old_y,x,y,id,MAP,MAP1): return 1 else: for i in range(y + 1, old_y): - if (MAP[x][i] != 0 and MAP[x][i] != 20 and MAP[x][i] != 17 and MAP[i][y] != 15 and MAP[x][i] != 18): + if (MAP[x][i] != 0 and MAP[x][i] != 20 and MAP[x][i] != 17 and MAP[x][i] != 18): return 0 if 1 <= MAP[x][y] <= 2: if MAP[x][y] == 1: @@ -1014,7 +1014,7 @@ def left_move(old_x,old_y,x,y,id,MAP,MAP1): elif y == old_y and (MAP[x][y] == 0 or MAP[x][y] == 15 or MAP[x][y] == 17 or MAP[x][y] == 16 or MAP1[x][y] == 17 or 1<=MAP[x][y]<=2): if x > old_x: for i in range(old_x + 1, x): - if (MAP[i][y] != 0 and MAP[i][y] != 20 and MAP[i][y] != 17 and MAP[i][y] != 15 and MAP[i][y] != 18): + if (MAP[i][y] != 0 and MAP[i][y] != 20 and MAP[i][y] != 17 and MAP[i][y] != 18): return 0 if 1 <= MAP[x][y] <= 2: if MAP[x][y] == 1: @@ -1028,7 +1028,7 @@ def left_move(old_x,old_y,x,y,id,MAP,MAP1): return 1 else: for i in range(x + 1, old_x): - if (MAP[i][y] != 0 and MAP[i][y] != 20 and MAP[i][y] != 17 and MAP[i][y] != 15 and MAP[i][y] != 18): + if (MAP[i][y] != 0 and MAP[i][y] != 20 and MAP[i][y] != 17 and MAP[i][y] != 18): return 0 if 1 <= MAP[x][y] <= 2: if MAP[x][y] == 1: @@ -1272,7 +1272,7 @@ def right_move(old_x,old_y,x,y,id,MAP,MAP1): if MAP[x][y] == 16: return 0 if abs(x - old_x) == 1 and old_y == y and ( - MAP[x][y] == 0 or MAP[x][y] == 20 or MAP[x][y] == 15 or MAP[x][y] == 17 or MAP[x][y] == 18 or MAP[x][y] == 14 or MAP1[x][y] == 15): + MAP[x][y] == 0 or MAP[x][y] == 20 or MAP[x][y] == 15 or MAP[x][y] == 17 or MAP[x][y] == 18 or MAP[x][y] == 14 or MAP1[x][y] == 15 or MAP[x][y] == 8): if MAP[x][y] == 14 and MAP1[old_x][old_y] == 20: return 0 if MAP[x][y] == 14 and MAP1[old_x][old_y] != 20: @@ -1283,7 +1283,7 @@ def right_move(old_x,old_y,x,y,id,MAP,MAP1): return 1 return 1 elif old_x == x and abs(y - old_y) == 1 and ( - MAP[x][y] == 0 or MAP[x][y] == 20 or MAP[x][y] == 15 or MAP[x][y] == 17 or MAP[x][y] == 18 or MAP[x][y] == 14 or MAP1[x][y] == 15): + MAP[x][y] == 0 or MAP[x][y] == 20 or MAP[x][y] == 15 or MAP[x][y] == 17 or MAP[x][y] == 18 or MAP[x][y] == 14 or MAP1[x][y] == 15 or MAP[x][y] == 8): if MAP[x][y] == 14 and MAP1[old_x][old_y] == 20: return 0 if MAP[x][y] == 14 and MAP1[old_x][old_y] != 20: @@ -1302,7 +1302,7 @@ def right_move(old_x,old_y,x,y,id,MAP,MAP1): MAP[x][y] == 0 or MAP[x][y] == 15 or MAP[x][y] == 17 or MAP[x][y] == 18 or MAP1[x][y] == 15 or 8 <=MAP[x][y] <= 9): if y > old_y: for i in range(old_y + 1, y): - if (MAP[x][i] != 0 and MAP[x][i] != 20 and MAP[x][i] != 15 and MAP[x][i] != 17 and MAP[x][i] != 16 and MAP[x][i] != 18): + if (MAP[x][i] != 0 and MAP[x][i] != 20 and MAP[x][i] != 15 and MAP[x][i] != 16 and MAP[x][i] != 18): return 0 if 8 <= MAP[x][y] <= 9: if MAP[x][y] == 8: @@ -1316,7 +1316,7 @@ def right_move(old_x,old_y,x,y,id,MAP,MAP1): return 1 else: for i in range(y + 1, old_y): - if (MAP[x][i] != 0 and MAP[x][i] != 20 and MAP[x][i] != 15 and MAP[x][i] != 17 and MAP[x][i] != 16 and MAP[x][i] != 18): + if (MAP[x][i] != 0 and MAP[x][i] != 20 and MAP[x][i] != 15 and MAP[x][i] != 16 and MAP[x][i] != 18): return 0 if 8 <= MAP[x][y] <= 9: if MAP[x][y] == 8: @@ -1332,7 +1332,7 @@ def right_move(old_x,old_y,x,y,id,MAP,MAP1): MAP[x][y] == 0 or MAP[x][y] == 15 or MAP[x][y] == 17 or MAP[x][y] == 18 or MAP1[x][y] == 15 or 8 <=MAP[x][y] <= 9): if x > old_x: for i in range(old_x + 1, x): - if (MAP[i][y] != 0 and MAP[i][y] != 20 and MAP[i][y] != 15 and MAP[i][y] != 17 and MAP[i][y] != 16 and MAP[i][y] != 18): + if (MAP[i][y] != 0 and MAP[i][y] != 20 and MAP[i][y] != 15 and MAP[i][y] != 16 and MAP[i][y] != 18): return 0 if 8 <= MAP[x][y] <= 9: if MAP[x][y] == 8: @@ -1346,7 +1346,7 @@ def right_move(old_x,old_y,x,y,id,MAP,MAP1): return 1 else: for i in range(x + 1, old_x): - if (MAP[i][y] != 0 and MAP[i][y] != 20 and MAP[i][y] != 15 and MAP[i][y] != 17 and MAP[i][y] != 16 and MAP[i][y] != 18): + if (MAP[i][y] != 0 and MAP[i][y] != 20 and MAP[i][y] != 15 and MAP[i][y] != 16 and MAP[i][y] != 18): return 0 if 8 <= MAP[x][y] <= 9: if MAP[x][y] == 8: