|
|
|
|
@ -3,7 +3,6 @@ import init
|
|
|
|
|
import start_game
|
|
|
|
|
import time
|
|
|
|
|
import os
|
|
|
|
|
#import path.path
|
|
|
|
|
WIDTH , HEIGHT = 1200 , 800
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -26,13 +25,16 @@ Mouse = pygame.mixer.Sound('audio/Mouse.mp3')
|
|
|
|
|
#Start = pygame.mixer.Sound('audio/start.mp3')
|
|
|
|
|
Tiger = pygame.mixer.Sound('audio/Tiger.mp3')
|
|
|
|
|
Wolf = pygame.mixer.Sound('audio/Wolf.mp3')
|
|
|
|
|
Fox = pygame.mixer.Sound('audio/Fox..mp3')
|
|
|
|
|
Fox = pygame.mixer.Sound('audio/Fox.mp3')
|
|
|
|
|
Eagle = pygame.mixer.Sound('audio/Eagle.mp3')
|
|
|
|
|
pygame.mixer.music.set_volume(0.5)
|
|
|
|
|
####################################################
|
|
|
|
|
#animals img
|
|
|
|
|
#mark
|
|
|
|
|
hint = pygame.transform.scale(pygame.image.load("images/hint.png"),(CHESSSIZE_X,CHESSSIZE_Y))
|
|
|
|
|
capture_hint = pygame.transform.scale(pygame.image.load("images/capture-hint.png"),(CHESSSIZE_X,CHESSSIZE_Y))
|
|
|
|
|
left_turn = pygame.transform.scale(pygame.image.load("images/left_turn.png"),(CHESSSIZE_X,CHESSSIZE_Y))
|
|
|
|
|
right_turn = pygame.transform.scale(pygame.image.load("images/right_turn.png"),(CHESSSIZE_X,CHESSSIZE_Y))
|
|
|
|
|
#animals img
|
|
|
|
|
#Left
|
|
|
|
|
L_mouse = pygame.transform.scale(pygame.image.load('images/animals/left/1MouseLeft.png'),(CHESSSIZE_X,CHESSSIZE_Y))
|
|
|
|
|
L_eagle = pygame.transform.scale(pygame.image.load('images/animals/left/2EagleLeft.png'),(CHESSSIZE_X,CHESSSIZE_Y))
|
|
|
|
|
@ -114,29 +116,32 @@ def draw_right_animals(r_elephant,r_eagle,r_wolf,r_lion,r_leopard,r_mouse,r_fox)
|
|
|
|
|
|
|
|
|
|
def draw_window(l_elephant,l_eagle,l_wolf,l_lion,l_leopard,l_mouse,l_fox,r_elephant,r_eagle,r_wolf,r_lion,r_leopard,r_mouse,r_fox,id, x, y, status, MAP, MAP1,turn):
|
|
|
|
|
WIN.blit(SPACE,(0,0))
|
|
|
|
|
|
|
|
|
|
if turn == 0:
|
|
|
|
|
WIN.blit(left_turn,init.tran(0,3))
|
|
|
|
|
elif turn == 1:
|
|
|
|
|
WIN.blit(right_turn,init.tran(8,3))
|
|
|
|
|
draw_left_animals(l_elephant,l_eagle,l_wolf,l_lion,l_leopard,l_mouse,l_fox)
|
|
|
|
|
draw_right_animals(r_elephant,r_eagle,r_wolf,r_lion,r_leopard,r_mouse,r_fox)
|
|
|
|
|
path(id, x, y, status, MAP, MAP1, turn)
|
|
|
|
|
#WIN.blit(L_fox,(fox.x,fox.y))
|
|
|
|
|
pygame.display.update()
|
|
|
|
|
|
|
|
|
|
#animals rect
|
|
|
|
|
l_elephant = pygame.Rect(int(2/9 * WIDTH),int(0 / 7 * HEIGHT),CHESSSIZE_Y,CHESSSIZE_Y)
|
|
|
|
|
l_eagle = pygame.Rect(int(1 / 9 *WIDTH),int(1 / 7 * HEIGHT),CHESSSIZE_Y,CHESSSIZE_Y)
|
|
|
|
|
l_wolf = pygame.Rect(int(2/9 * WIDTH),int(2/7 * HEIGHT),CHESSSIZE_Y,CHESSSIZE_Y)
|
|
|
|
|
l_lion = pygame.Rect(int(2/9 * WIDTH),int(3/7 * HEIGHT),CHESSSIZE_Y,CHESSSIZE_Y)
|
|
|
|
|
l_leopard = pygame.Rect(int(2/9 * WIDTH),int(4/7 * HEIGHT),CHESSSIZE_Y,CHESSSIZE_Y)
|
|
|
|
|
l_mouse = pygame.Rect(int(2/9 * WIDTH),int(6/7 * HEIGHT),CHESSSIZE_Y,CHESSSIZE_Y)
|
|
|
|
|
l_fox = pygame.Rect(int(1/9 * WIDTH),int(5/7 * HEIGHT),CHESSSIZE_Y,CHESSSIZE_Y)
|
|
|
|
|
l_elephant = pygame.Rect(281,10,CHESSSIZE_Y,CHESSSIZE_Y)
|
|
|
|
|
l_eagle = pygame.Rect(157,120,CHESSSIZE_Y,CHESSSIZE_Y)
|
|
|
|
|
l_wolf = pygame.Rect(284,229,CHESSSIZE_Y,CHESSSIZE_Y)
|
|
|
|
|
l_lion = pygame.Rect(292,343,CHESSSIZE_Y,CHESSSIZE_Y)
|
|
|
|
|
l_leopard = pygame.Rect(285,450,CHESSSIZE_Y,CHESSSIZE_Y)
|
|
|
|
|
l_mouse = pygame.Rect(285,665,CHESSSIZE_Y,CHESSSIZE_Y)
|
|
|
|
|
l_fox = pygame.Rect(157,557,CHESSSIZE_Y,CHESSSIZE_Y)
|
|
|
|
|
|
|
|
|
|
r_elephant = pygame.Rect(795,673,CHESSSIZE_Y,CHESSSIZE_Y)
|
|
|
|
|
r_eagle = pygame.Rect(925,570,CHESSSIZE_Y,CHESSSIZE_Y)
|
|
|
|
|
r_wolf = pygame.Rect(803,458,CHESSSIZE_Y,CHESSSIZE_Y)
|
|
|
|
|
r_lion = pygame.Rect(802,347,CHESSSIZE_Y,CHESSSIZE_Y)
|
|
|
|
|
r_leopard = pygame.Rect(796,232,CHESSSIZE_Y,CHESSSIZE_Y)
|
|
|
|
|
r_fox = pygame.Rect(920,123,CHESSSIZE_Y,CHESSSIZE_Y)
|
|
|
|
|
r_mouse = pygame.Rect(793,16,CHESSSIZE_Y,CHESSSIZE_Y)
|
|
|
|
|
|
|
|
|
|
r_elephant = pygame.Rect(int(6/9*WIDTH),int(6/7*HEIGHT),CHESSSIZE_Y,CHESSSIZE_Y)
|
|
|
|
|
r_eagle = pygame.Rect(int(7/9*WIDTH),int(5/7*HEIGHT),CHESSSIZE_Y,CHESSSIZE_Y)
|
|
|
|
|
r_wolf = pygame.Rect(int(6/9*WIDTH),int(4/7*HEIGHT),CHESSSIZE_Y,CHESSSIZE_Y)
|
|
|
|
|
r_lion = pygame.Rect(int(6/9*WIDTH),int(3/7*HEIGHT),CHESSSIZE_Y,CHESSSIZE_Y)
|
|
|
|
|
r_leopard = pygame.Rect(int(6/9*WIDTH),int(2/7*HEIGHT),CHESSSIZE_Y,CHESSSIZE_Y)
|
|
|
|
|
r_fox = pygame.Rect(int(7/9*WIDTH),int(1/7*HEIGHT),CHESSSIZE_Y,CHESSSIZE_Y)
|
|
|
|
|
r_mouse = pygame.Rect(int(6/9*WIDTH),int(0/7*HEIGHT),CHESSSIZE_Y,CHESSSIZE_Y)
|
|
|
|
|
#############################################
|
|
|
|
|
l_animals =r_animals = 7
|
|
|
|
|
def ismove(old_x,old_y,x,y,id,MAP,MAP1):
|
|
|
|
|
@ -145,7 +150,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 and 8<=MAP[x][y]<=14) 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:
|
|
|
|
|
@ -160,8 +165,10 @@ def ismove(old_x,old_y,x,y,id,MAP,MAP1):
|
|
|
|
|
ID[MAP[x][y]] = 0
|
|
|
|
|
r_animals -= 1
|
|
|
|
|
return 1
|
|
|
|
|
if MAP1[x][y] == 15 and not (8 <= MAP[x][y] <= 14):
|
|
|
|
|
return 0
|
|
|
|
|
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 and 8<=MAP[x][y]<=14) 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,10 +189,10 @@ def ismove(old_x,old_y,x,y,id,MAP,MAP1):
|
|
|
|
|
elif id == 2:
|
|
|
|
|
if MAP[x][y] == 16 and MAP[x][y] != 0 and MAP[x][y] != 15 and MAP[x][y] != 17 and MAP[x][y] != 18 and MAP1[x][y] != 15 and (9 < MAP[x][y] <= 14):
|
|
|
|
|
return 0
|
|
|
|
|
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 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 and 8<=MAP[x][y]<=14) 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:
|
|
|
|
|
@ -205,7 +212,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,10 +230,10 @@ def ismove(old_x,old_y,x,y,id,MAP,MAP1):
|
|
|
|
|
r_animals -= 1
|
|
|
|
|
return 1
|
|
|
|
|
return 1
|
|
|
|
|
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):
|
|
|
|
|
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 and 8<=MAP[x][y]<=14) 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:
|
|
|
|
|
@ -246,7 +253,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:
|
|
|
|
|
@ -267,7 +274,7 @@ def ismove(old_x,old_y,x,y,id,MAP,MAP1):
|
|
|
|
|
else :
|
|
|
|
|
return 0
|
|
|
|
|
elif id == 3:
|
|
|
|
|
if abs(x - old_x) <= 1 and abs(y - old_y) <= 1 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]<=10):
|
|
|
|
|
if abs(x - old_x) <= 1 and abs(y - old_y) <= 1 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 and 8<=MAP[x][y]<=14) or 8<=MAP[x][y]<=10):
|
|
|
|
|
if 8 <= MAP[x][y] <= 10:
|
|
|
|
|
if MAP[x][y] == 8:
|
|
|
|
|
if MAP1[x][y] != 20:
|
|
|
|
|
@ -290,7 +297,7 @@ def ismove(old_x,old_y,x,y,id,MAP,MAP1):
|
|
|
|
|
return 0
|
|
|
|
|
if(MAP[x][y] == 20):
|
|
|
|
|
return 0
|
|
|
|
|
if abs(x - old_x) == 1 and old_y == 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]<=11):
|
|
|
|
|
if abs(x - old_x) == 1 and old_y == 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 and 8<=MAP[x][y]<=14) or 8<=MAP[x][y]<=11):
|
|
|
|
|
if 8 <= MAP[x][y] <= 11:
|
|
|
|
|
if MAP[x][y] == 8:
|
|
|
|
|
if MAP1[x][y] != 20:
|
|
|
|
|
@ -307,7 +314,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] == 15 or MAP[x][y] == 17 or MAP[x][y] == 18 or MAP1[x][y] == 15 or 8<=MAP[x][y]<=11):
|
|
|
|
|
elif old_x == x and abs(y - old_y) == 1 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 and 8<=MAP[x][y]<=14) or 8<=MAP[x][y]<=11):
|
|
|
|
|
if 8 <= MAP[x][y] <= 11:
|
|
|
|
|
if MAP[x][y] == 8:
|
|
|
|
|
if MAP1[x][y] != 20:
|
|
|
|
|
@ -331,7 +338,7 @@ def ismove(old_x,old_y,x,y,id,MAP,MAP1):
|
|
|
|
|
return 0
|
|
|
|
|
if(MAP[x][y] == 20):
|
|
|
|
|
return 0
|
|
|
|
|
if abs(x - old_x) ==1 and old_y == 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]<=12):
|
|
|
|
|
if abs(x - old_x) ==1 and old_y == 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 and 8<=MAP[x][y]<=14) or 8<=MAP[x][y]<=12):
|
|
|
|
|
if 8 <= MAP[x][y] <= 12:
|
|
|
|
|
if MAP[x][y] == 8:
|
|
|
|
|
if MAP1[x][y] != 20:
|
|
|
|
|
@ -348,7 +355,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] == 15 or MAP[x][y] == 17 or MAP[x][y] == 18 or MAP1[x][y] == 15 or 8<=MAP[x][y]<=12):
|
|
|
|
|
elif old_x == x and abs(y - old_y) == 1 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 and 8<=MAP[x][y]<=14) or 8<=MAP[x][y]<=12):
|
|
|
|
|
if 8 <= MAP[x][y] <= 12 :
|
|
|
|
|
if MAP[x][y] == 8:
|
|
|
|
|
if MAP1[x][y] != 20:
|
|
|
|
|
@ -372,7 +379,7 @@ def ismove(old_x,old_y,x,y,id,MAP,MAP1):
|
|
|
|
|
return 0
|
|
|
|
|
if MAP[x][y] == 20:
|
|
|
|
|
return 0
|
|
|
|
|
if abs(x - old_x) == 1 and old_y == 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]<=13):
|
|
|
|
|
if abs(x - old_x) == 1 and old_y == 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 and 8<=MAP[x][y]<=14) or 8<=MAP[x][y]<=13):
|
|
|
|
|
if 8 <= MAP[x][y] <= 13:
|
|
|
|
|
if MAP[x][y] == 8:
|
|
|
|
|
if MAP1[x][y] != 20:
|
|
|
|
|
@ -389,7 +396,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] == 15 or MAP[x][y] == 17 or MAP[x][y] == 18 or MAP1[x][y] == 15 or 8<=MAP[x][y]<=13):
|
|
|
|
|
elif old_x == x and abs(y - old_y) == 1 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 and 8<=MAP[x][y]<=14) or 8<=MAP[x][y]<=13):
|
|
|
|
|
if 8 <= MAP[x][y] <= 13:
|
|
|
|
|
if MAP[x][y] == 8:
|
|
|
|
|
if MAP1[x][y] != 20:
|
|
|
|
|
@ -406,7 +413,7 @@ def ismove(old_x,old_y,x,y,id,MAP,MAP1):
|
|
|
|
|
r_animals -= 1
|
|
|
|
|
return 1
|
|
|
|
|
return 1
|
|
|
|
|
elif old_x == 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]<=13):
|
|
|
|
|
elif old_x == 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 and 8<=MAP[x][y]<=14) or 8<=MAP[x][y]<=13):
|
|
|
|
|
if y > old_y:
|
|
|
|
|
for i in range(old_y+1,y):
|
|
|
|
|
if MAP[x][i] != 20 and MAP[x][i] != 1 :
|
|
|
|
|
@ -447,7 +454,7 @@ def ismove(old_x,old_y,x,y,id,MAP,MAP1):
|
|
|
|
|
r_animals -= 1
|
|
|
|
|
return 1
|
|
|
|
|
return 1
|
|
|
|
|
elif old_y == 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]<=13):
|
|
|
|
|
elif old_y == 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 and 8<=MAP[x][y]<=14) or 8<=MAP[x][y]<=13):
|
|
|
|
|
if x > old_x:
|
|
|
|
|
for i in range(old_x+1,x):
|
|
|
|
|
if MAP[i][y] != 20 and MAP[i][y] != 1 :
|
|
|
|
|
@ -495,7 +502,7 @@ def ismove(old_x,old_y,x,y,id,MAP,MAP1):
|
|
|
|
|
return 0
|
|
|
|
|
if(MAP[x][y] == 20):
|
|
|
|
|
return 0
|
|
|
|
|
if abs(x - old_x) == 1 and old_y == 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 9<=MAP[x][y]<=14):
|
|
|
|
|
if abs(x - old_x) == 1 and old_y == 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 and 8<=MAP[x][y]<=14) or 9<=MAP[x][y]<=14):
|
|
|
|
|
if 9 <= MAP[x][y] <= 14:
|
|
|
|
|
if MAP[x][y] == 8:
|
|
|
|
|
if MAP1[x][y] != 20:
|
|
|
|
|
@ -512,7 +519,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] == 15 or MAP[x][y] == 17 and MAP[x][y] == 18 or MAP1[x][y] == 15 or 9<=MAP[x][y]<=14):
|
|
|
|
|
elif old_x == x and abs(y - old_y) == 1 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 and 8<=MAP[x][y]<=14) or 9<=MAP[x][y]<=14):
|
|
|
|
|
if 9 <= MAP[x][y] <= 14:
|
|
|
|
|
if MAP[x][y] == 8:
|
|
|
|
|
if MAP1[x][y] != 20:
|
|
|
|
|
@ -534,7 +541,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 and 1<=MAP[x][y]<=7) or MAP[x][y] == 1):
|
|
|
|
|
if MAP[x][y] == 7:
|
|
|
|
|
if MAP1[old_x][old_y] != 20:
|
|
|
|
|
ID[7] = 0
|
|
|
|
|
@ -551,7 +558,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 and 1<=MAP[x][y]<=7) or MAP[x][y] == 1):
|
|
|
|
|
if MAP[x][y] == 7:
|
|
|
|
|
if MAP1[old_x][old_y] != 20:
|
|
|
|
|
ID[7] = 0
|
|
|
|
|
@ -573,10 +580,10 @@ def ismove(old_x,old_y,x,y,id,MAP,MAP1):
|
|
|
|
|
elif id == 9:
|
|
|
|
|
if MAP[x][y] == 18 and MAP[x][y] != 0 and MAP[x][y] != 15 and MAP[x][y] != 17 and MAP[x][y] != 16 and MAP1[x][y] != 17 and (2<MAP[x][y]<=14):
|
|
|
|
|
return 0
|
|
|
|
|
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 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 and 1<=MAP[x][y]<=7) 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:
|
|
|
|
|
@ -596,7 +603,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,10 +621,10 @@ def ismove(old_x,old_y,x,y,id,MAP,MAP1):
|
|
|
|
|
l_animals -= 1
|
|
|
|
|
return 1
|
|
|
|
|
return 1
|
|
|
|
|
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):
|
|
|
|
|
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 and 1<=MAP[x][y]<=7) 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:
|
|
|
|
|
@ -637,7 +644,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:
|
|
|
|
|
@ -658,7 +665,7 @@ def ismove(old_x,old_y,x,y,id,MAP,MAP1):
|
|
|
|
|
else:
|
|
|
|
|
return 0
|
|
|
|
|
elif id == 10:
|
|
|
|
|
if abs(x - old_x) <= 1 and abs(y - old_y) <= 1 and (MAP[x][y] == 0 or MAP[x][y] == 17 or MAP[x][y] == 15 or MAP[x][y] == 16 or MAP1[x][y] == 17 or 1<=MAP[x][y]<=3):
|
|
|
|
|
if abs(x - old_x) <= 1 and abs(y - old_y) <= 1 and (MAP[x][y] == 0 or MAP[x][y] == 17 or MAP[x][y] == 15 or MAP[x][y] == 16 or (MAP1[x][y] == 17 and 1<=MAP[x][y]<=7) or 1<=MAP[x][y]<=3):
|
|
|
|
|
if 1 <= MAP[x][y] <= 3:
|
|
|
|
|
if MAP[x][y] == 1:
|
|
|
|
|
if MAP1[x][y] != 20:
|
|
|
|
|
@ -681,7 +688,7 @@ def ismove(old_x,old_y,x,y,id,MAP,MAP1):
|
|
|
|
|
return 0
|
|
|
|
|
if(MAP[x][y] == 20):
|
|
|
|
|
return 0
|
|
|
|
|
if abs(x - old_x) == 1 and old_y == y and (MAP[x][y] == 0 or MAP[x][y] == 17 or MAP[x][y] == 15 or MAP[x][y] == 16 or MAP1[x][y] == 17 or 1<=MAP[x][y]<=4):
|
|
|
|
|
if abs(x - old_x) == 1 and old_y == y and (MAP[x][y] == 0 or MAP[x][y] == 17 or MAP[x][y] == 15 or MAP[x][y] == 16 or (MAP1[x][y] == 17 and 1<=MAP[x][y]<=7) or 1<=MAP[x][y]<=4):
|
|
|
|
|
if 1 <= MAP[x][y] <= 4:
|
|
|
|
|
if MAP[x][y] == 1:
|
|
|
|
|
if MAP1[x][y] != 20:
|
|
|
|
|
@ -698,7 +705,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] == 17 or MAP[x][y] == 15 or MAP[x][y] == 16 or MAP1[x][y] == 17 or 1<=MAP[x][y]<=4):
|
|
|
|
|
elif old_x == x and abs(y - old_y) == 1 and (MAP[x][y] == 0 or MAP[x][y] == 17 or MAP[x][y] == 15 or MAP[x][y] == 16 or (MAP1[x][y] == 17 and 1<=MAP[x][y]<=7) or 1<=MAP[x][y]<=4):
|
|
|
|
|
if 1 <= MAP[x][y] <= 4:
|
|
|
|
|
if MAP[x][y] == 1:
|
|
|
|
|
if MAP1[x][y] != 20:
|
|
|
|
|
@ -722,7 +729,7 @@ def ismove(old_x,old_y,x,y,id,MAP,MAP1):
|
|
|
|
|
return 0
|
|
|
|
|
if(MAP[x][y] == 20):
|
|
|
|
|
return 0
|
|
|
|
|
if abs(x - old_x) == 1 and old_y == y and (MAP[x][y] == 0 or MAP[x][y] == 17 or MAP[x][y] == 15 or MAP[x][y] == 16 or MAP1[x][y] == 17 or 1<=MAP[x][y]<=5):
|
|
|
|
|
if abs(x - old_x) == 1 and old_y == y and (MAP[x][y] == 0 or MAP[x][y] == 17 or MAP[x][y] == 15 or MAP[x][y] == 16 or (MAP1[x][y] == 17 and 1<=MAP[x][y]<=7) or 1<=MAP[x][y]<=5):
|
|
|
|
|
if 1 <= MAP[x][y] <= 5:
|
|
|
|
|
if MAP[x][y] == 1:
|
|
|
|
|
if MAP1[x][y] != 20:
|
|
|
|
|
@ -739,7 +746,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] == 17 or MAP[x][y] == 15 or MAP[x][y] == 16 or MAP1[x][y] == 17 or 1<=MAP[x][y]<=5):
|
|
|
|
|
elif old_x == x and abs(y - old_y) == 1 and (MAP[x][y] == 0 or MAP[x][y] == 17 or MAP[x][y] == 15 or MAP[x][y] == 16 or (MAP1[x][y] == 17 and 1<=MAP[x][y]<=7) or 1<=MAP[x][y]<=5):
|
|
|
|
|
if 1 <= MAP[x][y] <= 5:
|
|
|
|
|
if MAP[x][y] == 1:
|
|
|
|
|
if MAP1[x][y] != 20:
|
|
|
|
|
@ -763,7 +770,7 @@ def ismove(old_x,old_y,x,y,id,MAP,MAP1):
|
|
|
|
|
return 0
|
|
|
|
|
if MAP[x][y] == 20:
|
|
|
|
|
return 0
|
|
|
|
|
if abs(x - old_x) ==1 and old_y == y and (MAP[x][y] == 0 or MAP[x][y] == 17 or MAP[x][y] == 15 or MAP[x][y] == 16 or MAP1[x][y] == 17 or 1<=MAP[x][y]<=6):
|
|
|
|
|
if abs(x - old_x) ==1 and old_y == y and (MAP[x][y] == 0 or MAP[x][y] == 17 or MAP[x][y] == 15 or MAP[x][y] == 16 or (MAP1[x][y] == 17 and 1<=MAP[x][y]<=7) or 1<=MAP[x][y]<=6):
|
|
|
|
|
if 1 <= MAP[x][y] <= 6:
|
|
|
|
|
if MAP[x][y] == 1:
|
|
|
|
|
if MAP1[x][y] != 20:
|
|
|
|
|
@ -780,7 +787,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] == 17 or MAP[x][y] == 15 or MAP[x][y] == 16 or MAP1[x][y] == 17 or 1<=MAP[x][y]<=6):
|
|
|
|
|
elif old_x == x and abs(y - old_y) == 1 and (MAP[x][y] == 0 or MAP[x][y] == 17 or MAP[x][y] == 15 or MAP[x][y] == 16 or (MAP1[x][y] == 17 and 1<=MAP[x][y]<=7) or 1<=MAP[x][y]<=6):
|
|
|
|
|
if 1 <= MAP[x][y] <= 6:
|
|
|
|
|
if MAP[x][y] == 1:
|
|
|
|
|
if MAP1[x][y] != 20:
|
|
|
|
|
@ -797,7 +804,7 @@ def ismove(old_x,old_y,x,y,id,MAP,MAP1):
|
|
|
|
|
l_animals -= 1
|
|
|
|
|
return 1
|
|
|
|
|
return 1
|
|
|
|
|
elif old_x == x and (MAP[x][y] == 0 or MAP[x][y] == 17 or MAP[x][y] == 15 or MAP[x][y] == 16 or MAP1[x][y] == 17 or 1<=MAP[x][y]<=6):
|
|
|
|
|
elif old_x == x and (MAP[x][y] == 0 or MAP[x][y] == 17 or MAP[x][y] == 15 or MAP[x][y] == 16 or (MAP1[x][y] == 17 and 1<=MAP[x][y]<=7) or 1<=MAP[x][y]<=6):
|
|
|
|
|
if y > old_y:
|
|
|
|
|
for i in range(old_y+1,y):
|
|
|
|
|
if MAP[x][i] != 20 and MAP[x][i] != 8 :
|
|
|
|
|
@ -838,7 +845,7 @@ def ismove(old_x,old_y,x,y,id,MAP,MAP1):
|
|
|
|
|
l_animals -= 1
|
|
|
|
|
return 1
|
|
|
|
|
return 1
|
|
|
|
|
elif old_y == y and (MAP[x][y] == 0 or MAP[x][y] == 17 or MAP[x][y] == 15 or MAP[x][y] == 16 or MAP1[x][y] == 17 or 1<=MAP[x][y]<=6):
|
|
|
|
|
elif old_y == y and (MAP[x][y] == 0 or MAP[x][y] == 17 or MAP[x][y] == 15 or MAP[x][y] == 16 or (MAP1[x][y] == 17 and 1<=MAP[x][y]<=7) or 1<=MAP[x][y]<=6):
|
|
|
|
|
if x > old_x:
|
|
|
|
|
for i in range(old_x+1,x):
|
|
|
|
|
if MAP[i][y] != 20 and MAP[i][y] != 1 :
|
|
|
|
|
@ -886,7 +893,7 @@ def ismove(old_x,old_y,x,y,id,MAP,MAP1):
|
|
|
|
|
return 0
|
|
|
|
|
if(MAP[x][y] == 20):
|
|
|
|
|
return 0
|
|
|
|
|
if abs(x - old_x) == 1 and old_y == y and (MAP[x][y] == 0 or MAP[x][y] == 17 or MAP[x][y] == 15 or MAP[x][y] == 16 or MAP1[x][y] == 17 or 2<=MAP[x][y]<=7):
|
|
|
|
|
if abs(x - old_x) == 1 and old_y == y and (MAP[x][y] == 0 or MAP[x][y] == 17 or MAP[x][y] == 15 or MAP[x][y] == 16 or (MAP1[x][y] == 17 and 1<=MAP[x][y]<=7) or 2<=MAP[x][y]<=7):
|
|
|
|
|
if 2 <= MAP[x][y] <= 7:
|
|
|
|
|
if MAP[x][y] == 1:
|
|
|
|
|
if MAP1[x][y] != 20:
|
|
|
|
|
@ -903,7 +910,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] == 17 or MAP[x][y] == 15 or MAP[x][y] == 16 or MAP1[x][y] == 17 or 2<=MAP[x][y]<=7):
|
|
|
|
|
elif old_x == x and abs(y - old_y) == 1 and (MAP[x][y] == 0 or MAP[x][y] == 17 or MAP[x][y] == 15 or MAP[x][y] == 16 or (MAP1[x][y] == 17 and 1<=MAP[x][y]<=7) or 2<=MAP[x][y]<=7):
|
|
|
|
|
if 2 <= MAP[x][y] <= 7:
|
|
|
|
|
if MAP[x][y] == 1:
|
|
|
|
|
if MAP1[x][y] != 20:
|
|
|
|
|
@ -958,7 +965,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 and 1<=MAP[x][y]<=7) or MAP[x][y] == 1):
|
|
|
|
|
if MAP[x][y] == 7:
|
|
|
|
|
if MAP1[old_x][old_y] != 20:
|
|
|
|
|
return 1
|
|
|
|
|
@ -969,7 +976,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 and 1<=MAP[x][y]<=7) or MAP[x][y] == 1):
|
|
|
|
|
if MAP[x][y] == 7:
|
|
|
|
|
if MAP1[old_x][old_y] != 20:
|
|
|
|
|
return 1
|
|
|
|
|
@ -985,10 +992,10 @@ def left_move(old_x,old_y,x,y,id,MAP,MAP1):
|
|
|
|
|
elif id == 9:
|
|
|
|
|
if MAP[x][y] == 18 and MAP[x][y] != 0 and MAP[x][y] != 15 and MAP[x][y] != 17 and MAP[x][y] != 16 and MAP1[x][y] != 17 and (2<MAP[x][y]<=14):
|
|
|
|
|
return 0
|
|
|
|
|
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 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 and 1<=MAP[x][y]<=7) 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:
|
|
|
|
|
@ -1002,7 +1009,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,10 +1021,10 @@ 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 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):
|
|
|
|
|
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 and 1<=MAP[x][y]<=7) 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:
|
|
|
|
|
@ -1031,7 +1038,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:
|
|
|
|
|
@ -1046,7 +1053,7 @@ def left_move(old_x,old_y,x,y,id,MAP,MAP1):
|
|
|
|
|
else:
|
|
|
|
|
return 0
|
|
|
|
|
elif id == 10:
|
|
|
|
|
if abs(x - old_x) <= 1 and abs(y - old_y) <= 1 and (MAP[x][y] == 0 or MAP[x][y] == 17 or MAP[x][y] == 15 or MAP[x][y] == 16 or MAP1[x][y] == 17 or 1<=MAP[x][y]<=3):
|
|
|
|
|
if abs(x - old_x) <= 1 and abs(y - old_y) <= 1 and (MAP[x][y] == 0 or MAP[x][y] == 17 or MAP[x][y] == 15 or MAP[x][y] == 16 or (MAP1[x][y] == 17 and 1<=MAP[x][y]<=7) or 1<=MAP[x][y]<=3):
|
|
|
|
|
if 1 <= MAP[x][y] <= 3:
|
|
|
|
|
if MAP[x][y] == 1:
|
|
|
|
|
if MAP1[x][y] != 20:
|
|
|
|
|
@ -1063,7 +1070,7 @@ def left_move(old_x,old_y,x,y,id,MAP,MAP1):
|
|
|
|
|
return 0
|
|
|
|
|
if(MAP[x][y] == 20):
|
|
|
|
|
return 0
|
|
|
|
|
if abs(x - old_x) == 1 and old_y == y and (MAP[x][y] == 0 or MAP[x][y] == 17 or MAP[x][y] == 15 or MAP[x][y] == 16 or MAP1[x][y] == 17 or 1<=MAP[x][y]<=4):
|
|
|
|
|
if abs(x - old_x) == 1 and old_y == y and (MAP[x][y] == 0 or MAP[x][y] == 17 or MAP[x][y] == 15 or MAP[x][y] == 16 or (MAP1[x][y] == 17 and 1<=MAP[x][y]<=7) or 1<=MAP[x][y]<=4):
|
|
|
|
|
if 1 <= MAP[x][y] <= 4:
|
|
|
|
|
if MAP[x][y] == 1:
|
|
|
|
|
if MAP1[x][y] != 20:
|
|
|
|
|
@ -1074,7 +1081,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] == 17 or MAP[x][y] == 15 or MAP[x][y] == 16 or MAP1[x][y] == 17 or 1<=MAP[x][y]<=4):
|
|
|
|
|
elif old_x == x and abs(y - old_y) == 1 and (MAP[x][y] == 0 or MAP[x][y] == 17 or MAP[x][y] == 15 or MAP[x][y] == 16 or (MAP1[x][y] == 17 and 1<=MAP[x][y]<=7) or 1<=MAP[x][y]<=4):
|
|
|
|
|
if 1 <= MAP[x][y] <= 4:
|
|
|
|
|
if MAP[x][y] == 1:
|
|
|
|
|
if MAP1[x][y] != 20:
|
|
|
|
|
@ -1092,7 +1099,7 @@ def left_move(old_x,old_y,x,y,id,MAP,MAP1):
|
|
|
|
|
return 0
|
|
|
|
|
if(MAP[x][y] == 20):
|
|
|
|
|
return 0
|
|
|
|
|
if abs(x - old_x) == 1 and old_y == y and (MAP[x][y] == 0 or MAP[x][y] == 17 or MAP[x][y] == 15 or MAP[x][y] == 16 or MAP1[x][y] == 17 or 1<=MAP[x][y]<=5):
|
|
|
|
|
if abs(x - old_x) == 1 and old_y == y and (MAP[x][y] == 0 or MAP[x][y] == 17 or MAP[x][y] == 15 or MAP[x][y] == 16 or (MAP1[x][y] == 17 and 1<=MAP[x][y]<=7) or 1<=MAP[x][y]<=5):
|
|
|
|
|
if 1 <= MAP[x][y] <= 5:
|
|
|
|
|
if MAP[x][y] == 1:
|
|
|
|
|
if MAP1[x][y] != 20:
|
|
|
|
|
@ -1103,7 +1110,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] == 17 or MAP[x][y] == 15 or MAP[x][y] == 16 or MAP1[x][y] == 17 or 1<=MAP[x][y]<=5):
|
|
|
|
|
elif old_x == x and abs(y - old_y) == 1 and (MAP[x][y] == 0 or MAP[x][y] == 17 or MAP[x][y] == 15 or MAP[x][y] == 16 or (MAP1[x][y] == 17 and 1<=MAP[x][y]<=7) or 1<=MAP[x][y]<=5):
|
|
|
|
|
if 1 <= MAP[x][y] <= 5:
|
|
|
|
|
if MAP[x][y] == 1:
|
|
|
|
|
if MAP1[x][y] != 20:
|
|
|
|
|
@ -1121,7 +1128,7 @@ def left_move(old_x,old_y,x,y,id,MAP,MAP1):
|
|
|
|
|
return 0
|
|
|
|
|
if MAP[x][y] == 20:
|
|
|
|
|
return 0
|
|
|
|
|
if abs(x - old_x) ==1 and old_y == y and (MAP[x][y] == 0 or MAP[x][y] == 17 or MAP[x][y] == 15 or MAP[x][y] == 16 or MAP1[x][y] == 17 or 1<=MAP[x][y]<=6):
|
|
|
|
|
if abs(x - old_x) ==1 and old_y == y and (MAP[x][y] == 0 or MAP[x][y] == 17 or MAP[x][y] == 15 or MAP[x][y] == 16 or (MAP1[x][y] == 17 and 1<=MAP[x][y]<=7) or 1<=MAP[x][y]<=6):
|
|
|
|
|
if 1 <= MAP[x][y] <= 6:
|
|
|
|
|
if MAP[x][y] == 1:
|
|
|
|
|
if MAP1[x][y] != 20:
|
|
|
|
|
@ -1132,7 +1139,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] == 17 or MAP[x][y] == 15 or MAP[x][y] == 16 or MAP1[x][y] == 17 or 1<=MAP[x][y]<=6):
|
|
|
|
|
elif old_x == x and abs(y - old_y) == 1 and (MAP[x][y] == 0 or MAP[x][y] == 17 or MAP[x][y] == 15 or MAP[x][y] == 16 or (MAP1[x][y] == 17 and 1<=MAP[x][y]<=7) or 1<=MAP[x][y]<=6):
|
|
|
|
|
if 1 <= MAP[x][y] <= 6:
|
|
|
|
|
if MAP[x][y] == 1:
|
|
|
|
|
if MAP1[x][y] != 20:
|
|
|
|
|
@ -1143,7 +1150,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 (MAP[x][y] == 0 or MAP[x][y] == 17 or MAP[x][y] == 15 or MAP[x][y] == 16 or MAP1[x][y] == 17 or 1<=MAP[x][y]<=6):
|
|
|
|
|
elif old_x == x and (MAP[x][y] == 0 or MAP[x][y] == 17 or MAP[x][y] == 15 or MAP[x][y] == 16 or (MAP1[x][y] == 17 and 1<=MAP[x][y]<=7) or 1<=MAP[x][y]<=6):
|
|
|
|
|
if y > old_y:
|
|
|
|
|
for i in range(old_y+1,y):
|
|
|
|
|
if MAP[x][i] != 20 and MAP[x][i] != 8 :
|
|
|
|
|
@ -1172,7 +1179,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_y == y and (MAP[x][y] == 0 or MAP[x][y] == 17 or MAP[x][y] == 15 or MAP[x][y] == 16 or MAP1[x][y] == 17 or 1<=MAP[x][y]<=6):
|
|
|
|
|
elif old_y == y and (MAP[x][y] == 0 or MAP[x][y] == 17 or MAP[x][y] == 15 or MAP[x][y] == 16 or (MAP1[x][y] == 17 and 1<=MAP[x][y]<=7) or 1<=MAP[x][y]<=6):
|
|
|
|
|
if x > old_x:
|
|
|
|
|
for i in range(old_x+1,x):
|
|
|
|
|
if MAP[i][y] != 20 and MAP[i][y] != 1 :
|
|
|
|
|
@ -1208,7 +1215,7 @@ def left_move(old_x,old_y,x,y,id,MAP,MAP1):
|
|
|
|
|
return 0
|
|
|
|
|
if(MAP[x][y] == 20):
|
|
|
|
|
return 0
|
|
|
|
|
if abs(x - old_x) == 1 and old_y == y and (MAP[x][y] == 0 or MAP[x][y] == 17 or MAP[x][y] == 15 or MAP[x][y] == 16 or MAP1[x][y] == 17 or 2<=MAP[x][y]<=7):
|
|
|
|
|
if abs(x - old_x) == 1 and old_y == y and (MAP[x][y] == 0 or MAP[x][y] == 17 or MAP[x][y] == 15 or MAP[x][y] == 16 or (MAP1[x][y] == 17 and 1<=MAP[x][y]<=7) or 2<=MAP[x][y]<=7):
|
|
|
|
|
if 2 <= MAP[x][y] <= 7:
|
|
|
|
|
if MAP[x][y] == 1:
|
|
|
|
|
if MAP1[x][y] != 20:
|
|
|
|
|
@ -1219,7 +1226,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] == 17 or MAP[x][y] == 15 or MAP[x][y] == 16 or MAP1[x][y] == 17 or 2<=MAP[x][y]<=7):
|
|
|
|
|
elif old_x == x and abs(y - old_y) == 1 and (MAP[x][y] == 0 or MAP[x][y] == 17 or MAP[x][y] == 15 or MAP[x][y] == 16 or (MAP1[x][y] == 17 and 1<=MAP[x][y]<=7) or 2<=MAP[x][y]<=7):
|
|
|
|
|
if 2 <= MAP[x][y] <= 7:
|
|
|
|
|
if MAP[x][y] == 1:
|
|
|
|
|
if MAP1[x][y] != 20:
|
|
|
|
|
@ -1249,11 +1256,13 @@ def left_Wall(id,MAP,MAP1):
|
|
|
|
|
old_x, old_y = init.calc(r_lion.x, r_lion.y)
|
|
|
|
|
elif id == 14:
|
|
|
|
|
old_x, old_y = init.calc(r_elephant.x, r_elephant.y)
|
|
|
|
|
for x in range(0,9):
|
|
|
|
|
for y in range(0,6):
|
|
|
|
|
if left_move(old_x,old_y,x,y,id,MAP,MAP1):
|
|
|
|
|
return 0
|
|
|
|
|
return 1
|
|
|
|
|
for x in range(0,9):
|
|
|
|
|
for y in range(0,7):
|
|
|
|
|
if left_move(old_x,old_y,x,y,id,MAP,MAP1):
|
|
|
|
|
return 0
|
|
|
|
|
return 1
|
|
|
|
|
else:
|
|
|
|
|
return 0
|
|
|
|
|
def right_win(x,y,MAP,MAP1):
|
|
|
|
|
isWin = 0
|
|
|
|
|
global l_animals
|
|
|
|
|
@ -1268,6 +1277,7 @@ def right_win(x,y,MAP,MAP1):
|
|
|
|
|
return 0
|
|
|
|
|
if isWin == 1:
|
|
|
|
|
return 1
|
|
|
|
|
#print(isWin)
|
|
|
|
|
return 0
|
|
|
|
|
|
|
|
|
|
def right_move(old_x,old_y,x,y,id,MAP,MAP1):
|
|
|
|
|
@ -1275,7 +1285,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 and 8<=MAP[x][y]<=14) 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:
|
|
|
|
|
@ -1286,7 +1296,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 and 8<=MAP[x][y]<=14)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,10 +1312,10 @@ def right_move(old_x,old_y,x,y,id,MAP,MAP1):
|
|
|
|
|
if MAP[x][y] == 16 and MAP[x][y] != 0 and MAP[x][y] != 15 and MAP[x][y] != 17 and MAP[x][y] != 18 and MAP1[x][y] != 15 and (9 < MAP[x][y] <= 14):
|
|
|
|
|
return 0
|
|
|
|
|
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):
|
|
|
|
|
MAP[x][y] == 0 or MAP[x][y] == 15 or MAP[x][y] == 17 or MAP[x][y] == 18 or (MAP1[x][y] == 15 and 8<=MAP[x][y]<=14)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:
|
|
|
|
|
@ -1319,7 +1329,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,10 +1342,10 @@ def right_move(old_x,old_y,x,y,id,MAP,MAP1):
|
|
|
|
|
return 1
|
|
|
|
|
return 1
|
|
|
|
|
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):
|
|
|
|
|
MAP[x][y] == 0 or MAP[x][y] == 15 or MAP[x][y] == 17 or MAP[x][y] == 18 or (MAP1[x][y] == 15 and 8<=MAP[x][y]<=14)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:
|
|
|
|
|
@ -1349,7 +1359,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:
|
|
|
|
|
@ -1364,7 +1374,7 @@ def right_move(old_x,old_y,x,y,id,MAP,MAP1):
|
|
|
|
|
else:
|
|
|
|
|
return 0
|
|
|
|
|
elif id == 3:
|
|
|
|
|
if abs(x - old_x) <= 1 and abs(y - old_y) <= 1 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] <= 10):
|
|
|
|
|
if abs(x - old_x) <= 1 and abs(y - old_y) <= 1 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 and 8<=MAP[x][y]<=14)or 8 <=MAP[x][y] <= 10):
|
|
|
|
|
if 8 <= MAP[x][y] <= 10:
|
|
|
|
|
if MAP[x][y] == 8:
|
|
|
|
|
if MAP1[x][y] != 20:
|
|
|
|
|
@ -1381,7 +1391,7 @@ def right_move(old_x,old_y,x,y,id,MAP,MAP1):
|
|
|
|
|
return 0
|
|
|
|
|
if (MAP[x][y] == 20):
|
|
|
|
|
return 0
|
|
|
|
|
if abs(x - old_x) == 1 and old_y == 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] <= 11):
|
|
|
|
|
if abs(x - old_x) == 1 and old_y == 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 and 8<=MAP[x][y]<=14)or 8 <=MAP[x][y] <= 11):
|
|
|
|
|
if 8 <= MAP[x][y] <= 11:
|
|
|
|
|
if MAP[x][y] == 8:
|
|
|
|
|
if MAP1[x][y] != 20:
|
|
|
|
|
@ -1392,7 +1402,7 @@ def right_move(old_x,old_y,x,y,id,MAP,MAP1):
|
|
|
|
|
if MAP1[x][y] == 15 and 8 <= MAP[x][y] <= 14:
|
|
|
|
|
return 1
|
|
|
|
|
return 1
|
|
|
|
|
elif old_x == x and abs(y - old_y) == 1 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] <= 11):
|
|
|
|
|
elif old_x == x and abs(y - old_y) == 1 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 and 8<=MAP[x][y]<=14)or 8 <=MAP[x][y] <= 11):
|
|
|
|
|
if 8 <= MAP[x][y] <= 11:
|
|
|
|
|
if MAP[x][y] == 8:
|
|
|
|
|
if MAP1[x][y] != 20:
|
|
|
|
|
@ -1410,7 +1420,7 @@ def right_move(old_x,old_y,x,y,id,MAP,MAP1):
|
|
|
|
|
return 0
|
|
|
|
|
if (MAP[x][y] == 20):
|
|
|
|
|
return 0
|
|
|
|
|
if abs(x - old_x) == 1 and old_y == 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] <= 12):
|
|
|
|
|
if abs(x - old_x) == 1 and old_y == 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 and 8<=MAP[x][y]<=14)or 8 <=MAP[x][y] <= 12):
|
|
|
|
|
if 8 <= MAP[x][y] <= 12:
|
|
|
|
|
if MAP[x][y] == 8:
|
|
|
|
|
if MAP1[x][y] != 20:
|
|
|
|
|
@ -1421,7 +1431,7 @@ def right_move(old_x,old_y,x,y,id,MAP,MAP1):
|
|
|
|
|
if MAP1[x][y] == 15 and 8 <= MAP[x][y] <= 14:
|
|
|
|
|
return 1
|
|
|
|
|
return 1
|
|
|
|
|
elif old_x == x and abs(y - old_y) == 1 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] <= 12):
|
|
|
|
|
elif old_x == x and abs(y - old_y) == 1 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 and 8<=MAP[x][y]<=14)or 8 <=MAP[x][y] <= 12):
|
|
|
|
|
if 8 <= MAP[x][y] <= 12:
|
|
|
|
|
if MAP[x][y] == 8:
|
|
|
|
|
if MAP1[x][y] != 20:
|
|
|
|
|
@ -1439,7 +1449,7 @@ def right_move(old_x,old_y,x,y,id,MAP,MAP1):
|
|
|
|
|
return 0
|
|
|
|
|
if MAP[x][y] == 20:
|
|
|
|
|
return 0
|
|
|
|
|
if abs(x - old_x) == 1 and old_y == 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] <= 13):
|
|
|
|
|
if abs(x - old_x) == 1 and old_y == 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 and 8<=MAP[x][y]<=14)or 8 <=MAP[x][y] <= 13):
|
|
|
|
|
if 8 <= MAP[x][y] <= 13:
|
|
|
|
|
if MAP[x][y] == 8:
|
|
|
|
|
if MAP1[x][y] != 20:
|
|
|
|
|
@ -1450,7 +1460,7 @@ def right_move(old_x,old_y,x,y,id,MAP,MAP1):
|
|
|
|
|
if MAP1[x][y] == 15 and 8 <= MAP[x][y] <= 14:
|
|
|
|
|
return 1
|
|
|
|
|
return 1
|
|
|
|
|
elif old_x == x and abs(y - old_y) == 1 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] <= 13):
|
|
|
|
|
elif old_x == x and abs(y - old_y) == 1 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 and 8<=MAP[x][y]<=14)or 8 <=MAP[x][y] <= 13):
|
|
|
|
|
if 8 <= MAP[x][y] <= 13:
|
|
|
|
|
if MAP[x][y] == 8:
|
|
|
|
|
if MAP1[x][y] != 20:
|
|
|
|
|
@ -1461,7 +1471,7 @@ def right_move(old_x,old_y,x,y,id,MAP,MAP1):
|
|
|
|
|
if MAP1[x][y] == 15 and 8 <= MAP[x][y] <= 14:
|
|
|
|
|
return 1
|
|
|
|
|
return 1
|
|
|
|
|
elif old_x == 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] <= 13):
|
|
|
|
|
elif old_x == 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 and 8<=MAP[x][y]<=14)or 8 <=MAP[x][y] <= 13):
|
|
|
|
|
if y > old_y:
|
|
|
|
|
for i in range(old_y + 1, y):
|
|
|
|
|
if MAP[x][i] != 20 and MAP[x][i] != 1:
|
|
|
|
|
@ -1490,7 +1500,7 @@ def right_move(old_x,old_y,x,y,id,MAP,MAP1):
|
|
|
|
|
if MAP1[x][y] == 15 and 8 <= MAP[x][y] <= 14:
|
|
|
|
|
return 1
|
|
|
|
|
return 1
|
|
|
|
|
elif old_y == 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] <= 13):
|
|
|
|
|
elif old_y == 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 and 8<=MAP[x][y]<=14)or 8 <=MAP[x][y] <= 13):
|
|
|
|
|
if x > old_x:
|
|
|
|
|
for i in range(old_x + 1, x):
|
|
|
|
|
if MAP[i][y] != 20 and MAP[i][y] != 1:
|
|
|
|
|
@ -1526,7 +1536,7 @@ def right_move(old_x,old_y,x,y,id,MAP,MAP1):
|
|
|
|
|
return 0
|
|
|
|
|
if (MAP[x][y] == 20):
|
|
|
|
|
return 0
|
|
|
|
|
if abs(x - old_x) == 1 and old_y == 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 9 <=MAP[x][y] <= 14):
|
|
|
|
|
if abs(x - old_x) == 1 and old_y == 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 and 8<=MAP[x][y]<=14)or 9 <=MAP[x][y] <= 14):
|
|
|
|
|
if 9 <= MAP[x][y] <= 14:
|
|
|
|
|
if MAP[x][y] == 8:
|
|
|
|
|
if MAP1[x][y] != 20:
|
|
|
|
|
@ -1537,7 +1547,7 @@ def right_move(old_x,old_y,x,y,id,MAP,MAP1):
|
|
|
|
|
if MAP1[x][y] == 15 and 8 <= MAP[x][y] <= 14:
|
|
|
|
|
return 1
|
|
|
|
|
return 1
|
|
|
|
|
elif old_x == x and abs(y - old_y) == 1 and (MAP[x][y] == 0 or MAP[x][y] == 15 or MAP[x][y] == 17 and MAP[x][y] == 18 or MAP1[x][y] == 15 or 9 <=MAP[x][y] <= 14):
|
|
|
|
|
elif old_x == x and abs(y - old_y) == 1 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 and 8<=MAP[x][y]<=14)or 9 <=MAP[x][y] <= 14):
|
|
|
|
|
if 9 <= MAP[x][y] <= 14:
|
|
|
|
|
if MAP[x][y] == 8:
|
|
|
|
|
if MAP1[x][y] != 20:
|
|
|
|
|
@ -1566,11 +1576,33 @@ def right_Wall(id,MAP,MAP1):
|
|
|
|
|
old_x, old_y = init.calc(l_lion.x, l_lion.y)
|
|
|
|
|
elif id == 7:
|
|
|
|
|
old_x, old_y = init.calc(l_elephant.x, l_elephant.y)
|
|
|
|
|
for x in range(0,9):
|
|
|
|
|
for y in range(0,6):
|
|
|
|
|
if right_move(old_x,old_y,x,y,id,MAP,MAP1):
|
|
|
|
|
return 0
|
|
|
|
|
return 1
|
|
|
|
|
for x in range(0,9):
|
|
|
|
|
for y in range(0,7):
|
|
|
|
|
if right_move(old_x,old_y,x,y,id,MAP,MAP1):
|
|
|
|
|
return 0
|
|
|
|
|
return 1
|
|
|
|
|
else:
|
|
|
|
|
return 0
|
|
|
|
|
|
|
|
|
|
def goBack(l_axis,r_axis,MAP,MAP1,turn,animalsName):
|
|
|
|
|
if turn:
|
|
|
|
|
id,old_x,old_y = l_axis.pop()
|
|
|
|
|
x, y = init.calc(animalsName[id].x,animalsName[id].y)
|
|
|
|
|
MAP[x][y] = MAP1[x][y]
|
|
|
|
|
MAP[old_x][old_y] = id
|
|
|
|
|
animalsName[id].x , animalsName[id].y = init.tran(old_x,old_y)
|
|
|
|
|
turn = 0
|
|
|
|
|
else :
|
|
|
|
|
id, old_x, old_y = r_axis.pop()
|
|
|
|
|
x, y = init.calc(animalsName[id].x, animalsName[id].y)
|
|
|
|
|
MAP[x][y] = MAP1[x][y]
|
|
|
|
|
MAP[old_x][old_y] = id
|
|
|
|
|
animalsName[id].x, animalsName[id].y = init.tran(old_x, old_y)
|
|
|
|
|
turn = 1
|
|
|
|
|
return l_axis,r_axis,MAP,MAP1,turn
|
|
|
|
|
|
|
|
|
|
animalsName = init.getAnimalsname()
|
|
|
|
|
print(animalsName)
|
|
|
|
|
def main():
|
|
|
|
|
global l_animals,r_animals
|
|
|
|
|
BGM.play(-1)
|
|
|
|
|
@ -1578,12 +1610,22 @@ def main():
|
|
|
|
|
MAP1 = init.clac_MAP1()
|
|
|
|
|
game_status = start_game.starting_screen()
|
|
|
|
|
if not game_status:
|
|
|
|
|
return True
|
|
|
|
|
return False
|
|
|
|
|
run = True
|
|
|
|
|
#print(animalsName[1].x)
|
|
|
|
|
l_axis=r_axis=[]
|
|
|
|
|
clock = pygame.time.Clock()
|
|
|
|
|
font = pygame.font.SysFont('kaiti',40)
|
|
|
|
|
status = id = old_x = old_y = x = y = turn = 0
|
|
|
|
|
while run:
|
|
|
|
|
#print("left win:",left_win(x, y, MAP, MAP1))
|
|
|
|
|
#print("right win:",right_win(x, y, MAP, MAP1))
|
|
|
|
|
if left_win(x, y, MAP, MAP1):
|
|
|
|
|
run = False
|
|
|
|
|
break
|
|
|
|
|
if right_win(x, y, MAP, MAP1):
|
|
|
|
|
run = False
|
|
|
|
|
break
|
|
|
|
|
clock.tick(FPS)
|
|
|
|
|
for event in pygame.event.get():
|
|
|
|
|
if event.type == pygame.QUIT:
|
|
|
|
|
@ -1637,12 +1679,14 @@ def main():
|
|
|
|
|
status = 1
|
|
|
|
|
else:
|
|
|
|
|
if(ismove(old_x,old_y,x,y,id,MAP,MAP1)):
|
|
|
|
|
print(MAP1[old_x][old_y])
|
|
|
|
|
#print(MAP1[old_x][old_y])
|
|
|
|
|
l_mouse.x,l_mouse.y = init.tran(x,y)
|
|
|
|
|
animalsName[1]=l_mouse
|
|
|
|
|
MAP[old_x][old_y] = MAP1[old_x][old_y]
|
|
|
|
|
MAP[x][y] = id
|
|
|
|
|
status = 0
|
|
|
|
|
turn = 1
|
|
|
|
|
l_axis.append((id,old_x,old_y))
|
|
|
|
|
else:
|
|
|
|
|
status = 0
|
|
|
|
|
elif id == 2 and turn == 0 and status == 1:
|
|
|
|
|
@ -1651,10 +1695,12 @@ def main():
|
|
|
|
|
else:
|
|
|
|
|
if (ismove(old_x,old_y,x,y,id,MAP,MAP1)) :
|
|
|
|
|
l_eagle.x , l_eagle.y = init.tran(x,y)
|
|
|
|
|
animalsName[2] = l_leopard
|
|
|
|
|
MAP[old_x][old_y] = MAP1[old_x][old_y]
|
|
|
|
|
MAP[x][y] = id
|
|
|
|
|
status = 0
|
|
|
|
|
turn = 1
|
|
|
|
|
l_axis.append((id, old_x, old_y))
|
|
|
|
|
else :
|
|
|
|
|
status = 0
|
|
|
|
|
elif id == 3 and turn == 0 and status == 1:
|
|
|
|
|
@ -1663,10 +1709,12 @@ def main():
|
|
|
|
|
else:
|
|
|
|
|
if (ismove(old_x,old_y,x,y,id,MAP,MAP1)) :
|
|
|
|
|
l_fox.x , l_fox.y = init.tran(x,y)
|
|
|
|
|
animalsName[3] = l_fox
|
|
|
|
|
MAP[old_x][old_y] = MAP1[old_x][old_y]
|
|
|
|
|
MAP[x][y] = id
|
|
|
|
|
status = 0
|
|
|
|
|
turn = 1
|
|
|
|
|
l_axis.append((id, old_x, old_y))
|
|
|
|
|
else :
|
|
|
|
|
status = 0
|
|
|
|
|
elif id == 4 and turn == 0 and status == 1:
|
|
|
|
|
@ -1675,10 +1723,12 @@ def main():
|
|
|
|
|
else:
|
|
|
|
|
if (ismove(old_x,old_y,x,y,id,MAP,MAP1)) :
|
|
|
|
|
l_wolf.x , l_wolf.y = init.tran(x,y)
|
|
|
|
|
animalsName[4] = l_wolf
|
|
|
|
|
MAP[old_x][old_y] = MAP1[old_x][old_y]
|
|
|
|
|
MAP[x][y] = id
|
|
|
|
|
status = 0
|
|
|
|
|
turn = 1
|
|
|
|
|
l_axis.append((id, old_x, old_y))
|
|
|
|
|
else :
|
|
|
|
|
status = 0
|
|
|
|
|
elif id == 5 and turn == 0 and status == 1:
|
|
|
|
|
@ -1687,10 +1737,12 @@ def main():
|
|
|
|
|
else:
|
|
|
|
|
if (ismove(old_x,old_y,x,y,id,MAP,MAP1)) :
|
|
|
|
|
l_leopard.x , l_leopard.y = init.tran(x,y)
|
|
|
|
|
animalsName[5] = l_leopard
|
|
|
|
|
MAP[old_x][old_y] = MAP1[old_x][old_y]
|
|
|
|
|
MAP[x][y] = id
|
|
|
|
|
status = 0
|
|
|
|
|
turn = 1
|
|
|
|
|
l_axis.append((id, old_x, old_y))
|
|
|
|
|
else :
|
|
|
|
|
status = 0
|
|
|
|
|
elif id == 6 and turn == 0 and status == 1:
|
|
|
|
|
@ -1699,10 +1751,12 @@ def main():
|
|
|
|
|
else:
|
|
|
|
|
if (ismove(old_x,old_y,x,y,id,MAP,MAP1)) :
|
|
|
|
|
l_lion.x , l_lion.y = init.tran(x,y)
|
|
|
|
|
animalsName[6] = l_lion
|
|
|
|
|
MAP[old_x][old_y] = MAP1[old_x][old_y]
|
|
|
|
|
MAP[x][y] = id
|
|
|
|
|
status = 0
|
|
|
|
|
turn = 1
|
|
|
|
|
l_axis.append((id, old_x, old_y))
|
|
|
|
|
else :
|
|
|
|
|
status = 0
|
|
|
|
|
elif id == 7 and turn == 0 and status == 1:
|
|
|
|
|
@ -1711,10 +1765,12 @@ def main():
|
|
|
|
|
else:
|
|
|
|
|
if (ismove(old_x,old_y,x,y,id,MAP,MAP1)) :
|
|
|
|
|
l_elephant.x , l_elephant.y = init.tran(x,y)
|
|
|
|
|
animalsName[7] = l_elephant
|
|
|
|
|
MAP[old_x][old_y] = MAP1[old_x][old_y]
|
|
|
|
|
MAP[x][y] = id
|
|
|
|
|
status = 0
|
|
|
|
|
turn = 1
|
|
|
|
|
l_axis.append((id, old_x, old_y))
|
|
|
|
|
else :
|
|
|
|
|
status = 0
|
|
|
|
|
elif id == 8 and turn == 1 and status == 2:
|
|
|
|
|
@ -1723,10 +1779,12 @@ def main():
|
|
|
|
|
else:
|
|
|
|
|
if (ismove(old_x,old_y,x,y,id,MAP,MAP1)) :
|
|
|
|
|
r_mouse.x , r_mouse.y = init.tran(x,y)
|
|
|
|
|
animalsName[8] = r_mouse
|
|
|
|
|
MAP[old_x][old_y] = MAP1[old_x][old_y]
|
|
|
|
|
MAP[x][y] = id
|
|
|
|
|
status = 0
|
|
|
|
|
turn = 0
|
|
|
|
|
r_axis.append((id, old_x, old_y))
|
|
|
|
|
else :
|
|
|
|
|
status = 0
|
|
|
|
|
elif id == 9 and turn == 1 and status == 2:
|
|
|
|
|
@ -1735,10 +1793,12 @@ def main():
|
|
|
|
|
else:
|
|
|
|
|
if (ismove(old_x,old_y,x,y,id,MAP,MAP1)) :
|
|
|
|
|
r_eagle.x , r_eagle.y = init.tran(x,y)
|
|
|
|
|
animalsName[9] = r_eagle
|
|
|
|
|
MAP[old_x][old_y] = MAP1[old_x][old_y]
|
|
|
|
|
MAP[x][y] = id
|
|
|
|
|
status = 0
|
|
|
|
|
turn = 0
|
|
|
|
|
r_axis.append((id, old_x, old_y))
|
|
|
|
|
else :
|
|
|
|
|
status = 0
|
|
|
|
|
elif id == 10 and turn == 1 and status == 2:
|
|
|
|
|
@ -1747,10 +1807,12 @@ def main():
|
|
|
|
|
else:
|
|
|
|
|
if (ismove(old_x,old_y,x,y,id,MAP,MAP1)) :
|
|
|
|
|
r_fox.x , r_fox.y = init.tran(x,y)
|
|
|
|
|
animalsName[10] = r_fox
|
|
|
|
|
MAP[old_x][old_y] = MAP1[old_x][old_y]
|
|
|
|
|
MAP[x][y] = id
|
|
|
|
|
status = 0
|
|
|
|
|
turn = 0
|
|
|
|
|
r_axis.append((id, old_x, old_y))
|
|
|
|
|
else :
|
|
|
|
|
status = 0
|
|
|
|
|
elif id == 11 and turn == 1 and status == 2:
|
|
|
|
|
@ -1759,10 +1821,12 @@ def main():
|
|
|
|
|
else:
|
|
|
|
|
if (ismove(old_x,old_y,x,y,id,MAP,MAP1)) :
|
|
|
|
|
r_wolf.x , r_wolf.y = init.tran(x,y)
|
|
|
|
|
animalsName[11] = r_wolf
|
|
|
|
|
MAP[old_x][old_y] = MAP1[old_x][old_y]
|
|
|
|
|
MAP[x][y] = id
|
|
|
|
|
status = 0
|
|
|
|
|
turn = 0
|
|
|
|
|
r_axis.append((id, old_x, old_y))
|
|
|
|
|
else :
|
|
|
|
|
status = 0
|
|
|
|
|
elif id == 12 and turn == 1 and status == 2:
|
|
|
|
|
@ -1771,10 +1835,12 @@ def main():
|
|
|
|
|
else:
|
|
|
|
|
if (ismove(old_x,old_y,x,y,id,MAP,MAP1)) :
|
|
|
|
|
r_leopard.x , r_leopard.y = init.tran(x,y)
|
|
|
|
|
animalsName[12] = r_leopard
|
|
|
|
|
MAP[old_x][old_y] = MAP1[old_x][old_y]
|
|
|
|
|
MAP[x][y] = id
|
|
|
|
|
status = 0
|
|
|
|
|
turn = 0
|
|
|
|
|
r_axis.append((id, old_x, old_y))
|
|
|
|
|
else :
|
|
|
|
|
status = 0
|
|
|
|
|
elif id == 13 and turn == 1 and status == 2:
|
|
|
|
|
@ -1783,10 +1849,12 @@ def main():
|
|
|
|
|
else:
|
|
|
|
|
if (ismove(old_x,old_y,x,y,id,MAP,MAP1)) :
|
|
|
|
|
r_lion.x , r_lion.y = init.tran(x,y)
|
|
|
|
|
animalsName[13] = r_lion
|
|
|
|
|
MAP[old_x][old_y] = MAP1[old_x][old_y]
|
|
|
|
|
MAP[x][y] = id
|
|
|
|
|
status = 0
|
|
|
|
|
turn = 0
|
|
|
|
|
r_axis.append((id, old_x, old_y))
|
|
|
|
|
else :
|
|
|
|
|
status = 0
|
|
|
|
|
elif id == 14 and turn == 1 and status == 2:
|
|
|
|
|
@ -1795,18 +1863,22 @@ def main():
|
|
|
|
|
else:
|
|
|
|
|
if (ismove(old_x,old_y,x,y,id,MAP,MAP1)) :
|
|
|
|
|
r_elephant.x , r_elephant.y = init.tran(x,y)
|
|
|
|
|
animalsName[14] = r_elephant
|
|
|
|
|
MAP[old_x][old_y] = MAP1[old_x][old_y]
|
|
|
|
|
MAP[x][y] = id
|
|
|
|
|
status = 0
|
|
|
|
|
turn = 0
|
|
|
|
|
r_axis.append((id, old_x, old_y))
|
|
|
|
|
else :
|
|
|
|
|
status = 0
|
|
|
|
|
if left_win(x,y,MAP,MAP1):
|
|
|
|
|
run = False
|
|
|
|
|
if right_win(x,y,MAP,MAP1):
|
|
|
|
|
run = False
|
|
|
|
|
if left_win(x, y, MAP, MAP1):
|
|
|
|
|
run = False
|
|
|
|
|
if right_win(x, y, MAP, MAP1):
|
|
|
|
|
run = False
|
|
|
|
|
l_elephant, l_eagle, l_wolf, l_lion, l_leopard, l_mouse, l_fox, r_elephant, r_eagle, r_wolf, r_lion, r_leopard, r_fox, r_mouse = init.update(animalsName)
|
|
|
|
|
draw_window(l_elephant,l_eagle,l_wolf,l_lion,l_leopard,l_mouse,l_fox,r_elephant,r_eagle,r_wolf,r_lion,r_leopard,r_mouse,r_fox,id, x, y, status, MAP, MAP1,turn)
|
|
|
|
|
|
|
|
|
|
#print("left win:", left_win(x, y, MAP, MAP1))
|
|
|
|
|
#print("right win:", right_win(x, y, MAP, MAP1))
|
|
|
|
|
if left_win(x, y, MAP, MAP1):
|
|
|
|
|
print_text(WIN, font, 500, 400, "Left Win!", RED)
|
|
|
|
|
pygame.display.update()
|
|
|
|
|
@ -1817,11 +1889,18 @@ def main():
|
|
|
|
|
#os.system("pause")
|
|
|
|
|
return start_game.starting_screen()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
|
again = 1
|
|
|
|
|
while again == 1:
|
|
|
|
|
l_elephant, l_eagle, l_wolf, l_lion, l_leopard, l_mouse, l_fox, r_elephant, r_eagle, r_wolf, r_lion, r_leopard, r_fox, r_mouse=init.refresh()
|
|
|
|
|
#print(r_eagle)
|
|
|
|
|
draw_window(l_elephant, l_eagle, l_wolf, l_lion, l_leopard, l_mouse, l_fox, r_elephant, r_eagle, r_wolf, r_lion,
|
|
|
|
|
r_leopard, r_mouse, r_fox,0,0,0,0,0,0,0)
|
|
|
|
|
again = main()
|
|
|
|
|
l_animals = r_animals = 7
|
|
|
|
|
ID = [1 for i in range(20)]
|
|
|
|
|
l_elephant, l_eagle, l_wolf, l_lion, l_leopard, l_mouse, l_fox, r_elephant, r_eagle, r_wolf, r_lion, r_leopard, r_fox, r_mouse = init.refresh()
|
|
|
|
|
animalsName = init.getAnimalsname()
|
|
|
|
|
print(animalsName)
|
|
|
|
|
pygame.quit()
|
|
|
|
|
|